Add @Override annotations to main sources
Issue: SPR-10130
This commit is contained in:
@@ -39,6 +39,7 @@ public abstract class AttributeAccessorSupport implements AttributeAccessor, Ser
|
||||
private final Map<String, Object> attributes = new LinkedHashMap<String, Object>(0);
|
||||
|
||||
|
||||
@Override
|
||||
public void setAttribute(String name, Object value) {
|
||||
Assert.notNull(name, "Name must not be null");
|
||||
if (value != null) {
|
||||
@@ -49,21 +50,25 @@ public abstract class AttributeAccessorSupport implements AttributeAccessor, Ser
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getAttribute(String name) {
|
||||
Assert.notNull(name, "Name must not be null");
|
||||
return this.attributes.get(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object removeAttribute(String name) {
|
||||
Assert.notNull(name, "Name must not be null");
|
||||
return this.attributes.remove(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasAttribute(String name) {
|
||||
Assert.notNull(name, "Name must not be null");
|
||||
return this.attributes.containsKey(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] attributeNames() {
|
||||
return this.attributes.keySet().toArray(new String[this.attributes.size()]);
|
||||
}
|
||||
|
||||
@@ -61,6 +61,7 @@ public abstract class ControlFlowFactory {
|
||||
/**
|
||||
* Searches for class name match in a StackTraceElement.
|
||||
*/
|
||||
@Override
|
||||
public boolean under(Class clazz) {
|
||||
Assert.notNull(clazz, "Class must not be null");
|
||||
String className = clazz.getName();
|
||||
@@ -76,6 +77,7 @@ public abstract class ControlFlowFactory {
|
||||
* Searches for class name match plus method name match
|
||||
* in a StackTraceElement.
|
||||
*/
|
||||
@Override
|
||||
public boolean under(Class clazz, String methodName) {
|
||||
Assert.notNull(clazz, "Class must not be null");
|
||||
Assert.notNull(methodName, "Method name must not be null");
|
||||
@@ -93,6 +95,7 @@ public abstract class ControlFlowFactory {
|
||||
* Leave it up to the caller to decide what matches.
|
||||
* Caller must understand stack trace format, so there's less abstraction.
|
||||
*/
|
||||
@Override
|
||||
public boolean underToken(String token) {
|
||||
if (token == null) {
|
||||
return false;
|
||||
|
||||
@@ -55,6 +55,7 @@ public class ExceptionDepthComparator implements Comparator<Class<? extends Thro
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int compare(Class<? extends Throwable> o1, Class<? extends Throwable> o2) {
|
||||
int depth1 = getDepth(o1, this.targetException, 0);
|
||||
int depth2 = getDepth(o2, this.targetException, 0);
|
||||
|
||||
@@ -64,6 +64,7 @@ public class LocalVariableTableParameterNameDiscoverer implements ParameterNameD
|
||||
new ConcurrentHashMap<Class<?>, Map<Member, String[]>>(32);
|
||||
|
||||
|
||||
@Override
|
||||
public String[] getParameterNames(Method method) {
|
||||
Class<?> declaringClass = method.getDeclaringClass();
|
||||
Map<Member, String[]> map = this.parameterNamesCache.get(declaringClass);
|
||||
@@ -78,6 +79,7 @@ public class LocalVariableTableParameterNameDiscoverer implements ParameterNameD
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getParameterNames(Constructor<?> ctor) {
|
||||
Class<?> declaringClass = ctor.getDeclaringClass();
|
||||
Map<Member, String[]> map = this.parameterNamesCache.get(declaringClass);
|
||||
|
||||
@@ -43,6 +43,7 @@ public class OrderComparator implements Comparator<Object> {
|
||||
public static final OrderComparator INSTANCE = new OrderComparator();
|
||||
|
||||
|
||||
@Override
|
||||
public int compare(Object o1, Object o2) {
|
||||
boolean p1 = (o1 instanceof PriorityOrdered);
|
||||
boolean p2 = (o2 instanceof PriorityOrdered);
|
||||
|
||||
@@ -48,6 +48,7 @@ public class PrioritizedParameterNameDiscoverer implements ParameterNameDiscover
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String[] getParameterNames(Method method) {
|
||||
for (ParameterNameDiscoverer pnd : this.parameterNameDiscoverers) {
|
||||
String[] result = pnd.getParameterNames(method);
|
||||
@@ -58,6 +59,7 @@ public class PrioritizedParameterNameDiscoverer implements ParameterNameDiscover
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getParameterNames(Constructor ctor) {
|
||||
for (ParameterNameDiscoverer pnd : this.parameterNameDiscoverers) {
|
||||
String[] result = pnd.getParameterNames(ctor);
|
||||
|
||||
@@ -41,6 +41,7 @@ public class SimpleAliasRegistry implements AliasRegistry {
|
||||
private final Map<String, String> aliasMap = new ConcurrentHashMap<String, String>(16);
|
||||
|
||||
|
||||
@Override
|
||||
public void registerAlias(String name, String alias) {
|
||||
Assert.hasText(name, "'name' must not be empty");
|
||||
Assert.hasText(alias, "'alias' must not be empty");
|
||||
@@ -68,6 +69,7 @@ public class SimpleAliasRegistry implements AliasRegistry {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeAlias(String alias) {
|
||||
String name = this.aliasMap.remove(alias);
|
||||
if (name == null) {
|
||||
@@ -75,10 +77,12 @@ public class SimpleAliasRegistry implements AliasRegistry {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAlias(String name) {
|
||||
return this.aliasMap.containsKey(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getAliases(String name) {
|
||||
List<String> result = new ArrayList<String>();
|
||||
synchronized (this.aliasMap) {
|
||||
|
||||
@@ -77,6 +77,7 @@ public class ConvertingComparator<S, T> implements Comparator<S> {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int compare(S o1, S o2) {
|
||||
T c1 = this.converter.convert(o1);
|
||||
T c2 = this.converter.convert(o2);
|
||||
@@ -94,6 +95,7 @@ public class ConvertingComparator<S, T> implements Comparator<S> {
|
||||
Comparator<K> comparator) {
|
||||
return new ConvertingComparator<Map.Entry<K,V>, K>(comparator, new Converter<Map.Entry<K, V>, K>() {
|
||||
|
||||
@Override
|
||||
public K convert(Map.Entry<K, V> source) {
|
||||
return source.getKey();
|
||||
}
|
||||
@@ -111,6 +113,7 @@ public class ConvertingComparator<S, T> implements Comparator<S> {
|
||||
Comparator<V> comparator) {
|
||||
return new ConvertingComparator<Map.Entry<K,V>, V>(comparator, new Converter<Map.Entry<K, V>, V>() {
|
||||
|
||||
@Override
|
||||
public V convert(Map.Entry<K, V> source) {
|
||||
return source.getValue();
|
||||
}
|
||||
@@ -135,6 +138,7 @@ public class ConvertingComparator<S, T> implements Comparator<S> {
|
||||
this.targetType = targetType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T convert(S source) {
|
||||
return this.conversionService.convert(source, this.targetType);
|
||||
}
|
||||
|
||||
@@ -45,14 +45,17 @@ final class ArrayToArrayConverter implements ConditionalGenericConverter {
|
||||
this.conversionService = conversionService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<ConvertiblePair> getConvertibleTypes() {
|
||||
return Collections.singleton(new ConvertiblePair(Object[].class, Object[].class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(TypeDescriptor sourceType, TypeDescriptor targetType) {
|
||||
return this.helperConverter.matches(sourceType, targetType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object convert(Object source, TypeDescriptor sourceType,
|
||||
TypeDescriptor targetType) {
|
||||
if ((conversionService instanceof GenericConversionService)
|
||||
|
||||
@@ -44,15 +44,18 @@ final class ArrayToCollectionConverter implements ConditionalGenericConverter {
|
||||
this.conversionService = conversionService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<ConvertiblePair> getConvertibleTypes() {
|
||||
return Collections.singleton(new ConvertiblePair(Object[].class, Collection.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(TypeDescriptor sourceType, TypeDescriptor targetType) {
|
||||
return ConversionUtils.canConvertElements(
|
||||
sourceType.getElementTypeDescriptor(), targetType.getElementTypeDescriptor(), this.conversionService);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) {
|
||||
if (source == null) {
|
||||
|
||||
@@ -38,14 +38,17 @@ final class ArrayToObjectConverter implements ConditionalGenericConverter {
|
||||
this.conversionService = conversionService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<ConvertiblePair> getConvertibleTypes() {
|
||||
return Collections.singleton(new ConvertiblePair(Object[].class, Object.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(TypeDescriptor sourceType, TypeDescriptor targetType) {
|
||||
return ConversionUtils.canConvertElements(sourceType.getElementTypeDescriptor(), targetType, this.conversionService);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) {
|
||||
if (source == null) {
|
||||
return null;
|
||||
|
||||
@@ -40,14 +40,17 @@ final class ArrayToStringConverter implements ConditionalGenericConverter {
|
||||
this.helperConverter = new CollectionToStringConverter(conversionService);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<ConvertiblePair> getConvertibleTypes() {
|
||||
return Collections.singleton(new ConvertiblePair(Object[].class, String.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(TypeDescriptor sourceType, TypeDescriptor targetType) {
|
||||
return this.helperConverter.matches(sourceType, targetType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) {
|
||||
return this.helperConverter.convert(Arrays.asList(ObjectUtils.toObjectArray(source)), sourceType, targetType);
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ import org.springframework.util.NumberUtils;
|
||||
*/
|
||||
final class CharacterToNumberFactory implements ConverterFactory<Character, Number> {
|
||||
|
||||
@Override
|
||||
public <T extends Number> Converter<Character, T> getConverter(Class<T> targetType) {
|
||||
return new CharacterToNumber<T>(targetType);
|
||||
}
|
||||
@@ -52,6 +53,7 @@ final class CharacterToNumberFactory implements ConverterFactory<Character, Numb
|
||||
this.targetType = targetType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T convert(Character source) {
|
||||
return NumberUtils.convertNumberToTargetClass((short) source.charValue(), this.targetType);
|
||||
}
|
||||
|
||||
@@ -44,14 +44,17 @@ final class CollectionToArrayConverter implements ConditionalGenericConverter {
|
||||
this.conversionService = conversionService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<ConvertiblePair> getConvertibleTypes() {
|
||||
return Collections.singleton(new ConvertiblePair(Collection.class, Object[].class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(TypeDescriptor sourceType, TypeDescriptor targetType) {
|
||||
return ConversionUtils.canConvertElements(sourceType.getElementTypeDescriptor(), targetType.getElementTypeDescriptor(), this.conversionService);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) {
|
||||
if (source == null) {
|
||||
return null;
|
||||
|
||||
@@ -44,15 +44,18 @@ final class CollectionToCollectionConverter implements ConditionalGenericConvert
|
||||
this.conversionService = conversionService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<ConvertiblePair> getConvertibleTypes() {
|
||||
return Collections.singleton(new ConvertiblePair(Collection.class, Collection.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(TypeDescriptor sourceType, TypeDescriptor targetType) {
|
||||
return ConversionUtils.canConvertElements(
|
||||
sourceType.getElementTypeDescriptor(), targetType.getElementTypeDescriptor(), this.conversionService);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) {
|
||||
if (source == null) {
|
||||
|
||||
@@ -38,14 +38,17 @@ final class CollectionToObjectConverter implements ConditionalGenericConverter {
|
||||
this.conversionService = conversionService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<ConvertiblePair> getConvertibleTypes() {
|
||||
return Collections.singleton(new ConvertiblePair(Collection.class, Object.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(TypeDescriptor sourceType, TypeDescriptor targetType) {
|
||||
return ConversionUtils.canConvertElements(sourceType.getElementTypeDescriptor(), targetType, this.conversionService);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) {
|
||||
if (source == null) {
|
||||
return null;
|
||||
|
||||
@@ -40,14 +40,17 @@ final class CollectionToStringConverter implements ConditionalGenericConverter {
|
||||
this.conversionService = conversionService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<ConvertiblePair> getConvertibleTypes() {
|
||||
return Collections.singleton(new ConvertiblePair(Collection.class, String.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(TypeDescriptor sourceType, TypeDescriptor targetType) {
|
||||
return ConversionUtils.canConvertElements(sourceType.getElementTypeDescriptor(), targetType, this.conversionService);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) {
|
||||
if (source == null) {
|
||||
return null;
|
||||
|
||||
@@ -37,6 +37,7 @@ final class EnumToStringConverter implements Converter<Enum<?>, String>, Conditi
|
||||
this.conversionService = conversionService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(TypeDescriptor sourceType, TypeDescriptor targetType) {
|
||||
for (Class<?> interfaceType : ClassUtils.getAllInterfacesForClass(sourceType.getType())) {
|
||||
if (conversionService.canConvert(TypeDescriptor.valueOf(interfaceType), targetType)) {
|
||||
@@ -46,6 +47,7 @@ final class EnumToStringConverter implements Converter<Enum<?>, String>, Conditi
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String convert(Enum<?> source) {
|
||||
return source.name();
|
||||
}
|
||||
|
||||
@@ -35,10 +35,12 @@ import org.springframework.core.convert.converter.ConditionalGenericConverter;
|
||||
*/
|
||||
final class FallbackObjectToStringConverter implements ConditionalGenericConverter {
|
||||
|
||||
@Override
|
||||
public Set<ConvertiblePair> getConvertibleTypes() {
|
||||
return Collections.singleton(new ConvertiblePair(Object.class, String.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(TypeDescriptor sourceType, TypeDescriptor targetType) {
|
||||
Class<?> sourceClass = sourceType.getObjectType();
|
||||
if (String.class.equals(sourceClass)) {
|
||||
@@ -48,6 +50,7 @@ final class FallbackObjectToStringConverter implements ConditionalGenericConvert
|
||||
ObjectToObjectConverter.hasValueOfMethodOrConstructor(sourceClass, String.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) {
|
||||
return (source != null ? source.toString() : null);
|
||||
}
|
||||
|
||||
@@ -79,6 +79,7 @@ public class GenericConversionService implements ConfigurableConversionService {
|
||||
|
||||
// implementing ConverterRegistry
|
||||
|
||||
@Override
|
||||
public void addConverter(Converter<?, ?> converter) {
|
||||
GenericConverter.ConvertiblePair typeInfo = getRequiredTypeInfo(converter, Converter.class);
|
||||
Assert.notNull(typeInfo, "Unable to the determine sourceType <S> and targetType " +
|
||||
@@ -86,16 +87,19 @@ public class GenericConversionService implements ConfigurableConversionService {
|
||||
addConverter(new ConverterAdapter(typeInfo, converter));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addConverter(Class<?> sourceType, Class<?> targetType, Converter<?, ?> converter) {
|
||||
GenericConverter.ConvertiblePair typeInfo = new GenericConverter.ConvertiblePair(sourceType, targetType);
|
||||
addConverter(new ConverterAdapter(typeInfo, converter));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addConverter(GenericConverter converter) {
|
||||
this.converters.add(converter);
|
||||
invalidateCache();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addConverterFactory(ConverterFactory<?, ?> converterFactory) {
|
||||
GenericConverter.ConvertiblePair typeInfo = getRequiredTypeInfo(converterFactory, ConverterFactory.class);
|
||||
if (typeInfo == null) {
|
||||
@@ -106,6 +110,7 @@ public class GenericConversionService implements ConfigurableConversionService {
|
||||
addConverter(new ConverterFactoryAdapter(typeInfo, converterFactory));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeConvertible(Class<?> sourceType, Class<?> targetType) {
|
||||
this.converters.remove(sourceType, targetType);
|
||||
invalidateCache();
|
||||
@@ -113,6 +118,7 @@ public class GenericConversionService implements ConfigurableConversionService {
|
||||
|
||||
// implementing ConversionService
|
||||
|
||||
@Override
|
||||
public boolean canConvert(Class<?> sourceType, Class<?> targetType) {
|
||||
Assert.notNull(targetType, "The targetType to convert to cannot be null");
|
||||
return canConvert(sourceType != null ?
|
||||
@@ -120,6 +126,7 @@ public class GenericConversionService implements ConfigurableConversionService {
|
||||
TypeDescriptor.valueOf(targetType));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConvert(TypeDescriptor sourceType, TypeDescriptor targetType) {
|
||||
Assert.notNull(targetType,"The targetType to convert to cannot be null");
|
||||
if (sourceType == null) {
|
||||
@@ -148,12 +155,14 @@ public class GenericConversionService implements ConfigurableConversionService {
|
||||
return (converter == NO_OP_CONVERTER);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> T convert(Object source, Class<T> targetType) {
|
||||
Assert.notNull(targetType,"The targetType to convert to cannot be null");
|
||||
return (T) convert(source, TypeDescriptor.forObject(source), TypeDescriptor.valueOf(targetType));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) {
|
||||
Assert.notNull(targetType,"The targetType to convert to cannot be null");
|
||||
if (sourceType == null) {
|
||||
@@ -308,10 +317,12 @@ public class GenericConversionService implements ConfigurableConversionService {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Set<ConvertiblePair> getConvertibleTypes() {
|
||||
return Collections.singleton(this.typeInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(TypeDescriptor sourceType, TypeDescriptor targetType) {
|
||||
if(!this.typeInfo.getTargetType().equals(targetType.getObjectType())) {
|
||||
return false;
|
||||
@@ -322,6 +333,7 @@ public class GenericConversionService implements ConfigurableConversionService {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) {
|
||||
if (source == null) {
|
||||
return convertNullSource(sourceType, targetType);
|
||||
@@ -354,10 +366,12 @@ public class GenericConversionService implements ConfigurableConversionService {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Set<ConvertiblePair> getConvertibleTypes() {
|
||||
return Collections.singleton(this.typeInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(TypeDescriptor sourceType, TypeDescriptor targetType) {
|
||||
boolean matches = true;
|
||||
if (this.converterFactory instanceof ConditionalConverter) {
|
||||
@@ -372,6 +386,7 @@ public class GenericConversionService implements ConfigurableConversionService {
|
||||
return matches;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) {
|
||||
if (source == null) {
|
||||
return convertNullSource(sourceType, targetType);
|
||||
@@ -617,10 +632,12 @@ public class GenericConversionService implements ConfigurableConversionService {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Set<ConvertiblePair> getConvertibleTypes() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object convert(Object source, TypeDescriptor sourceType,
|
||||
TypeDescriptor targetType) {
|
||||
return source;
|
||||
|
||||
@@ -45,15 +45,18 @@ final class IdToEntityConverter implements ConditionalGenericConverter {
|
||||
this.conversionService = conversionService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<ConvertiblePair> getConvertibleTypes() {
|
||||
return Collections.singleton(new ConvertiblePair(Object.class, Object.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(TypeDescriptor sourceType, TypeDescriptor targetType) {
|
||||
Method finder = getFinder(targetType.getType());
|
||||
return finder != null && this.conversionService.canConvert(sourceType, TypeDescriptor.valueOf(finder.getParameterTypes()[0]));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) {
|
||||
if (source == null) {
|
||||
return null;
|
||||
|
||||
@@ -46,14 +46,17 @@ final class MapToMapConverter implements ConditionalGenericConverter {
|
||||
this.conversionService = conversionService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<ConvertiblePair> getConvertibleTypes() {
|
||||
return Collections.singleton(new ConvertiblePair(Map.class, Map.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(TypeDescriptor sourceType, TypeDescriptor targetType) {
|
||||
return canConvertKey(sourceType, targetType) && canConvertValue(sourceType, targetType);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) {
|
||||
if (source == null) {
|
||||
|
||||
@@ -34,6 +34,7 @@ import org.springframework.core.convert.converter.Converter;
|
||||
*/
|
||||
final class NumberToCharacterConverter implements Converter<Number, Character> {
|
||||
|
||||
@Override
|
||||
public Character convert(Number source) {
|
||||
return (char) source.shortValue();
|
||||
}
|
||||
|
||||
@@ -43,10 +43,12 @@ import org.springframework.util.NumberUtils;
|
||||
final class NumberToNumberConverterFactory implements ConverterFactory<Number, Number>,
|
||||
ConditionalConverter {
|
||||
|
||||
@Override
|
||||
public <T extends Number> Converter<Number, T> getConverter(Class<T> targetType) {
|
||||
return new NumberToNumber<T>(targetType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(TypeDescriptor sourceType, TypeDescriptor targetType) {
|
||||
return !sourceType.equals(targetType);
|
||||
}
|
||||
@@ -59,6 +61,7 @@ final class NumberToNumberConverterFactory implements ConverterFactory<Number, N
|
||||
this.targetType = targetType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T convert(Number source) {
|
||||
return NumberUtils.convertNumberToTargetClass(source, this.targetType);
|
||||
}
|
||||
|
||||
@@ -39,14 +39,17 @@ final class ObjectToArrayConverter implements ConditionalGenericConverter {
|
||||
this.conversionService = conversionService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<ConvertiblePair> getConvertibleTypes() {
|
||||
return Collections.singleton(new ConvertiblePair(Object.class, Object[].class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(TypeDescriptor sourceType, TypeDescriptor targetType) {
|
||||
return ConversionUtils.canConvertElements(sourceType, targetType.getElementTypeDescriptor(), this.conversionService);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) {
|
||||
if (source == null) {
|
||||
return null;
|
||||
|
||||
@@ -41,14 +41,17 @@ final class ObjectToCollectionConverter implements ConditionalGenericConverter {
|
||||
this.conversionService = conversionService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<ConvertiblePair> getConvertibleTypes() {
|
||||
return Collections.singleton(new ConvertiblePair(Object.class, Collection.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(TypeDescriptor sourceType, TypeDescriptor targetType) {
|
||||
return ConversionUtils.canConvertElements(sourceType, targetType.getElementTypeDescriptor(), this.conversionService);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) {
|
||||
if (source == null) {
|
||||
|
||||
@@ -43,10 +43,12 @@ import org.springframework.util.ReflectionUtils;
|
||||
*/
|
||||
final class ObjectToObjectConverter implements ConditionalGenericConverter {
|
||||
|
||||
@Override
|
||||
public Set<ConvertiblePair> getConvertibleTypes() {
|
||||
return Collections.singleton(new ConvertiblePair(Object.class, Object.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(TypeDescriptor sourceType, TypeDescriptor targetType) {
|
||||
if (sourceType.getType().equals(targetType.getType())) {
|
||||
// no conversion required
|
||||
@@ -55,6 +57,7 @@ final class ObjectToObjectConverter implements ConditionalGenericConverter {
|
||||
return hasValueOfMethodOrConstructor(targetType.getType(), sourceType.getType());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) {
|
||||
if (source == null) {
|
||||
return null;
|
||||
|
||||
@@ -25,6 +25,7 @@ import org.springframework.core.convert.converter.Converter;
|
||||
*/
|
||||
final class ObjectToStringConverter implements Converter<Object, String> {
|
||||
|
||||
@Override
|
||||
public String convert(Object source) {
|
||||
return source.toString();
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ import org.springframework.core.convert.converter.Converter;
|
||||
*/
|
||||
final class PropertiesToStringConverter implements Converter<Properties, String> {
|
||||
|
||||
@Override
|
||||
public String convert(Properties source) {
|
||||
try {
|
||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
|
||||
@@ -40,14 +40,17 @@ final class StringToArrayConverter implements ConditionalGenericConverter {
|
||||
this.conversionService = conversionService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<ConvertiblePair> getConvertibleTypes() {
|
||||
return Collections.singleton(new ConvertiblePair(String.class, Object[].class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(TypeDescriptor sourceType, TypeDescriptor targetType) {
|
||||
return this.conversionService.canConvert(sourceType, targetType.getElementTypeDescriptor());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) {
|
||||
if (source == null) {
|
||||
return null;
|
||||
|
||||
@@ -46,6 +46,7 @@ final class StringToBooleanConverter implements Converter<String, Boolean> {
|
||||
falseValues.add("0");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean convert(String source) {
|
||||
String value = source.trim();
|
||||
if ("".equals(value)) {
|
||||
|
||||
@@ -26,6 +26,7 @@ import org.springframework.core.convert.converter.Converter;
|
||||
*/
|
||||
final class StringToCharacterConverter implements Converter<String, Character> {
|
||||
|
||||
@Override
|
||||
public Character convert(String source) {
|
||||
if (source.length() == 0) {
|
||||
return null;
|
||||
|
||||
@@ -41,10 +41,12 @@ final class StringToCollectionConverter implements ConditionalGenericConverter {
|
||||
this.conversionService = conversionService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<ConvertiblePair> getConvertibleTypes() {
|
||||
return Collections.singleton(new ConvertiblePair(String.class, Collection.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(TypeDescriptor sourceType, TypeDescriptor targetType) {
|
||||
if (targetType.getElementTypeDescriptor() != null) {
|
||||
return this.conversionService.canConvert(sourceType, targetType.getElementTypeDescriptor());
|
||||
@@ -53,6 +55,7 @@ final class StringToCollectionConverter implements ConditionalGenericConverter {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) {
|
||||
if (source == null) {
|
||||
|
||||
@@ -28,6 +28,7 @@ import org.springframework.core.convert.converter.ConverterFactory;
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
final class StringToEnumConverterFactory implements ConverterFactory<String, Enum> {
|
||||
|
||||
@Override
|
||||
public <T extends Enum> Converter<String, T> getConverter(Class<T> targetType) {
|
||||
return new StringToEnum(targetType);
|
||||
}
|
||||
@@ -40,6 +41,7 @@ final class StringToEnumConverterFactory implements ConverterFactory<String, Enu
|
||||
this.enumType = enumType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T convert(String source) {
|
||||
if (source.length() == 0) {
|
||||
// It's an empty enum identifier: reset the enum value to null.
|
||||
|
||||
@@ -29,6 +29,7 @@ import org.springframework.util.StringUtils;
|
||||
*/
|
||||
final class StringToLocaleConverter implements Converter<String, Locale> {
|
||||
|
||||
@Override
|
||||
public Locale convert(String source) {
|
||||
return StringUtils.parseLocaleString(source);
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ import org.springframework.util.NumberUtils;
|
||||
*/
|
||||
final class StringToNumberConverterFactory implements ConverterFactory<String, Number> {
|
||||
|
||||
@Override
|
||||
public <T extends Number> Converter<String, T> getConverter(Class<T> targetType) {
|
||||
return new StringToNumber<T>(targetType);
|
||||
}
|
||||
@@ -52,6 +53,7 @@ final class StringToNumberConverterFactory implements ConverterFactory<String, N
|
||||
this.targetType = targetType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T convert(String source) {
|
||||
if (source.length() == 0) {
|
||||
return null;
|
||||
|
||||
@@ -30,6 +30,7 @@ import org.springframework.core.convert.converter.Converter;
|
||||
*/
|
||||
final class StringToPropertiesConverter implements Converter<String, Properties> {
|
||||
|
||||
@Override
|
||||
public Properties convert(String source) {
|
||||
try {
|
||||
Properties props = new Properties();
|
||||
|
||||
@@ -29,6 +29,7 @@ import org.springframework.util.StringUtils;
|
||||
*/
|
||||
final class StringToUUIDConverter implements Converter<String, UUID> {
|
||||
|
||||
@Override
|
||||
public UUID convert(String source) {
|
||||
if(StringUtils.hasLength(source)) {
|
||||
return UUID.fromString(source.trim());
|
||||
|
||||
@@ -50,15 +50,18 @@ public abstract class AbstractCachingLabeledEnumResolver implements LabeledEnumR
|
||||
private final LabeledEnumCache labeledEnumCache = new LabeledEnumCache();
|
||||
|
||||
|
||||
@Override
|
||||
public Set<LabeledEnum> getLabeledEnumSet(Class type) throws IllegalArgumentException {
|
||||
return new TreeSet<LabeledEnum>(getLabeledEnumMap(type).values());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<Comparable, LabeledEnum> getLabeledEnumMap(Class type) throws IllegalArgumentException {
|
||||
Assert.notNull(type, "No type specified");
|
||||
return this.labeledEnumCache.get(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LabeledEnum getLabeledEnumByCode(Class type, Comparable code) throws IllegalArgumentException {
|
||||
Assert.notNull(code, "No enum code specified");
|
||||
Map<Comparable, LabeledEnum> typeEnums = getLabeledEnumMap(type);
|
||||
@@ -72,6 +75,7 @@ public abstract class AbstractCachingLabeledEnumResolver implements LabeledEnumR
|
||||
return codedEnum;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LabeledEnum getLabeledEnumByLabel(Class type, String label) throws IllegalArgumentException {
|
||||
Map<Comparable, LabeledEnum> typeEnums = getLabeledEnumMap(type);
|
||||
for (LabeledEnum value : typeEnums.values()) {
|
||||
|
||||
@@ -43,6 +43,7 @@ public abstract class AbstractGenericLabeledEnum extends AbstractLabeledEnum {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getLabel() {
|
||||
if (this.label != null) {
|
||||
return label;
|
||||
|
||||
@@ -35,12 +35,14 @@ public abstract class AbstractLabeledEnum implements LabeledEnum {
|
||||
protected AbstractLabeledEnum() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class getType() {
|
||||
// Could be coded as getClass().isAnonymousClass() on JDK 1.5
|
||||
boolean isAnonymous = (getClass().getDeclaringClass() == null && getClass().getName().indexOf('$') != -1);
|
||||
return (isAnonymous ? getClass().getSuperclass() : getClass());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Object obj) {
|
||||
if (!(obj instanceof LabeledEnum)) {
|
||||
throw new ClassCastException("You may only compare LabeledEnums");
|
||||
|
||||
@@ -67,6 +67,7 @@ public interface LabeledEnum extends Comparable, Serializable {
|
||||
* Shared Comparator instance that sorts enumerations by {@code CODE_ORDER}.
|
||||
*/
|
||||
Comparator CODE_ORDER = new Comparator() {
|
||||
@Override
|
||||
public int compare(Object o1, Object o2) {
|
||||
Comparable c1 = ((LabeledEnum) o1).getCode();
|
||||
Comparable c2 = ((LabeledEnum) o2).getCode();
|
||||
@@ -78,6 +79,7 @@ public interface LabeledEnum extends Comparable, Serializable {
|
||||
* Shared Comparator instance that sorts enumerations by {@code LABEL_ORDER}.
|
||||
*/
|
||||
Comparator LABEL_ORDER = new Comparator() {
|
||||
@Override
|
||||
public int compare(Object o1, Object o2) {
|
||||
LabeledEnum e1 = (LabeledEnum) o1;
|
||||
LabeledEnum e2 = (LabeledEnum) o2;
|
||||
|
||||
@@ -52,6 +52,7 @@ public class LetterCodedLabeledEnum extends AbstractGenericLabeledEnum {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Comparable getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
@@ -49,6 +49,7 @@ public class ShortCodedLabeledEnum extends AbstractGenericLabeledEnum {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Comparable getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
@@ -73,10 +73,12 @@ public abstract class StaticLabeledEnum extends AbstractLabeledEnum {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Comparable getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
@@ -53,6 +53,7 @@ public class StringCodedLabeledEnum extends AbstractGenericLabeledEnum {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Comparable getCode() {
|
||||
return this.code;
|
||||
}
|
||||
|
||||
@@ -214,6 +214,7 @@ public abstract class AbstractEnvironment implements ConfigurableEnvironment {
|
||||
// Implementation of ConfigurableEnvironment interface
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public String[] getActiveProfiles() {
|
||||
return StringUtils.toStringArray(doGetActiveProfiles());
|
||||
}
|
||||
@@ -236,6 +237,7 @@ public abstract class AbstractEnvironment implements ConfigurableEnvironment {
|
||||
return this.activeProfiles;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setActiveProfiles(String... profiles) {
|
||||
Assert.notNull(profiles, "Profile array must not be null");
|
||||
this.activeProfiles.clear();
|
||||
@@ -245,6 +247,7 @@ public abstract class AbstractEnvironment implements ConfigurableEnvironment {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addActiveProfile(String profile) {
|
||||
if (this.logger.isDebugEnabled()) {
|
||||
this.logger.debug(format("Activating profile '%s'", profile));
|
||||
@@ -255,6 +258,7 @@ public abstract class AbstractEnvironment implements ConfigurableEnvironment {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String[] getDefaultProfiles() {
|
||||
return StringUtils.toStringArray(doGetDefaultProfiles());
|
||||
}
|
||||
@@ -288,6 +292,7 @@ public abstract class AbstractEnvironment implements ConfigurableEnvironment {
|
||||
* @see #AbstractEnvironment()
|
||||
* @see #getReservedDefaultProfiles()
|
||||
*/
|
||||
@Override
|
||||
public void setDefaultProfiles(String... profiles) {
|
||||
Assert.notNull(profiles, "Profile array must not be null");
|
||||
this.defaultProfiles.clear();
|
||||
@@ -297,6 +302,7 @@ public abstract class AbstractEnvironment implements ConfigurableEnvironment {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean acceptsProfiles(String... profiles) {
|
||||
Assert.notEmpty(profiles, "Must specify at least one profile");
|
||||
for (String profile : profiles) {
|
||||
@@ -337,10 +343,12 @@ public abstract class AbstractEnvironment implements ConfigurableEnvironment {
|
||||
"Invalid profile [" + profile + "]: must not begin with the ! operator");
|
||||
}
|
||||
|
||||
@Override
|
||||
public MutablePropertySources getPropertySources() {
|
||||
return this.propertySources;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public Map<String, Object> getSystemEnvironment() {
|
||||
Map<String, ?> systemEnvironment;
|
||||
@@ -369,6 +377,7 @@ public abstract class AbstractEnvironment implements ConfigurableEnvironment {
|
||||
return (Map<String, Object>) systemEnvironment;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
public Map<String, Object> getSystemProperties() {
|
||||
Map systemProperties;
|
||||
@@ -397,6 +406,7 @@ public abstract class AbstractEnvironment implements ConfigurableEnvironment {
|
||||
return systemProperties;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void merge(ConfigurableEnvironment parent) {
|
||||
for (PropertySource<?> ps : parent.getPropertySources()) {
|
||||
if (!this.propertySources.contains(ps.getName())) {
|
||||
@@ -419,74 +429,92 @@ public abstract class AbstractEnvironment implements ConfigurableEnvironment {
|
||||
// Implementation of ConfigurablePropertyResolver interface
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public boolean containsProperty(String key) {
|
||||
return this.propertyResolver.containsProperty(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProperty(String key) {
|
||||
return this.propertyResolver.getProperty(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProperty(String key, String defaultValue) {
|
||||
return this.propertyResolver.getProperty(key, defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getProperty(String key, Class<T> targetType) {
|
||||
return this.propertyResolver.getProperty(key, targetType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getProperty(String key, Class<T> targetType, T defaultValue) {
|
||||
return this.propertyResolver.getProperty(key, targetType, defaultValue);
|
||||
};
|
||||
|
||||
@Override
|
||||
public <T> Class<T> getPropertyAsClass(String key, Class<T> targetType) {
|
||||
return this.propertyResolver.getPropertyAsClass(key, targetType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRequiredProperty(String key) throws IllegalStateException {
|
||||
return this.propertyResolver.getRequiredProperty(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getRequiredProperty(String key, Class<T> targetType) throws IllegalStateException {
|
||||
return this.propertyResolver.getRequiredProperty(key, targetType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRequiredProperties(String... requiredProperties) {
|
||||
this.propertyResolver.setRequiredProperties(requiredProperties);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validateRequiredProperties() throws MissingRequiredPropertiesException {
|
||||
this.propertyResolver.validateRequiredProperties();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String resolvePlaceholders(String text) {
|
||||
return this.propertyResolver.resolvePlaceholders(text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String resolveRequiredPlaceholders(String text) throws IllegalArgumentException {
|
||||
return this.propertyResolver.resolveRequiredPlaceholders(text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIgnoreUnresolvableNestedPlaceholders(boolean ignoreUnresolvableNestedPlaceholders) {
|
||||
this.propertyResolver.setIgnoreUnresolvableNestedPlaceholders(ignoreUnresolvableNestedPlaceholders);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setConversionService(ConfigurableConversionService conversionService) {
|
||||
this.propertyResolver.setConversionService(conversionService);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfigurableConversionService getConversionService() {
|
||||
return this.propertyResolver.getConversionService();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlaceholderPrefix(String placeholderPrefix) {
|
||||
this.propertyResolver.setPlaceholderPrefix(placeholderPrefix);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlaceholderSuffix(String placeholderSuffix) {
|
||||
this.propertyResolver.setPlaceholderSuffix(placeholderSuffix);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValueSeparator(String valueSeparator) {
|
||||
this.propertyResolver.setValueSeparator(valueSeparator);
|
||||
}
|
||||
|
||||
@@ -53,30 +53,36 @@ public abstract class AbstractPropertyResolver implements ConfigurablePropertyRe
|
||||
|
||||
private final Set<String> requiredProperties = new LinkedHashSet<String>();
|
||||
|
||||
@Override
|
||||
public ConfigurableConversionService getConversionService() {
|
||||
return this.conversionService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setConversionService(ConfigurableConversionService conversionService) {
|
||||
this.conversionService = conversionService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProperty(String key, String defaultValue) {
|
||||
String value = getProperty(key);
|
||||
return value == null ? defaultValue : value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getProperty(String key, Class<T> targetType, T defaultValue) {
|
||||
T value = getProperty(key, targetType);
|
||||
return value == null ? defaultValue : value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRequiredProperties(String... requiredProperties) {
|
||||
for (String key : requiredProperties) {
|
||||
this.requiredProperties.add(key);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validateRequiredProperties() {
|
||||
MissingRequiredPropertiesException ex = new MissingRequiredPropertiesException();
|
||||
for (String key : this.requiredProperties) {
|
||||
@@ -89,6 +95,7 @@ public abstract class AbstractPropertyResolver implements ConfigurablePropertyRe
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRequiredProperty(String key) throws IllegalStateException {
|
||||
String value = getProperty(key);
|
||||
if (value == null) {
|
||||
@@ -97,6 +104,7 @@ public abstract class AbstractPropertyResolver implements ConfigurablePropertyRe
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getRequiredProperty(String key, Class<T> valueType) throws IllegalStateException {
|
||||
T value = getProperty(key, valueType);
|
||||
if (value == null) {
|
||||
@@ -109,6 +117,7 @@ public abstract class AbstractPropertyResolver implements ConfigurablePropertyRe
|
||||
* {@inheritDoc} The default is "${".
|
||||
* @see org.springframework.util.SystemPropertyUtils#PLACEHOLDER_PREFIX
|
||||
*/
|
||||
@Override
|
||||
public void setPlaceholderPrefix(String placeholderPrefix) {
|
||||
this.placeholderPrefix = placeholderPrefix;
|
||||
}
|
||||
@@ -117,6 +126,7 @@ public abstract class AbstractPropertyResolver implements ConfigurablePropertyRe
|
||||
* {@inheritDoc} The default is "}".
|
||||
* @see org.springframework.util.SystemPropertyUtils#PLACEHOLDER_SUFFIX
|
||||
*/
|
||||
@Override
|
||||
public void setPlaceholderSuffix(String placeholderSuffix) {
|
||||
this.placeholderSuffix = placeholderSuffix;
|
||||
}
|
||||
@@ -125,10 +135,12 @@ public abstract class AbstractPropertyResolver implements ConfigurablePropertyRe
|
||||
* {@inheritDoc} The default is ":".
|
||||
* @see org.springframework.util.SystemPropertyUtils#VALUE_SEPARATOR
|
||||
*/
|
||||
@Override
|
||||
public void setValueSeparator(String valueSeparator) {
|
||||
this.valueSeparator = valueSeparator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String resolvePlaceholders(String text) {
|
||||
if (nonStrictHelper == null) {
|
||||
nonStrictHelper = createPlaceholderHelper(true);
|
||||
@@ -136,6 +148,7 @@ public abstract class AbstractPropertyResolver implements ConfigurablePropertyRe
|
||||
return doResolvePlaceholders(text, nonStrictHelper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String resolveRequiredPlaceholders(String text) throws IllegalArgumentException {
|
||||
if (strictHelper == null) {
|
||||
strictHelper = createPlaceholderHelper(false);
|
||||
@@ -148,6 +161,7 @@ public abstract class AbstractPropertyResolver implements ConfigurablePropertyRe
|
||||
* <p>The default value for this implementation is {@code false}.
|
||||
* @since 3.2
|
||||
*/
|
||||
@Override
|
||||
public void setIgnoreUnresolvableNestedPlaceholders(boolean ignoreUnresolvableNestedPlaceholders) {
|
||||
this.ignoreUnresolvableNestedPlaceholders = ignoreUnresolvableNestedPlaceholders;
|
||||
}
|
||||
@@ -172,6 +186,7 @@ public abstract class AbstractPropertyResolver implements ConfigurablePropertyRe
|
||||
|
||||
private String doResolvePlaceholders(String text, PropertyPlaceholderHelper helper) {
|
||||
return helper.replacePlaceholders(text, new PlaceholderResolver() {
|
||||
@Override
|
||||
public String resolvePlaceholder(String placeholderName) {
|
||||
return getProperty(placeholderName);
|
||||
}
|
||||
|
||||
@@ -65,6 +65,7 @@ public abstract class EnumerablePropertySource<T> extends PropertySource<T> {
|
||||
* the {@link #getPropertyNames()} array.
|
||||
* @param name the property to find
|
||||
*/
|
||||
@Override
|
||||
public boolean containsProperty(String name) {
|
||||
Assert.notNull(name, "property name must not be null");
|
||||
for (String candidate : this.getPropertyNames()) {
|
||||
|
||||
@@ -74,15 +74,18 @@ public class MutablePropertySources implements PropertySources {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean contains(String name) {
|
||||
return this.propertySourceList.contains(PropertySource.named(name));
|
||||
}
|
||||
|
||||
@Override
|
||||
public PropertySource<?> get(String name) {
|
||||
int index = this.propertySourceList.indexOf(PropertySource.named(name));
|
||||
return index == -1 ? null : this.propertySourceList.get(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<PropertySource<?>> iterator() {
|
||||
return this.propertySourceList.iterator();
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@ public class PropertySourcesPropertyResolver extends AbstractPropertyResolver {
|
||||
this.propertySources = propertySources;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsProperty(String key) {
|
||||
for (PropertySource<?> propertySource : this.propertySources) {
|
||||
if (propertySource.containsProperty(key)) {
|
||||
@@ -52,6 +53,7 @@ public class PropertySourcesPropertyResolver extends AbstractPropertyResolver {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProperty(String key) {
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace(format("getProperty(\"%s\") (implicit targetType [String])", key));
|
||||
@@ -59,6 +61,7 @@ public class PropertySourcesPropertyResolver extends AbstractPropertyResolver {
|
||||
return this.getProperty(key, String.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getProperty(String key, Class<T> targetValueType) {
|
||||
boolean debugEnabled = logger.isDebugEnabled();
|
||||
if (logger.isTraceEnabled()) {
|
||||
@@ -95,6 +98,7 @@ public class PropertySourcesPropertyResolver extends AbstractPropertyResolver {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Class<T> getPropertyAsClass(String key, Class<T> targetValueType) {
|
||||
boolean debugEnabled = logger.isDebugEnabled();
|
||||
if (logger.isTraceEnabled()) {
|
||||
|
||||
@@ -35,6 +35,7 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
abstract class ReadOnlySystemAttributesMap implements Map<String, String> {
|
||||
|
||||
@Override
|
||||
public boolean containsKey(Object key) {
|
||||
return get(key) != null;
|
||||
}
|
||||
@@ -43,6 +44,7 @@ abstract class ReadOnlySystemAttributesMap implements Map<String, String> {
|
||||
* @param key the name of the system attribute to retrieve
|
||||
* @throws IllegalArgumentException if given key is non-String
|
||||
*/
|
||||
@Override
|
||||
public String get(Object key) {
|
||||
Assert.isInstanceOf(String.class, key,
|
||||
String.format("expected key [%s] to be of type String, got %s",
|
||||
@@ -51,6 +53,7 @@ abstract class ReadOnlySystemAttributesMap implements Map<String, String> {
|
||||
return this.getSystemAttribute((String) key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return false;
|
||||
}
|
||||
@@ -64,38 +67,47 @@ abstract class ReadOnlySystemAttributesMap implements Map<String, String> {
|
||||
|
||||
// Unsupported
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String put(String key, String value) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsValue(Object value) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String remove(Object key) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> keySet() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putAll(Map<? extends String, ? extends String> m) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<String> values() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Entry<String, String>> entrySet() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@@ -46,6 +46,7 @@ public abstract class AbstractResource implements Resource {
|
||||
* falling back to whether an InputStream can be opened.
|
||||
* This will cover both directories and content resources.
|
||||
*/
|
||||
@Override
|
||||
public boolean exists() {
|
||||
// Try file existence: can we find the file in the file system?
|
||||
try {
|
||||
@@ -67,6 +68,7 @@ public abstract class AbstractResource implements Resource {
|
||||
/**
|
||||
* This implementation always returns {@code true}.
|
||||
*/
|
||||
@Override
|
||||
public boolean isReadable() {
|
||||
return true;
|
||||
}
|
||||
@@ -74,6 +76,7 @@ public abstract class AbstractResource implements Resource {
|
||||
/**
|
||||
* This implementation always returns {@code false}.
|
||||
*/
|
||||
@Override
|
||||
public boolean isOpen() {
|
||||
return false;
|
||||
}
|
||||
@@ -82,6 +85,7 @@ public abstract class AbstractResource implements Resource {
|
||||
* This implementation throws a FileNotFoundException, assuming
|
||||
* that the resource cannot be resolved to a URL.
|
||||
*/
|
||||
@Override
|
||||
public URL getURL() throws IOException {
|
||||
throw new FileNotFoundException(getDescription() + " cannot be resolved to URL");
|
||||
}
|
||||
@@ -90,6 +94,7 @@ public abstract class AbstractResource implements Resource {
|
||||
* This implementation builds a URI based on the URL returned
|
||||
* by {@link #getURL()}.
|
||||
*/
|
||||
@Override
|
||||
public URI getURI() throws IOException {
|
||||
URL url = getURL();
|
||||
try {
|
||||
@@ -104,6 +109,7 @@ public abstract class AbstractResource implements Resource {
|
||||
* This implementation throws a FileNotFoundException, assuming
|
||||
* that the resource cannot be resolved to an absolute file path.
|
||||
*/
|
||||
@Override
|
||||
public File getFile() throws IOException {
|
||||
throw new FileNotFoundException(getDescription() + " cannot be resolved to absolute file path");
|
||||
}
|
||||
@@ -115,6 +121,7 @@ public abstract class AbstractResource implements Resource {
|
||||
* @see #getInputStream()
|
||||
* @throws IllegalStateException if {@link #getInputStream()} returns null.
|
||||
*/
|
||||
@Override
|
||||
public long contentLength() throws IOException {
|
||||
InputStream is = this.getInputStream();
|
||||
Assert.state(is != null, "resource input stream must not be null");
|
||||
@@ -141,6 +148,7 @@ public abstract class AbstractResource implements Resource {
|
||||
* if available.
|
||||
* @see #getFileForLastModifiedCheck()
|
||||
*/
|
||||
@Override
|
||||
public long lastModified() throws IOException {
|
||||
long lastModified = getFileForLastModifiedCheck().lastModified();
|
||||
if (lastModified == 0L) {
|
||||
@@ -165,6 +173,7 @@ public abstract class AbstractResource implements Resource {
|
||||
* This implementation throws a FileNotFoundException, assuming
|
||||
* that relative resources cannot be created for this resource.
|
||||
*/
|
||||
@Override
|
||||
public Resource createRelative(String relativePath) throws IOException {
|
||||
throw new FileNotFoundException("Cannot create a relative resource for " + getDescription());
|
||||
}
|
||||
@@ -173,6 +182,7 @@ public abstract class AbstractResource implements Resource {
|
||||
* This implementation always returns {@code null},
|
||||
* assuming that this resource type does not have a filename.
|
||||
*/
|
||||
@Override
|
||||
public String getFilename() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -93,6 +93,7 @@ public class ByteArrayResource extends AbstractResource {
|
||||
* underlying byte array.
|
||||
* @see java.io.ByteArrayInputStream
|
||||
*/
|
||||
@Override
|
||||
public InputStream getInputStream() throws IOException {
|
||||
return new ByteArrayInputStream(this.byteArray);
|
||||
}
|
||||
@@ -100,6 +101,7 @@ public class ByteArrayResource extends AbstractResource {
|
||||
/**
|
||||
* This implementation returns the passed-in description, if any.
|
||||
*/
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return this.description;
|
||||
}
|
||||
|
||||
@@ -145,6 +145,7 @@ public class ClassPathResource extends AbstractFileResolvingResource {
|
||||
* @see java.lang.ClassLoader#getResourceAsStream(String)
|
||||
* @see java.lang.Class#getResourceAsStream(String)
|
||||
*/
|
||||
@Override
|
||||
public InputStream getInputStream() throws IOException {
|
||||
InputStream is;
|
||||
if (this.clazz != null) {
|
||||
@@ -203,6 +204,7 @@ public class ClassPathResource extends AbstractFileResolvingResource {
|
||||
/**
|
||||
* This implementation returns a description that includes the class path location.
|
||||
*/
|
||||
@Override
|
||||
public String getDescription() {
|
||||
StringBuilder builder = new StringBuilder("class path resource [");
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@ public class ClassRelativeResourceLoader extends DefaultResourceLoader {
|
||||
setClassLoader(clazz.getClassLoader());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Resource getResourceByPath(String path) {
|
||||
return new ClassRelativeContextResource(path, this.clazz);
|
||||
}
|
||||
@@ -61,6 +62,7 @@ public class ClassRelativeResourceLoader extends DefaultResourceLoader {
|
||||
this.clazz = clazz;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPathWithinContext() {
|
||||
return getPath();
|
||||
}
|
||||
|
||||
@@ -79,11 +79,13 @@ public class DefaultResourceLoader implements ResourceLoader {
|
||||
* ClassPathResource objects created by this resource loader.
|
||||
* @see ClassPathResource
|
||||
*/
|
||||
@Override
|
||||
public ClassLoader getClassLoader() {
|
||||
return (this.classLoader != null ? this.classLoader : ClassUtils.getDefaultClassLoader());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Resource getResource(String location) {
|
||||
Assert.notNull(location, "Location must not be null");
|
||||
if (location.startsWith(CLASSPATH_URL_PREFIX)) {
|
||||
@@ -128,6 +130,7 @@ public class DefaultResourceLoader implements ResourceLoader {
|
||||
super(path, classLoader);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPathWithinContext() {
|
||||
return getPath();
|
||||
}
|
||||
|
||||
@@ -54,11 +54,13 @@ public class DescriptiveResource extends AbstractResource {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream getInputStream() throws IOException {
|
||||
throw new FileNotFoundException(
|
||||
getDescription() + " cannot be opened because it does not point to a readable resource");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return this.description;
|
||||
}
|
||||
|
||||
@@ -109,6 +109,7 @@ public class FileSystemResource extends AbstractResource implements WritableReso
|
||||
* This implementation opens a FileInputStream for the underlying file.
|
||||
* @see java.io.FileInputStream
|
||||
*/
|
||||
@Override
|
||||
public InputStream getInputStream() throws IOException {
|
||||
return new FileInputStream(this.file);
|
||||
}
|
||||
@@ -172,6 +173,7 @@ public class FileSystemResource extends AbstractResource implements WritableReso
|
||||
* path of the file.
|
||||
* @see java.io.File#getAbsolutePath()
|
||||
*/
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "file [" + this.file.getAbsolutePath() + "]";
|
||||
}
|
||||
@@ -185,6 +187,7 @@ public class FileSystemResource extends AbstractResource implements WritableReso
|
||||
* @see java.io.File#canWrite()
|
||||
* @see java.io.File#isDirectory()
|
||||
*/
|
||||
@Override
|
||||
public boolean isWritable() {
|
||||
return (this.file.canWrite() && !this.file.isDirectory());
|
||||
}
|
||||
@@ -193,6 +196,7 @@ public class FileSystemResource extends AbstractResource implements WritableReso
|
||||
* This implementation opens a FileOutputStream for the underlying file.
|
||||
* @see java.io.FileOutputStream
|
||||
*/
|
||||
@Override
|
||||
public OutputStream getOutputStream() throws IOException {
|
||||
return new FileOutputStream(this.file);
|
||||
}
|
||||
|
||||
@@ -65,6 +65,7 @@ public class FileSystemResourceLoader extends DefaultResourceLoader {
|
||||
super(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPathWithinContext() {
|
||||
return getPath();
|
||||
}
|
||||
|
||||
@@ -88,6 +88,7 @@ public class InputStreamResource extends AbstractResource {
|
||||
* This implementation throws IllegalStateException if attempting to
|
||||
* read the underlying stream multiple times.
|
||||
*/
|
||||
@Override
|
||||
public InputStream getInputStream() throws IOException, IllegalStateException {
|
||||
if (this.read) {
|
||||
throw new IllegalStateException("InputStream has already been read - " +
|
||||
@@ -100,6 +101,7 @@ public class InputStreamResource extends AbstractResource {
|
||||
/**
|
||||
* This implementation returns the passed-in description, if any.
|
||||
*/
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return this.description;
|
||||
}
|
||||
|
||||
@@ -118,6 +118,7 @@ public class UrlResource extends AbstractFileResolvingResource {
|
||||
* @see java.net.URLConnection#setUseCaches(boolean)
|
||||
* @see java.net.URLConnection#getInputStream()
|
||||
*/
|
||||
@Override
|
||||
public InputStream getInputStream() throws IOException {
|
||||
URLConnection con = this.url.openConnection();
|
||||
ResourceUtils.useCachesIfNecessary(con);
|
||||
@@ -196,6 +197,7 @@ public class UrlResource extends AbstractFileResolvingResource {
|
||||
/**
|
||||
* This implementation returns a description that includes the URL.
|
||||
*/
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "URL [" + this.url + "]";
|
||||
}
|
||||
|
||||
@@ -46,6 +46,7 @@ public class VfsResource extends AbstractResource {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public InputStream getInputStream() throws IOException {
|
||||
return VfsUtils.getInputStream(this.resource);
|
||||
}
|
||||
@@ -114,6 +115,7 @@ public class VfsResource extends AbstractResource {
|
||||
return VfsUtils.getName(this.resource);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return this.resource.toString();
|
||||
}
|
||||
|
||||
@@ -231,6 +231,7 @@ public class PathMatchingResourcePatternResolver implements ResourcePatternResol
|
||||
* Return the ClassLoader that this pattern resolver works with
|
||||
* (never {@code null}).
|
||||
*/
|
||||
@Override
|
||||
public ClassLoader getClassLoader() {
|
||||
return getResourceLoader().getClassLoader();
|
||||
}
|
||||
@@ -253,10 +254,12 @@ public class PathMatchingResourcePatternResolver implements ResourcePatternResol
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Resource getResource(String location) {
|
||||
return getResourceLoader().getResource(location);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Resource[] getResources(String locationPattern) throws IOException {
|
||||
Assert.notNull(locationPattern, "Location pattern must not be null");
|
||||
if (locationPattern.startsWith(CLASSPATH_ALL_URL_PREFIX)) {
|
||||
@@ -674,6 +677,7 @@ public class PathMatchingResourcePatternResolver implements ResourcePatternResol
|
||||
this.rootPath = (rootPath.length() == 0 || rootPath.endsWith("/") ? rootPath : rootPath + "/");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
||||
String methodName = method.getName();
|
||||
if (Object.class.equals(method.getDeclaringClass())) {
|
||||
|
||||
@@ -34,6 +34,7 @@ public class DefaultDeserializer implements Deserializer<Object> {
|
||||
/**
|
||||
* Reads the input stream and deserializes into an object.
|
||||
*/
|
||||
@Override
|
||||
public Object deserialize(InputStream inputStream) throws IOException {
|
||||
ObjectInputStream objectInputStream = new ObjectInputStream(inputStream);
|
||||
try {
|
||||
|
||||
@@ -34,6 +34,7 @@ public class DefaultSerializer implements Serializer<Object> {
|
||||
* Writes the source object to an output stream using Java Serialization.
|
||||
* The source object must implement {@link Serializable}.
|
||||
*/
|
||||
@Override
|
||||
public void serialize(Object object, OutputStream outputStream) throws IOException {
|
||||
if (!(object instanceof Serializable)) {
|
||||
throw new IllegalArgumentException(getClass().getSimpleName() + " requires a Serializable payload " +
|
||||
|
||||
@@ -52,6 +52,7 @@ public class DeserializingConverter implements Converter<byte[], Object> {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Object convert(byte[] source) {
|
||||
ByteArrayInputStream byteStream = new ByteArrayInputStream(source);
|
||||
try {
|
||||
|
||||
@@ -55,6 +55,7 @@ public class SerializingConverter implements Converter<Object, byte[]> {
|
||||
/**
|
||||
* Serializes the source object and returns the byte array result.
|
||||
*/
|
||||
@Override
|
||||
public byte[] convert(Object source) {
|
||||
ByteArrayOutputStream byteStream = new ByteArrayOutputStream(128);
|
||||
try {
|
||||
|
||||
@@ -52,6 +52,7 @@ public class DefaultToStringStyler implements ToStringStyler {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void styleStart(StringBuilder buffer, Object obj) {
|
||||
if (!obj.getClass().isArray()) {
|
||||
buffer.append('[').append(ClassUtils.getShortName(obj.getClass()));
|
||||
@@ -70,10 +71,12 @@ public class DefaultToStringStyler implements ToStringStyler {
|
||||
buffer.append(ObjectUtils.getIdentityHexString(obj));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void styleEnd(StringBuilder buffer, Object o) {
|
||||
buffer.append(']');
|
||||
}
|
||||
|
||||
@Override
|
||||
public void styleField(StringBuilder buffer, String fieldName, Object value) {
|
||||
styleFieldStart(buffer, fieldName);
|
||||
styleValue(buffer, value);
|
||||
@@ -87,10 +90,12 @@ public class DefaultToStringStyler implements ToStringStyler {
|
||||
protected void styleFieldEnd(StringBuilder buffer, String fieldName) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void styleValue(StringBuilder buffer, Object value) {
|
||||
buffer.append(this.valueStyler.style(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void styleFieldSeparator(StringBuilder buffer) {
|
||||
buffer.append(',');
|
||||
}
|
||||
|
||||
@@ -48,6 +48,7 @@ public class DefaultValueStyler implements ValueStyler {
|
||||
private static final String ARRAY = "array";
|
||||
|
||||
|
||||
@Override
|
||||
public String style(Object value) {
|
||||
if (value == null) {
|
||||
return NULL;
|
||||
|
||||
@@ -144,6 +144,7 @@ public class SimpleAsyncTaskExecutor extends CustomizableThreadCreator implement
|
||||
* if configured (through the superclass's settings).
|
||||
* @see #doExecute(Runnable)
|
||||
*/
|
||||
@Override
|
||||
public void execute(Runnable task) {
|
||||
execute(task, TIMEOUT_INDEFINITE);
|
||||
}
|
||||
@@ -157,6 +158,7 @@ public class SimpleAsyncTaskExecutor extends CustomizableThreadCreator implement
|
||||
* @see #TIMEOUT_IMMEDIATE
|
||||
* @see #doExecute(Runnable)
|
||||
*/
|
||||
@Override
|
||||
public void execute(Runnable task, long startTimeout) {
|
||||
Assert.notNull(task, "Runnable must not be null");
|
||||
if (isThrottleActive() && startTimeout > TIMEOUT_IMMEDIATE) {
|
||||
@@ -168,12 +170,14 @@ public class SimpleAsyncTaskExecutor extends CustomizableThreadCreator implement
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Future<?> submit(Runnable task) {
|
||||
FutureTask<Object> future = new FutureTask<Object>(task, null);
|
||||
execute(future, TIMEOUT_INDEFINITE);
|
||||
return future;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Future<T> submit(Callable<T> task) {
|
||||
FutureTask<T> future = new FutureTask<T>(task);
|
||||
execute(future, TIMEOUT_INDEFINITE);
|
||||
@@ -225,6 +229,7 @@ public class SimpleAsyncTaskExecutor extends CustomizableThreadCreator implement
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
this.target.run();
|
||||
|
||||
@@ -44,6 +44,7 @@ public class SyncTaskExecutor implements TaskExecutor, Serializable {
|
||||
* invocation of it's {@link Runnable#run() run()} method.
|
||||
* @throws IllegalArgumentException if the given {@code task} is {@code null}
|
||||
*/
|
||||
@Override
|
||||
public void execute(Runnable task) {
|
||||
Assert.notNull(task, "Runnable must not be null");
|
||||
task.run();
|
||||
|
||||
@@ -45,6 +45,7 @@ public interface TaskExecutor extends Executor {
|
||||
* @param task the {@code Runnable} to execute (never {@code null})
|
||||
* @throws TaskRejectedException if the given task was not accepted
|
||||
*/
|
||||
@Override
|
||||
void execute(Runnable task);
|
||||
|
||||
}
|
||||
|
||||
@@ -50,6 +50,7 @@ public class ConcurrentExecutorAdapter implements Executor {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void execute(Runnable command) {
|
||||
this.taskExecutor.execute(command);
|
||||
}
|
||||
|
||||
@@ -57,29 +57,35 @@ public class ExecutorServiceAdapter extends AbstractExecutorService {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void execute(Runnable task) {
|
||||
this.taskExecutor.execute(task);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shutdown() {
|
||||
throw new IllegalStateException(
|
||||
"Manual shutdown not supported - ExecutorServiceAdapter is dependent on an external lifecycle");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Runnable> shutdownNow() {
|
||||
throw new IllegalStateException(
|
||||
"Manual shutdown not supported - ExecutorServiceAdapter is dependent on an external lifecycle");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException {
|
||||
throw new IllegalStateException(
|
||||
"Manual shutdown not supported - ExecutorServiceAdapter is dependent on an external lifecycle");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isShutdown() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTerminated() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -59,6 +59,7 @@ public class TaskExecutorAdapter implements AsyncTaskExecutor {
|
||||
* Delegates to the specified JDK 1.5 concurrent executor.
|
||||
* @see java.util.concurrent.Executor#execute(Runnable)
|
||||
*/
|
||||
@Override
|
||||
public void execute(Runnable task) {
|
||||
try {
|
||||
this.concurrentExecutor.execute(task);
|
||||
@@ -69,10 +70,12 @@ public class TaskExecutorAdapter implements AsyncTaskExecutor {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(Runnable task, long startTimeout) {
|
||||
execute(task);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Future<?> submit(Runnable task) {
|
||||
try {
|
||||
if (this.concurrentExecutor instanceof ExecutorService) {
|
||||
@@ -90,6 +93,7 @@ public class TaskExecutorAdapter implements AsyncTaskExecutor {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Future<T> submit(Callable<T> task) {
|
||||
try {
|
||||
if (this.concurrentExecutor instanceof ExecutorService) {
|
||||
|
||||
@@ -64,6 +64,7 @@ public class StandardAnnotationMetadata extends StandardClassMetadata implements
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Set<String> getAnnotationTypes() {
|
||||
Set<String> types = new LinkedHashSet<String>();
|
||||
Annotation[] anns = getIntrospectedClass().getAnnotations();
|
||||
@@ -73,6 +74,7 @@ public class StandardAnnotationMetadata extends StandardClassMetadata implements
|
||||
return types;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getMetaAnnotationTypes(String annotationType) {
|
||||
Annotation[] anns = getIntrospectedClass().getAnnotations();
|
||||
for (Annotation ann : anns) {
|
||||
@@ -91,6 +93,7 @@ public class StandardAnnotationMetadata extends StandardClassMetadata implements
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasAnnotation(String annotationType) {
|
||||
Annotation[] anns = getIntrospectedClass().getAnnotations();
|
||||
for (Annotation ann : anns) {
|
||||
@@ -101,6 +104,7 @@ public class StandardAnnotationMetadata extends StandardClassMetadata implements
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasMetaAnnotation(String annotationType) {
|
||||
Annotation[] anns = getIntrospectedClass().getAnnotations();
|
||||
for (Annotation ann : anns) {
|
||||
@@ -119,6 +123,7 @@ public class StandardAnnotationMetadata extends StandardClassMetadata implements
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAnnotated(String annotationType) {
|
||||
Annotation[] anns = getIntrospectedClass().getAnnotations();
|
||||
for (Annotation ann : anns) {
|
||||
@@ -134,10 +139,12 @@ public class StandardAnnotationMetadata extends StandardClassMetadata implements
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getAnnotationAttributes(String annotationType) {
|
||||
return this.getAnnotationAttributes(annotationType, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getAnnotationAttributes(String annotationType, boolean classValuesAsString) {
|
||||
Annotation[] anns = getIntrospectedClass().getAnnotations();
|
||||
for (Annotation ann : anns) {
|
||||
@@ -155,6 +162,7 @@ public class StandardAnnotationMetadata extends StandardClassMetadata implements
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasAnnotatedMethods(String annotationType) {
|
||||
Method[] methods = getIntrospectedClass().getDeclaredMethods();
|
||||
for (Method method : methods) {
|
||||
@@ -174,6 +182,7 @@ public class StandardAnnotationMetadata extends StandardClassMetadata implements
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<MethodMetadata> getAnnotatedMethods(String annotationType) {
|
||||
Method[] methods = getIntrospectedClass().getDeclaredMethods();
|
||||
Set<MethodMetadata> annotatedMethods = new LinkedHashSet<MethodMetadata>();
|
||||
|
||||
@@ -50,50 +50,61 @@ public class StandardClassMetadata implements ClassMetadata {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getClassName() {
|
||||
return this.introspectedClass.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInterface() {
|
||||
return this.introspectedClass.isInterface();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAbstract() {
|
||||
return Modifier.isAbstract(this.introspectedClass.getModifiers());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isConcrete() {
|
||||
return !(isInterface() || isAbstract());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFinal() {
|
||||
return Modifier.isFinal(this.introspectedClass.getModifiers());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isIndependent() {
|
||||
return (!hasEnclosingClass() ||
|
||||
(this.introspectedClass.getDeclaringClass() != null &&
|
||||
Modifier.isStatic(this.introspectedClass.getModifiers())));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasEnclosingClass() {
|
||||
return (this.introspectedClass.getEnclosingClass() != null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEnclosingClassName() {
|
||||
Class enclosingClass = this.introspectedClass.getEnclosingClass();
|
||||
return (enclosingClass != null ? enclosingClass.getName() : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasSuperClass() {
|
||||
return (this.introspectedClass.getSuperclass() != null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSuperClassName() {
|
||||
Class superClass = this.introspectedClass.getSuperclass();
|
||||
return (superClass != null ? superClass.getName() : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getInterfaceNames() {
|
||||
Class[] ifcs = this.introspectedClass.getInterfaces();
|
||||
String[] ifcNames = new String[ifcs.length];
|
||||
@@ -103,6 +114,7 @@ public class StandardClassMetadata implements ClassMetadata {
|
||||
return ifcNames;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getMemberClassNames() {
|
||||
LinkedHashSet<String> memberClassNames = new LinkedHashSet<String>();
|
||||
for (Class<?> nestedClass : this.introspectedClass.getDeclaredClasses()) {
|
||||
|
||||
@@ -68,26 +68,32 @@ public class StandardMethodMetadata implements MethodMetadata {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getMethodName() {
|
||||
return this.introspectedMethod.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDeclaringClassName() {
|
||||
return this.introspectedMethod.getDeclaringClass().getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStatic() {
|
||||
return Modifier.isStatic(this.introspectedMethod.getModifiers());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFinal() {
|
||||
return Modifier.isFinal(this.introspectedMethod.getModifiers());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOverridable() {
|
||||
return (!isStatic() && !isFinal() && !Modifier.isPrivate(this.introspectedMethod.getModifiers()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAnnotated(String annotationType) {
|
||||
Annotation[] anns = this.introspectedMethod.getAnnotations();
|
||||
for (Annotation ann : anns) {
|
||||
@@ -103,6 +109,7 @@ public class StandardMethodMetadata implements MethodMetadata {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getAnnotationAttributes(String annotationType) {
|
||||
Annotation[] anns = this.introspectedMethod.getAnnotations();
|
||||
for (Annotation ann : anns) {
|
||||
|
||||
@@ -58,10 +58,12 @@ abstract class AbstractRecursiveAnnotationVisitor extends AnnotationVisitor {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void visit(String attributeName, Object attributeValue) {
|
||||
this.attributes.put(attributeName, attributeValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AnnotationVisitor visitAnnotation(String attributeName, String asmTypeDescriptor) {
|
||||
String annotationType = Type.getType(asmTypeDescriptor).getClassName();
|
||||
AnnotationAttributes nestedAttributes = new AnnotationAttributes();
|
||||
@@ -69,10 +71,12 @@ abstract class AbstractRecursiveAnnotationVisitor extends AnnotationVisitor {
|
||||
return new RecursiveAnnotationAttributesVisitor(annotationType, nestedAttributes, this.classLoader);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AnnotationVisitor visitArray(String attributeName) {
|
||||
return new RecursiveAnnotationArrayVisitor(attributeName, this.attributes, this.classLoader);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitEnum(String attributeName, String asmTypeDescriptor, String attributeValue) {
|
||||
Object valueToUse = attributeValue;
|
||||
try {
|
||||
@@ -134,6 +138,7 @@ final class RecursiveAnnotationArrayVisitor extends AbstractRecursiveAnnotationV
|
||||
return new RecursiveAnnotationAttributesVisitor(annotationType, nestedAttributes, this.classLoader);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitEnd() {
|
||||
if (!this.allNestedAttributes.isEmpty()) {
|
||||
this.attributes.put(this.attributeName, this.allNestedAttributes.toArray(
|
||||
@@ -160,6 +165,7 @@ class RecursiveAnnotationAttributesVisitor extends AbstractRecursiveAnnotationVi
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public final void visitEnd() {
|
||||
try {
|
||||
Class<?> annotationClass = this.classLoader.loadClass(this.annotationType);
|
||||
|
||||
@@ -74,18 +74,22 @@ final class AnnotationMetadataReadingVisitor extends ClassMetadataReadingVisitor
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Set<String> getAnnotationTypes() {
|
||||
return this.annotationSet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getMetaAnnotationTypes(String annotationType) {
|
||||
return this.metaAnnotationMap.get(annotationType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasAnnotation(String annotationType) {
|
||||
return this.annotationSet.contains(annotationType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasMetaAnnotation(String metaAnnotationType) {
|
||||
Collection<Set<String>> allMetaTypes = this.metaAnnotationMap.values();
|
||||
for (Set<String> metaTypes : allMetaTypes) {
|
||||
@@ -96,14 +100,17 @@ final class AnnotationMetadataReadingVisitor extends ClassMetadataReadingVisitor
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAnnotated(String annotationType) {
|
||||
return this.attributeMap.containsKey(annotationType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AnnotationAttributes getAnnotationAttributes(String annotationType) {
|
||||
return getAnnotationAttributes(annotationType, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AnnotationAttributes getAnnotationAttributes(String annotationType, boolean classValuesAsString) {
|
||||
return getAnnotationAttributes(annotationType, classValuesAsString, false);
|
||||
}
|
||||
@@ -169,10 +176,12 @@ final class AnnotationMetadataReadingVisitor extends ClassMetadataReadingVisitor
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasAnnotatedMethods(String annotationType) {
|
||||
return this.methodMetadataMap.containsKey(annotationType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<MethodMetadata> getAnnotatedMethods(String annotationType) {
|
||||
List<MethodMetadata> list = this.methodMetadataMap.get(annotationType);
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
|
||||
@@ -67,6 +67,7 @@ class ClassMetadataReadingVisitor extends ClassVisitor implements ClassMetadata
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void visit(int version, int access, String name, String signature, String supername, String[] interfaces) {
|
||||
this.className = ClassUtils.convertResourcePathToClassName(name);
|
||||
this.isInterface = ((access & Opcodes.ACC_INTERFACE) != 0);
|
||||
@@ -81,10 +82,12 @@ class ClassMetadataReadingVisitor extends ClassVisitor implements ClassMetadata
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitOuterClass(String owner, String name, String desc) {
|
||||
this.enclosingClassName = ClassUtils.convertResourcePathToClassName(owner);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitInnerClass(String name, String outerName, String innerName, int access) {
|
||||
if (outerName != null) {
|
||||
String fqName = ClassUtils.convertResourcePathToClassName(name);
|
||||
@@ -99,78 +102,96 @@ class ClassMetadataReadingVisitor extends ClassVisitor implements ClassMetadata
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitSource(String source, String debug) {
|
||||
// no-op
|
||||
}
|
||||
|
||||
@Override
|
||||
public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
|
||||
// no-op
|
||||
return new EmptyAnnotationVisitor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitAttribute(Attribute attr) {
|
||||
// no-op
|
||||
}
|
||||
|
||||
@Override
|
||||
public FieldVisitor visitField(int access, String name, String desc, String signature, Object value) {
|
||||
// no-op
|
||||
return new EmptyFieldVisitor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
|
||||
// no-op
|
||||
return new EmptyMethodVisitor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitEnd() {
|
||||
// no-op
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getClassName() {
|
||||
return this.className;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInterface() {
|
||||
return this.isInterface;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAbstract() {
|
||||
return this.isAbstract;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isConcrete() {
|
||||
return !(this.isInterface || this.isAbstract);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFinal() {
|
||||
return this.isFinal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isIndependent() {
|
||||
return (this.enclosingClassName == null || this.independentInnerClass);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasEnclosingClass() {
|
||||
return (this.enclosingClassName != null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEnclosingClassName() {
|
||||
return this.enclosingClassName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasSuperClass() {
|
||||
return (this.superClassName != null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSuperClassName() {
|
||||
return this.superClassName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getInterfaceNames() {
|
||||
return this.interfaces;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getMemberClassNames() {
|
||||
return this.memberClassNames.toArray(new String[this.memberClassNames.size()]);
|
||||
}
|
||||
|
||||
@@ -70,30 +70,37 @@ final class MethodMetadataReadingVisitor extends MethodVisitor implements Method
|
||||
return new AnnotationAttributesReadingVisitor(className, this.attributeMap, null, this.classLoader);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMethodName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStatic() {
|
||||
return ((this.access & Opcodes.ACC_STATIC) != 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFinal() {
|
||||
return ((this.access & Opcodes.ACC_FINAL) != 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOverridable() {
|
||||
return (!isStatic() && !isFinal() && ((this.access & Opcodes.ACC_PRIVATE) == 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAnnotated(String annotationType) {
|
||||
return this.attributeMap.containsKey(annotationType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AnnotationAttributes getAnnotationAttributes(String annotationType) {
|
||||
return this.attributeMap.get(annotationType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDeclaringClassName() {
|
||||
return this.declaringClassName;
|
||||
}
|
||||
|
||||
@@ -64,14 +64,17 @@ final class SimpleMetadataReader implements MetadataReader {
|
||||
this.resource = resource;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Resource getResource() {
|
||||
return this.resource;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClassMetadata getClassMetadata() {
|
||||
return this.classMetadata;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AnnotationMetadata getAnnotationMetadata() {
|
||||
return this.annotationMetadata;
|
||||
}
|
||||
|
||||
@@ -70,12 +70,14 @@ public class SimpleMetadataReaderFactory implements MetadataReaderFactory {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public MetadataReader getMetadataReader(String className) throws IOException {
|
||||
String resourcePath = ResourceLoader.CLASSPATH_URL_PREFIX +
|
||||
ClassUtils.convertClassNameToResourcePath(className) + ClassUtils.CLASS_FILE_SUFFIX;
|
||||
return getMetadataReader(this.resourceLoader.getResource(resourcePath));
|
||||
}
|
||||
|
||||
@Override
|
||||
public MetadataReader getMetadataReader(Resource resource) throws IOException {
|
||||
return new SimpleMetadataReader(resource, this.resourceLoader.getClassLoader());
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ import org.springframework.core.type.classreading.MetadataReader;
|
||||
*/
|
||||
public abstract class AbstractClassTestingTypeFilter implements TypeFilter {
|
||||
|
||||
@Override
|
||||
public final boolean match(MetadataReader metadataReader, MetadataReaderFactory metadataReaderFactory)
|
||||
throws IOException {
|
||||
|
||||
|
||||
@@ -47,6 +47,7 @@ public abstract class AbstractTypeHierarchyTraversingFilter implements TypeFilte
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean match(MetadataReader metadataReader, MetadataReaderFactory metadataReaderFactory)
|
||||
throws IOException {
|
||||
|
||||
|
||||
@@ -60,6 +60,7 @@ public class AspectJTypeFilter implements TypeFilter {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean match(MetadataReader metadataReader, MetadataReaderFactory metadataReaderFactory)
|
||||
throws IOException {
|
||||
|
||||
|
||||
@@ -67,14 +67,17 @@ public class AntPathMatcher implements PathMatcher {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isPattern(String path) {
|
||||
return (path.indexOf('*') != -1 || path.indexOf('?') != -1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean match(String pattern, String path) {
|
||||
return doMatch(pattern, path, true, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matchStart(String pattern, String path) {
|
||||
return doMatch(pattern, path, false, null);
|
||||
}
|
||||
@@ -245,6 +248,7 @@ public class AntPathMatcher implements PathMatcher {
|
||||
* <p>Assumes that {@link #match} returns {@code true} for '{@code pattern}' and '{@code path}', but
|
||||
* does <strong>not</strong> enforce this.
|
||||
*/
|
||||
@Override
|
||||
public String extractPathWithinPattern(String pattern, String path) {
|
||||
String[] patternParts = StringUtils.tokenizeToStringArray(pattern, this.pathSeparator);
|
||||
String[] pathParts = StringUtils.tokenizeToStringArray(path, this.pathSeparator);
|
||||
@@ -275,6 +279,7 @@ public class AntPathMatcher implements PathMatcher {
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> extractUriTemplateVariables(String pattern, String path) {
|
||||
Map<String, String> variables = new LinkedHashMap<String, String>();
|
||||
boolean result = doMatch(pattern, path, true, variables);
|
||||
@@ -301,6 +306,7 @@ public class AntPathMatcher implements PathMatcher {
|
||||
* @return the combination of the two patterns
|
||||
* @throws IllegalArgumentException when the two patterns cannot be combined
|
||||
*/
|
||||
@Override
|
||||
public String combine(String pattern1, String pattern2) {
|
||||
if (!StringUtils.hasText(pattern1) && !StringUtils.hasText(pattern2)) {
|
||||
return "";
|
||||
@@ -379,6 +385,7 @@ public class AntPathMatcher implements PathMatcher {
|
||||
* @param path the full path to use for comparison
|
||||
* @return a comparator capable of sorting patterns in order of explicitness
|
||||
*/
|
||||
@Override
|
||||
public Comparator<String> getPatternComparator(String path) {
|
||||
return new AntPatternComparator(path);
|
||||
}
|
||||
@@ -392,6 +399,7 @@ public class AntPathMatcher implements PathMatcher {
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compare(String pattern1, String pattern2) {
|
||||
if (pattern1 == null && pattern2 == null) {
|
||||
return 0;
|
||||
|
||||
@@ -92,30 +92,37 @@ public class AutoPopulatingList<E> implements List<E>, Serializable {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void add(int index, E element) {
|
||||
this.backingList.add(index, element);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean add(E o) {
|
||||
return this.backingList.add(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAll(Collection<? extends E> c) {
|
||||
return this.backingList.addAll(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAll(int index, Collection<? extends E> c) {
|
||||
return this.backingList.addAll(index, c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
this.backingList.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(Object o) {
|
||||
return this.backingList.contains(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsAll(Collection c) {
|
||||
return this.backingList.containsAll(c);
|
||||
}
|
||||
@@ -124,6 +131,7 @@ public class AutoPopulatingList<E> implements List<E>, Serializable {
|
||||
* Get the element at the supplied index, creating it if there is
|
||||
* no element at that index.
|
||||
*/
|
||||
@Override
|
||||
public E get(int index) {
|
||||
int backingListSize = this.backingList.size();
|
||||
E element = null;
|
||||
@@ -144,62 +152,77 @@ public class AutoPopulatingList<E> implements List<E>, Serializable {
|
||||
return element;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int indexOf(Object o) {
|
||||
return this.backingList.indexOf(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return this.backingList.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<E> iterator() {
|
||||
return this.backingList.iterator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int lastIndexOf(Object o) {
|
||||
return this.backingList.lastIndexOf(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ListIterator<E> listIterator() {
|
||||
return this.backingList.listIterator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ListIterator<E> listIterator(int index) {
|
||||
return this.backingList.listIterator(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public E remove(int index) {
|
||||
return this.backingList.remove(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean remove(Object o) {
|
||||
return this.backingList.remove(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeAll(Collection<?> c) {
|
||||
return this.backingList.removeAll(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean retainAll(Collection<?> c) {
|
||||
return this.backingList.retainAll(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public E set(int index, E element) {
|
||||
return this.backingList.set(index, element);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
return this.backingList.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<E> subList(int fromIndex, int toIndex) {
|
||||
return this.backingList.subList(fromIndex, toIndex);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] toArray() {
|
||||
return this.backingList.toArray();
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T[] toArray(T[] a) {
|
||||
return this.backingList.toArray(a);
|
||||
}
|
||||
@@ -259,6 +282,7 @@ public class AutoPopulatingList<E> implements List<E>, Serializable {
|
||||
this.elementClass = elementClass;
|
||||
}
|
||||
|
||||
@Override
|
||||
public E createElement(int index) {
|
||||
try {
|
||||
return this.elementClass.newInstance();
|
||||
|
||||
@@ -117,18 +117,22 @@ public abstract class CachingMapDecorator<K, V> implements Map<K, V>, Serializab
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
return this.targetMap.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return this.targetMap.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsKey(Object key) {
|
||||
return this.targetMap.containsKey(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsValue(Object value) {
|
||||
Object valueToCheck = (value != null ? value : NULL_VALUE);
|
||||
if (this.synchronize) {
|
||||
@@ -153,6 +157,7 @@ public abstract class CachingMapDecorator<K, V> implements Map<K, V>, Serializab
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public V remove(Object key) {
|
||||
return unwrapReturnValue(this.targetMap.remove(key));
|
||||
}
|
||||
@@ -166,14 +171,17 @@ public abstract class CachingMapDecorator<K, V> implements Map<K, V>, Serializab
|
||||
return (returnValue == NULL_VALUE ? null : (V) returnValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putAll(Map<? extends K, ? extends V> map) {
|
||||
this.targetMap.putAll(map);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
this.targetMap.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<K> keySet() {
|
||||
if (this.synchronize) {
|
||||
synchronized (this.targetMap) {
|
||||
@@ -185,6 +193,7 @@ public abstract class CachingMapDecorator<K, V> implements Map<K, V>, Serializab
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<V> values() {
|
||||
if (this.synchronize) {
|
||||
synchronized (this.targetMap) {
|
||||
@@ -213,6 +222,7 @@ public abstract class CachingMapDecorator<K, V> implements Map<K, V>, Serializab
|
||||
return values;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Map.Entry<K, V>> entrySet() {
|
||||
if (this.synchronize) {
|
||||
synchronized (this.targetMap) {
|
||||
@@ -248,6 +258,7 @@ public abstract class CachingMapDecorator<K, V> implements Map<K, V>, Serializab
|
||||
* reference.
|
||||
* @see #useWeakValue(Object, Object)
|
||||
*/
|
||||
@Override
|
||||
public V put(K key, V value) {
|
||||
Object newValue = value;
|
||||
if (value == null) {
|
||||
@@ -280,6 +291,7 @@ public abstract class CachingMapDecorator<K, V> implements Map<K, V>, Serializab
|
||||
* Consider overriding this method to synchronize it, if desired.
|
||||
* @see #create(Object)
|
||||
*/
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public V get(Object key) {
|
||||
Object value = this.targetMap.get(key);
|
||||
|
||||
@@ -370,14 +370,17 @@ public abstract class CollectionUtils {
|
||||
this.enumeration = enumeration;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return this.enumeration.hasMoreElements();
|
||||
}
|
||||
|
||||
@Override
|
||||
public E next() {
|
||||
return this.enumeration.nextElement();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() throws UnsupportedOperationException {
|
||||
throw new UnsupportedOperationException("Not supported");
|
||||
}
|
||||
@@ -396,6 +399,7 @@ public abstract class CollectionUtils {
|
||||
this.map = map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(K key, V value) {
|
||||
List<V> values = this.map.get(key);
|
||||
if (values == null) {
|
||||
@@ -405,23 +409,27 @@ public abstract class CollectionUtils {
|
||||
values.add(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public V getFirst(K key) {
|
||||
List<V> values = this.map.get(key);
|
||||
return (values != null ? values.get(0) : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(K key, V value) {
|
||||
List<V> values = new LinkedList<V>();
|
||||
values.add(value);
|
||||
this.map.put(key, values);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAll(Map<K, V> values) {
|
||||
for (Entry<K, V> entry : values.entrySet()) {
|
||||
set(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<K, V> toSingleValueMap() {
|
||||
LinkedHashMap<K, V> singleValueMap = new LinkedHashMap<K,V>(this.map.size());
|
||||
for (Entry<K, List<V>> entry : map.entrySet()) {
|
||||
@@ -430,50 +438,62 @@ public abstract class CollectionUtils {
|
||||
return singleValueMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
return this.map.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return this.map.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsKey(Object key) {
|
||||
return this.map.containsKey(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsValue(Object value) {
|
||||
return this.map.containsValue(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<V> get(Object key) {
|
||||
return this.map.get(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<V> put(K key, List<V> value) {
|
||||
return this.map.put(key, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<V> remove(Object key) {
|
||||
return this.map.remove(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putAll(Map<? extends K, ? extends List<V>> m) {
|
||||
this.map.putAll(m);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
this.map.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<K> keySet() {
|
||||
return this.map.keySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<List<V>> values() {
|
||||
return this.map.values();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Entry<K, List<V>>> entrySet() {
|
||||
return this.map.entrySet();
|
||||
}
|
||||
|
||||
@@ -48,6 +48,7 @@ public class CompositeIterator<E> implements Iterator<E> {
|
||||
iterators.add(iterator);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
inUse = true;
|
||||
for (Iterator<Iterator<E>> it = iterators.iterator(); it.hasNext();) {
|
||||
@@ -58,6 +59,7 @@ public class CompositeIterator<E> implements Iterator<E> {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public E next() {
|
||||
inUse = true;
|
||||
for (Iterator<Iterator<E>> it = iterators.iterator(); it.hasNext();) {
|
||||
@@ -69,6 +71,7 @@ public class CompositeIterator<E> implements Iterator<E> {
|
||||
throw new NoSuchElementException("Exhaused all iterators");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
throw new UnsupportedOperationException("Remove is not supported");
|
||||
}
|
||||
|
||||
@@ -249,6 +249,7 @@ public class ConcurrentReferenceHashMap<K, V> extends AbstractMap<K, V> implemen
|
||||
return put(key, value, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public V putIfAbsent(K key, V value) {
|
||||
return put(key, value, false);
|
||||
}
|
||||
@@ -284,6 +285,7 @@ public class ConcurrentReferenceHashMap<K, V> extends AbstractMap<K, V> implemen
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean remove(Object key, final Object value) {
|
||||
return doTask(key, new Task<Boolean>(TaskOption.RESTRUCTURE_AFTER, TaskOption.SKIP_IF_EMPTY) {
|
||||
@Override
|
||||
@@ -297,6 +299,7 @@ public class ConcurrentReferenceHashMap<K, V> extends AbstractMap<K, V> implemen
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replace(K key, final V oldValue, final V newValue) {
|
||||
return doTask(key, new Task<Boolean>(TaskOption.RESTRUCTURE_BEFORE, TaskOption.SKIP_IF_EMPTY) {
|
||||
@Override
|
||||
@@ -310,6 +313,7 @@ public class ConcurrentReferenceHashMap<K, V> extends AbstractMap<K, V> implemen
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public V replace(K key, final V value) {
|
||||
return doTask(key, new Task<V>(TaskOption.RESTRUCTURE_BEFORE, TaskOption.SKIP_IF_EMPTY) {
|
||||
@Override
|
||||
@@ -667,14 +671,17 @@ public class ConcurrentReferenceHashMap<K, V> extends AbstractMap<K, V> implemen
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public K getKey() {
|
||||
return this.key;
|
||||
}
|
||||
|
||||
@Override
|
||||
public V getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public V setValue(V value) {
|
||||
V previous = this.value;
|
||||
this.value = value;
|
||||
@@ -836,11 +843,13 @@ public class ConcurrentReferenceHashMap<K, V> extends AbstractMap<K, V> implemen
|
||||
moveToNextSegment();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
getNextIfNecessary();
|
||||
return this.next != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Entry<K, V> next() {
|
||||
getNextIfNecessary();
|
||||
if (this.next == null) {
|
||||
@@ -886,6 +895,7 @@ public class ConcurrentReferenceHashMap<K, V> extends AbstractMap<K, V> implemen
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
Assert.state(this.last != null);
|
||||
ConcurrentReferenceHashMap.this.remove(this.last.getKey());
|
||||
@@ -955,14 +965,17 @@ public class ConcurrentReferenceHashMap<K, V> extends AbstractMap<K, V> implemen
|
||||
this.nextReference = next;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHash() {
|
||||
return this.hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Reference<K, V> getNext() {
|
||||
return this.nextReference;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void release() {
|
||||
enqueue();
|
||||
clear();
|
||||
@@ -987,14 +1000,17 @@ public class ConcurrentReferenceHashMap<K, V> extends AbstractMap<K, V> implemen
|
||||
this.nextReference = next;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHash() {
|
||||
return this.hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Reference<K, V> getNext() {
|
||||
return this.nextReference;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void release() {
|
||||
enqueue();
|
||||
clear();
|
||||
|
||||
@@ -75,10 +75,12 @@ public class DefaultPropertiesPersister implements PropertiesPersister {
|
||||
ClassUtils.hasMethod(Properties.class, "store", new Class[] {Writer.class, String.class});
|
||||
|
||||
|
||||
@Override
|
||||
public void load(Properties props, InputStream is) throws IOException {
|
||||
props.load(is);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(Properties props, Reader reader) throws IOException {
|
||||
if (loadFromReaderAvailable) {
|
||||
// On JDK 1.6+
|
||||
@@ -157,10 +159,12 @@ public class DefaultPropertiesPersister implements PropertiesPersister {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void store(Properties props, OutputStream os, String header) throws IOException {
|
||||
props.store(os, header);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void store(Properties props, Writer writer, String header) throws IOException {
|
||||
if (storeToWriterAvailable) {
|
||||
// On JDK 1.6+
|
||||
@@ -227,6 +231,7 @@ public class DefaultPropertiesPersister implements PropertiesPersister {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void loadFromXml(Properties props, InputStream is) throws IOException {
|
||||
try {
|
||||
props.loadFromXML(is);
|
||||
@@ -236,6 +241,7 @@ public class DefaultPropertiesPersister implements PropertiesPersister {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void storeToXml(Properties props, OutputStream os, String header) throws IOException {
|
||||
try {
|
||||
props.storeToXML(os, header);
|
||||
@@ -245,6 +251,7 @@ public class DefaultPropertiesPersister implements PropertiesPersister {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void storeToXml(Properties props, OutputStream os, String header, String encoding) throws IOException {
|
||||
try {
|
||||
props.storeToXML(os, header, encoding);
|
||||
|
||||
@@ -70,6 +70,7 @@ public class LinkedMultiValueMap<K, V> implements MultiValueMap<K, V>, Serializa
|
||||
|
||||
// MultiValueMap implementation
|
||||
|
||||
@Override
|
||||
public void add(K key, V value) {
|
||||
List<V> values = this.targetMap.get(key);
|
||||
if (values == null) {
|
||||
@@ -79,23 +80,27 @@ public class LinkedMultiValueMap<K, V> implements MultiValueMap<K, V>, Serializa
|
||||
values.add(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public V getFirst(K key) {
|
||||
List<V> values = this.targetMap.get(key);
|
||||
return (values != null ? values.get(0) : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(K key, V value) {
|
||||
List<V> values = new LinkedList<V>();
|
||||
values.add(value);
|
||||
this.targetMap.put(key, values);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAll(Map<K, V> values) {
|
||||
for (Entry<K, V> entry : values.entrySet()) {
|
||||
set(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<K, V> toSingleValueMap() {
|
||||
LinkedHashMap<K, V> singleValueMap = new LinkedHashMap<K,V>(this.targetMap.size());
|
||||
for (Entry<K, List<V>> entry : targetMap.entrySet()) {
|
||||
@@ -107,50 +112,62 @@ public class LinkedMultiValueMap<K, V> implements MultiValueMap<K, V>, Serializa
|
||||
|
||||
// Map implementation
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
return this.targetMap.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return this.targetMap.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsKey(Object key) {
|
||||
return this.targetMap.containsKey(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsValue(Object value) {
|
||||
return this.targetMap.containsValue(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<V> get(Object key) {
|
||||
return this.targetMap.get(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<V> put(K key, List<V> value) {
|
||||
return this.targetMap.put(key, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<V> remove(Object key) {
|
||||
return this.targetMap.remove(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putAll(Map<? extends K, ? extends List<V>> m) {
|
||||
this.targetMap.putAll(m);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
this.targetMap.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<K> keySet() {
|
||||
return this.targetMap.keySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<List<V>> values() {
|
||||
return this.targetMap.values();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Entry<K, List<V>>> entrySet() {
|
||||
return this.targetMap.entrySet();
|
||||
}
|
||||
|
||||
@@ -107,6 +107,7 @@ public class PropertyPlaceholderHelper {
|
||||
public String replacePlaceholders(String value, final Properties properties) {
|
||||
Assert.notNull(properties, "Argument 'properties' must not be null.");
|
||||
return replacePlaceholders(value, new PlaceholderResolver() {
|
||||
@Override
|
||||
public String resolvePlaceholder(String placeholderName) {
|
||||
return properties.getProperty(placeholderName);
|
||||
}
|
||||
|
||||
@@ -494,6 +494,7 @@ public abstract class ReflectionUtils {
|
||||
public static Method[] getAllDeclaredMethods(Class<?> leafClass) throws IllegalArgumentException {
|
||||
final List<Method> methods = new ArrayList<Method>(32);
|
||||
doWithMethods(leafClass, new MethodCallback() {
|
||||
@Override
|
||||
public void doWith(Method method) {
|
||||
methods.add(method);
|
||||
}
|
||||
@@ -509,6 +510,7 @@ public abstract class ReflectionUtils {
|
||||
public static Method[] getUniqueDeclaredMethods(Class<?> leafClass) throws IllegalArgumentException {
|
||||
final List<Method> methods = new ArrayList<Method>(32);
|
||||
doWithMethods(leafClass, new MethodCallback() {
|
||||
@Override
|
||||
public void doWith(Method method) {
|
||||
boolean knownSignature = false;
|
||||
Method methodBeingOverriddenWithCovariantReturnType = null;
|
||||
@@ -597,6 +599,7 @@ public abstract class ReflectionUtils {
|
||||
+ "] must be same or subclass as source class [" + src.getClass().getName() + "]");
|
||||
}
|
||||
doWithFields(src.getClass(), new FieldCallback() {
|
||||
@Override
|
||||
public void doWith(Field field) throws IllegalArgumentException, IllegalAccessException {
|
||||
makeAccessible(field);
|
||||
Object srcValue = field.get(src);
|
||||
@@ -663,6 +666,7 @@ public abstract class ReflectionUtils {
|
||||
*/
|
||||
public static FieldFilter COPYABLE_FIELDS = new FieldFilter() {
|
||||
|
||||
@Override
|
||||
public boolean matches(Field field) {
|
||||
return !(Modifier.isStatic(field.getModifiers()) || Modifier.isFinal(field.getModifiers()));
|
||||
}
|
||||
@@ -674,6 +678,7 @@ public abstract class ReflectionUtils {
|
||||
*/
|
||||
public static MethodFilter NON_BRIDGED_METHODS = new MethodFilter() {
|
||||
|
||||
@Override
|
||||
public boolean matches(Method method) {
|
||||
return !method.isBridge();
|
||||
}
|
||||
@@ -686,6 +691,7 @@ public abstract class ReflectionUtils {
|
||||
*/
|
||||
public static MethodFilter USER_DECLARED_METHODS = new MethodFilter() {
|
||||
|
||||
@Override
|
||||
public boolean matches(Method method) {
|
||||
return (!method.isBridge() && method.getDeclaringClass() != Object.class);
|
||||
}
|
||||
|
||||
@@ -89,6 +89,7 @@ public abstract class SystemPropertyUtils {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String resolvePlaceholder(String placeholderName) {
|
||||
try {
|
||||
String propVal = System.getProperty(placeholderName);
|
||||
|
||||
@@ -132,6 +132,7 @@ public class WeakReferenceMonitor {
|
||||
*/
|
||||
private static class MonitoringProcess implements Runnable {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
logger.debug("Starting reference monitor thread");
|
||||
// Check if there are any tracked entries left.
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user