polishing
This commit is contained in:
parent
6d7bf17394
commit
f19fdde61b
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2008 the original author or authors.
|
* Copyright 2002-2009 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -59,8 +59,8 @@ public abstract class AbstractCachingLabeledEnumResolver implements LabeledEnumR
|
||||||
|
|
||||||
public LabeledEnum getLabeledEnumByCode(Class type, Comparable code) throws IllegalArgumentException {
|
public LabeledEnum getLabeledEnumByCode(Class type, Comparable code) throws IllegalArgumentException {
|
||||||
Assert.notNull(code, "No enum code specified");
|
Assert.notNull(code, "No enum code specified");
|
||||||
Map typeEnums = getLabeledEnumMap(type);
|
Map<Comparable, LabeledEnum> typeEnums = getLabeledEnumMap(type);
|
||||||
LabeledEnum codedEnum = (LabeledEnum) typeEnums.get(code);
|
LabeledEnum codedEnum = typeEnums.get(code);
|
||||||
if (codedEnum == null) {
|
if (codedEnum == null) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"No enumeration with code '" + code + "'" + " of type [" + type.getName() +
|
"No enumeration with code '" + code + "'" + " of type [" + type.getName() +
|
||||||
|
|
@ -94,6 +94,9 @@ public abstract class AbstractCachingLabeledEnumResolver implements LabeledEnumR
|
||||||
protected abstract Set<LabeledEnum> findLabeledEnums(Class type);
|
protected abstract Set<LabeledEnum> findLabeledEnums(Class type);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inner cache class that implements lazy building of LabeledEnum Maps.
|
||||||
|
*/
|
||||||
private class LabeledEnumCache extends CachingMapDecorator<Class, Map<Comparable, LabeledEnum>> {
|
private class LabeledEnumCache extends CachingMapDecorator<Class, Map<Comparable, LabeledEnum>> {
|
||||||
|
|
||||||
public LabeledEnumCache() {
|
public LabeledEnumCache() {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2007 the original author or authors.
|
* Copyright 2002-2009 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -22,7 +22,6 @@ import java.lang.annotation.Retention;
|
||||||
import java.lang.annotation.RetentionPolicy;
|
import java.lang.annotation.RetentionPolicy;
|
||||||
import java.lang.annotation.Target;
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
|
||||||
@Target({ElementType.TYPE, ElementType.METHOD})
|
@Target({ElementType.TYPE, ElementType.METHOD})
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
@Documented
|
@Documented
|
||||||
|
|
@ -32,6 +31,6 @@ public @interface Scope {
|
||||||
* Specifies the scope to use for instances of the annotated class.
|
* Specifies the scope to use for instances of the annotated class.
|
||||||
* @return the desired scope
|
* @return the desired scope
|
||||||
*/
|
*/
|
||||||
public abstract String value() default "singleton";
|
String value() default "singleton";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2007 the original author or authors.
|
* Copyright 2002-2009 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -77,7 +77,7 @@ public class AspectJTypeFilterTests extends TestCase {
|
||||||
"java.lang.String+");
|
"java.lang.String+");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testAnnotationPatternMathces() throws Exception {
|
public void testAnnotationPatternMatches() throws Exception {
|
||||||
assertMatch("org.springframework.core.type.AspectJTypeFilterTests$SomeClassAnnotatedWithComponent",
|
assertMatch("org.springframework.core.type.AspectJTypeFilterTests$SomeClassAnnotatedWithComponent",
|
||||||
"@org.springframework.stereotype.Component *..*");
|
"@org.springframework.stereotype.Component *..*");
|
||||||
assertMatch("org.springframework.core.type.AspectJTypeFilterTests$SomeClassAnnotatedWithComponent",
|
assertMatch("org.springframework.core.type.AspectJTypeFilterTests$SomeClassAnnotatedWithComponent",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue