Add @Override to remaining source files

Issue: SPR-10130
This commit is contained in:
Rob Winch
2013-05-13 16:47:34 -05:00
parent 30db112d37
commit 9468548116
1279 changed files with 5825 additions and 2 deletions

View File

@@ -50,6 +50,7 @@ public abstract class AbstractCachingConfiguration implements ImportAware {
@Autowired(required=false)
private Collection<CachingConfigurer> cachingConfigurers;
@Override
public void setImportMetadata(AnnotationMetadata importMetadata) {
this.enableCaching = AnnotationAttributes.fromMap(
importMetadata.getAnnotationAttributes(EnableCaching.class.getName(), false));

View File

@@ -39,6 +39,7 @@ public class CachingConfigurationSelector extends AdviceModeImportSelector<Enabl
* @return {@link ProxyCachingConfiguration} or {@code AspectJCacheConfiguration} for
* {@code PROXY} and {@code ASPECTJ} values of {@link EnableCaching#mode()}, respectively
*/
@Override
public String[] selectImports(AdviceMode adviceMode) {
switch (adviceMode) {
case PROXY:

View File

@@ -41,6 +41,7 @@ import org.springframework.util.ObjectUtils;
@SuppressWarnings("serial")
public class SpringCacheAnnotationParser implements CacheAnnotationParser, Serializable {
@Override
public Collection<CacheOperation> parseCacheAnnotations(AnnotatedElement ae) {
Collection<CacheOperation> ops = null;

View File

@@ -83,10 +83,12 @@ public class ConcurrentMapCache implements Cache {
}
@Override
public String getName() {
return this.name;
}
@Override
public ConcurrentMap getNativeCache() {
return this.store;
}
@@ -95,19 +97,23 @@ public class ConcurrentMapCache implements Cache {
return this.allowNullValues;
}
@Override
public ValueWrapper get(Object key) {
Object value = this.store.get(key);
return (value != null ? new SimpleValueWrapper(fromStoreValue(value)) : null);
}
@Override
public void put(Object key, Object value) {
this.store.put(key, toStoreValue(value));
}
@Override
public void evict(Object key) {
this.store.remove(key);
}
@Override
public void clear() {
this.store.clear();
}

View File

@@ -74,26 +74,31 @@ public class ConcurrentMapCacheFactoryBean
this.allowNullValues = allowNullValues;
}
@Override
public void setBeanName(String beanName) {
if (!StringUtils.hasLength(this.name)) {
setName(beanName);
}
}
@Override
public void afterPropertiesSet() {
this.cache = (this.store != null ? new ConcurrentMapCache(this.name, this.store, this.allowNullValues) :
new ConcurrentMapCache(this.name, this.allowNullValues));
}
@Override
public ConcurrentMapCache getObject() {
return this.cache;
}
@Override
public Class<?> getObjectType() {
return ConcurrentMapCache.class;
}
@Override
public boolean isSingleton() {
return true;
}

View File

@@ -71,10 +71,12 @@ public class ConcurrentMapCacheManager implements CacheManager {
}
}
@Override
public Collection<String> getCacheNames() {
return Collections.unmodifiableSet(this.cacheMap.keySet());
}
@Override
public Cache getCache(String name) {
Cache cache = this.cacheMap.get(name);
if (cache == null && this.dynamic) {

View File

@@ -53,6 +53,7 @@ class AnnotationDrivenCacheBeanDefinitionParser implements BeanDefinitionParser
* {@link AopNamespaceUtils#registerAutoProxyCreatorIfNecessary
* register an AutoProxyCreator} with the container as necessary.
*/
@Override
public BeanDefinition parse(Element element, ParserContext parserContext) {
String mode = element.getAttribute("mode");
if ("aspectj".equals(mode)) {

View File

@@ -51,6 +51,7 @@ public class CacheNamespaceHandler extends NamespaceHandlerSupport {
return def;
}
@Override
public void init() {
registerBeanDefinitionParser("annotation-driven", new AnnotationDrivenCacheBeanDefinitionParser());
registerBeanDefinitionParser("advice", new CacheAdviceParser());

View File

@@ -84,6 +84,7 @@ public abstract class AbstractFallbackCacheOperationSource implements CacheOpera
* @return {@link CacheOperation} for this method, or {@code null} if the method
* is not cacheable
*/
@Override
public Collection<CacheOperation> getCacheOperations(Method method, Class<?> targetClass) {
// First, see if we have a cached value.
Object cacheKey = getCacheKey(method, targetClass);

View File

@@ -57,6 +57,7 @@ public class BeanFactoryCacheOperationSourceAdvisor extends AbstractBeanFactoryP
this.pointcut.setClassFilter(classFilter);
}
@Override
public Pointcut getPointcut() {
return this.pointcut;
}

View File

@@ -129,6 +129,7 @@ public abstract class CacheAspectSupport implements InitializingBean {
return this.keyGenerator;
}
@Override
public void afterPropertiesSet() {
if (this.cacheManager == null) {
throw new IllegalStateException("'cacheManager' is required");

View File

@@ -49,10 +49,12 @@ public class CacheInterceptor extends CacheAspectSupport implements MethodInterc
}
}
@Override
public Object invoke(final MethodInvocation invocation) throws Throwable {
Method method = invocation.getMethod();
Invoker aopAllianceInvoker = new Invoker() {
@Override
public Object invoke() {
try {
return invocation.proceed();

View File

@@ -33,6 +33,7 @@ import org.springframework.util.ObjectUtils;
@SuppressWarnings("serial")
abstract class CacheOperationSourcePointcut extends StaticMethodMatcherPointcut implements Serializable {
@Override
public boolean matches(Method method, Class<?> targetClass) {
CacheOperationSource cas = getCacheOperationSource();
return (cas != null && !CollectionUtils.isEmpty(cas.getCacheOperations(method, targetClass)));

View File

@@ -52,6 +52,7 @@ public class CompositeCacheOperationSource implements CacheOperationSource, Seri
return this.cacheOperationSources;
}
@Override
public Collection<CacheOperation> getCacheOperations(Method method, Class<?> targetClass) {
Collection<CacheOperation> ops = null;

View File

@@ -36,6 +36,7 @@ public class DefaultKeyGenerator implements KeyGenerator {
public static final int NO_PARAM_KEY = 0;
public static final int NULL_PARAM_KEY = 53;
@Override
public Object generate(Object target, Method method, Object... params) {
if (params.length == 1) {
return (params[0] == null ? NULL_PARAM_KEY : params[0]);

View File

@@ -71,6 +71,7 @@ public class NameMatchCacheOperationSource implements CacheOperationSource, Seri
this.nameMap.put(methodName, ops);
}
@Override
public Collection<CacheOperation> getCacheOperations(Method method, Class<?> targetClass) {
// look for direct name match
String methodName = method.getName();

View File

@@ -42,6 +42,7 @@ public abstract class AbstractCacheManager implements CacheManager, Initializing
private Set<String> cacheNames = new LinkedHashSet<String>(16);
@Override
public void afterPropertiesSet() {
Collection<? extends Cache> caches = loadCaches();
@@ -70,10 +71,12 @@ public abstract class AbstractCacheManager implements CacheManager, Initializing
}
@Override
public Cache getCache(String name) {
return this.cacheMap.get(name);
}
@Override
public Collection<String> getCacheNames() {
return Collections.unmodifiableSet(this.cacheNames);
}

View File

@@ -59,6 +59,7 @@ public class CompositeCacheManager implements InitializingBean, CacheManager {
this.fallbackToNoOpCache = fallbackToNoOpCache;
}
@Override
public void afterPropertiesSet() {
if (this.fallbackToNoOpCache) {
this.cacheManagers.add(new NoOpCacheManager());
@@ -66,6 +67,7 @@ public class CompositeCacheManager implements InitializingBean, CacheManager {
}
@Override
public Cache getCache(String name) {
for (CacheManager cacheManager : this.cacheManagers) {
Cache cache = cacheManager.getCache(name);
@@ -76,6 +78,7 @@ public class CompositeCacheManager implements InitializingBean, CacheManager {
return null;
}
@Override
public Collection<String> getCacheNames() {
List<String> names = new ArrayList<String>();
for (CacheManager manager : this.cacheManagers) {

View File

@@ -48,6 +48,7 @@ public class NoOpCacheManager implements CacheManager {
* This implementation always returns a {@link Cache} implementation that will not store items.
* Additionally, the request cache will be remembered by the manager for consistency.
*/
@Override
public Cache getCache(String name) {
Cache cache = this.caches.get(name);
if (cache == null) {
@@ -63,6 +64,7 @@ public class NoOpCacheManager implements CacheManager {
/**
* This implementation returns the name of the caches previously requested.
*/
@Override
public Collection<String> getCacheNames() {
synchronized (this.cacheNames) {
return Collections.unmodifiableSet(this.cacheNames);
@@ -78,24 +80,30 @@ public class NoOpCacheManager implements CacheManager {
this.name = name;
}
@Override
public void clear() {
}
@Override
public void evict(Object key) {
}
@Override
public ValueWrapper get(Object key) {
return null;
}
@Override
public String getName() {
return this.name;
}
@Override
public Object getNativeCache() {
return null;
}
@Override
public void put(Object key, Object value) {
}
}

View File

@@ -42,6 +42,7 @@ public class SimpleValueWrapper implements ValueWrapper {
/**
* Simply returns the value as given at construction time.
*/
@Override
public Object get() {
return this.value;
}

View File

@@ -100,6 +100,7 @@ public interface ConfigurableApplicationContext extends ApplicationContext, Life
/**
* Return the Environment for this application context in configurable form.
*/
@Override
ConfigurableEnvironment getEnvironment();
/**
@@ -158,6 +159,7 @@ public interface ConfigurableApplicationContext extends ApplicationContext, Life
* <p>This method can be called multiple times without side effects: Subsequent
* {@code close} calls on an already closed context will be ignored.
*/
@Override
void close();
/**

View File

@@ -48,6 +48,7 @@ public class ContextBeanFactoryReference implements BeanFactoryReference {
}
@Override
public BeanFactory getFactory() {
if (this.applicationContext == null) {
throw new IllegalStateException(
@@ -56,6 +57,7 @@ public class ContextBeanFactoryReference implements BeanFactoryReference {
return this.applicationContext;
}
@Override
public void release() {
if (this.applicationContext != null) {
ApplicationContext savedCtx;

View File

@@ -57,6 +57,7 @@ public class ContextJndiBeanFactoryLocator extends JndiLocatorSupport implements
* will be created from the combined resources.
* @see #createBeanFactory
*/
@Override
public BeanFactoryReference useBeanFactory(String factoryKey) throws BeansException {
try {
String beanFactoryPath = lookup(factoryKey, String.class);

View File

@@ -65,6 +65,7 @@ public abstract class AdviceModeImportSelector<A extends Annotation> implements
* on the importing {@code @Configuration} class or if {@link #selectImports(AdviceMode)}
* returns {@code null}
*/
@Override
public final String[] selectImports(AnnotationMetadata importingClassMetadata) {
Class<?> annoType = GenericTypeResolver.resolveTypeArgument(this.getClass(), AdviceModeImportSelector.class);

View File

@@ -64,6 +64,7 @@ public class AnnotationBeanNameGenerator implements BeanNameGenerator {
private static final String COMPONENT_ANNOTATION_CLASSNAME = "org.springframework.stereotype.Component";
@Override
public String generateBeanName(BeanDefinition definition, BeanDefinitionRegistry registry) {
if (definition instanceof AnnotatedBeanDefinition) {
String beanName = determineBeanNameFromAnnotation((AnnotatedBeanDefinition) definition);

View File

@@ -38,6 +38,7 @@ import org.springframework.beans.factory.xml.ParserContext;
*/
public class AnnotationConfigBeanDefinitionParser implements BeanDefinitionParser {
@Override
public BeanDefinition parse(Element element, ParserContext parserContext) {
Object source = parserContext.extractSource(element);

View File

@@ -74,6 +74,7 @@ public class AnnotationScopeMetadataResolver implements ScopeMetadataResolver {
}
@Override
public ScopeMetadata resolveScopeMetadata(BeanDefinition definition) {
ScopeMetadata metadata = new ScopeMetadata();
if (definition instanceof AnnotatedBeanDefinition) {

View File

@@ -39,6 +39,7 @@ class AspectJAutoProxyRegistrar implements ImportBeanDefinitionRegistrar {
* of the @{@link EnableAspectJAutoProxy#proxyTargetClass()} attribute on the importing
* {@code @Configuration} class.
*/
@Override
public void registerBeanDefinitions(
AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {

View File

@@ -56,6 +56,7 @@ public class AutoProxyRegistrar implements ImportBeanDefinitionRegistrar {
* {@code proxyTargetClass} attributes, the APC can be registered and configured all
* the same.
*/
@Override
public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {
boolean candidateFound = false;
Set<String> annoTypes = importingClassMetadata.getAnnotationTypes();

View File

@@ -117,6 +117,7 @@ public class ClassPathScanningCandidateComponentProvider implements EnvironmentC
* @see org.springframework.core.io.support.ResourcePatternResolver
* @see org.springframework.core.io.support.PathMatchingResourcePatternResolver
*/
@Override
public void setResourceLoader(ResourceLoader resourceLoader) {
this.resourcePatternResolver = ResourcePatternUtils.getResourcePatternResolver(resourceLoader);
this.metadataReaderFactory = new CachingMetadataReaderFactory(resourceLoader);
@@ -157,6 +158,7 @@ public class ClassPathScanningCandidateComponentProvider implements EnvironmentC
this.environment = environment;
}
@Override
public final Environment getEnvironment() {
return this.environment;
}

View File

@@ -266,6 +266,7 @@ public class CommonAnnotationBeanPostProcessor extends InitDestroyAnnotationBean
this.resourceFactory = resourceFactory;
}
@Override
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
Assert.notNull(beanFactory, "BeanFactory must not be null");
this.beanFactory = beanFactory;
@@ -284,14 +285,17 @@ public class CommonAnnotationBeanPostProcessor extends InitDestroyAnnotationBean
}
}
@Override
public Object postProcessBeforeInstantiation(Class<?> beanClass, String beanName) throws BeansException {
return null;
}
@Override
public boolean postProcessAfterInstantiation(Object bean, String beanName) throws BeansException {
return true;
}
@Override
public PropertyValues postProcessPropertyValues(
PropertyValues pvs, PropertyDescriptor[] pds, Object bean, String beanName) throws BeansException {

View File

@@ -75,6 +75,7 @@ public class ComponentScanBeanDefinitionParser implements BeanDefinitionParser {
private static final String FILTER_EXPRESSION_ATTRIBUTE = "expression";
@Override
public BeanDefinition parse(Element element, ParserContext parserContext) {
String[] basePackages = StringUtils.tokenizeToStringArray(element.getAttribute(BASE_PACKAGE_ATTRIBUTE),
ConfigurableApplicationContext.CONFIG_LOCATION_DELIMITERS);

View File

@@ -183,19 +183,23 @@ abstract class ConditionalAnnotationHelper {
return null;
}
@Override
public BeanDefinitionRegistry getRegistry() {
return this.registry;
}
@Override
public Environment getEnvironment() {
return this.environment;
}
@Override
public ConfigurableListableBeanFactory getBeanFactory() {
Assert.state(this.beanFactory != null, "Unable to locate the BeanFactory");
return this.beanFactory;
}
@Override
public ResourceLoader getResourceLoader() {
if (registry instanceof ResourceLoader) {
return (ResourceLoader) registry;
@@ -203,6 +207,7 @@ abstract class ConditionalAnnotationHelper {
return null;
}
@Override
public ClassLoader getClassLoader() {
ResourceLoader resourceLoader = getResourceLoader();
return (resourceLoader == null ? null : resourceLoader.getClassLoader());

View File

@@ -326,6 +326,7 @@ class ConfigurationClassBeanDefinitionReader {
this.annotationMetadata = original.annotationMetadata;
}
@Override
public AnnotationMetadata getMetadata() {
return this.annotationMetadata;
}

View File

@@ -206,12 +206,14 @@ class ConfigurationClassEnhancer {
private static class DisposableBeanMethodInterceptor implements MethodInterceptor,
ConditionalCallback {
@Override
public boolean isMatch(Method candidateMethod) {
return candidateMethod.getName().equals("destroy")
&& candidateMethod.getParameterTypes().length == 0
&& DisposableBean.class.isAssignableFrom(candidateMethod.getDeclaringClass());
}
@Override
public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy) throws Throwable {
Enhancer.registerStaticCallbacks(obj.getClass(), null);
// does the actual (non-CGLIB) superclass actually implement DisposableBean?
@@ -235,6 +237,7 @@ class ConfigurationClassEnhancer {
private static class BeanFactoryAwareMethodInterceptor implements MethodInterceptor,
ConditionalCallback {
@Override
public boolean isMatch(Method candidateMethod) {
return candidateMethod.getName().equals("setBeanFactory")
&& candidateMethod.getParameterTypes().length == 1
@@ -242,6 +245,7 @@ class ConfigurationClassEnhancer {
&& BeanFactoryAware.class.isAssignableFrom(candidateMethod.getDeclaringClass());
}
@Override
public Object intercept(Object obj, Method method, Object[] args,
MethodProxy proxy) throws Throwable {
Field field = obj.getClass().getDeclaredField(BEAN_FACTORY_FIELD);
@@ -266,6 +270,7 @@ class ConfigurationClassEnhancer {
*/
private static class BeanMethodInterceptor implements MethodInterceptor, ConditionalCallback {
@Override
public boolean isMatch(Method candidateMethod) {
return BeanAnnotationHelper.isBeanAnnotated(candidateMethod);
}
@@ -277,6 +282,7 @@ class ConfigurationClassEnhancer {
* invoking the super implementation of the proxied method i.e., the actual
* {@code @Bean} method.
*/
@Override
public Object intercept(Object enhancedConfigInstance, Method beanMethod, Object[] beanMethodArgs,
MethodProxy cglibMethodProxy) throws Throwable {
@@ -389,6 +395,7 @@ class ConfigurationClassEnhancer {
enhancer.setSuperclass(fbClass);
enhancer.setUseFactory(false);
enhancer.setCallback(new MethodInterceptor() {
@Override
public Object intercept(Object obj, Method method, Object[] args,
MethodProxy proxy) throws Throwable {
if (method.getName().equals("getObject") && args.length == 0) {

View File

@@ -90,6 +90,7 @@ class ConfigurationClassParser {
private static final Comparator<DeferredImportSelectorHolder> DEFERRED_IMPORT_COMPARATOR =
new Comparator<ConfigurationClassParser.DeferredImportSelectorHolder>() {
@Override
public int compare(DeferredImportSelectorHolder o1,
DeferredImportSelectorHolder o2) {
return AnnotationAwareOrderComparator.INSTANCE.compare(
@@ -535,6 +536,7 @@ class ConfigurationClassParser {
this.imports.put(importedClass, importingClass);
}
@Override
public String getImportingClassFor(String importedClass) {
return this.imports.get(importedClass);
}
@@ -548,6 +550,7 @@ class ConfigurationClassParser {
public boolean contains(Object elem) {
ConfigurationClass configClass = (ConfigurationClass) elem;
Comparator<ConfigurationClass> comparator = new Comparator<ConfigurationClass>() {
@Override
public int compare(ConfigurationClass first, ConfigurationClass second) {
return first.getMetadata().getClassName().equals(second.getMetadata().getClassName()) ? 0 : 1;
}

View File

@@ -184,16 +184,19 @@ public class ConfigurationClassPostProcessor implements BeanDefinitionRegistryPo
this.importBeanNameGenerator = beanNameGenerator;
}
@Override
public void setEnvironment(Environment environment) {
Assert.notNull(environment, "Environment must not be null");
this.environment = environment;
}
@Override
public void setResourceLoader(ResourceLoader resourceLoader) {
Assert.notNull(resourceLoader, "ResourceLoader must not be null");
this.resourceLoader = resourceLoader;
}
@Override
public void setBeanClassLoader(ClassLoader beanClassLoader) {
this.beanClassLoader = beanClassLoader;
if (!this.setMetadataReaderFactoryCalled) {
@@ -205,6 +208,7 @@ public class ConfigurationClassPostProcessor implements BeanDefinitionRegistryPo
/**
* Derive further bean definitions from the configuration classes in the registry.
*/
@Override
public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) {
RootBeanDefinition iabpp = new RootBeanDefinition(ImportAwareBeanPostProcessor.class);
iabpp.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
@@ -228,6 +232,7 @@ public class ConfigurationClassPostProcessor implements BeanDefinitionRegistryPo
* Prepare the Configuration classes for servicing bean requests at runtime
* by replacing them with CGLIB-enhanced subclasses.
*/
@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) {
int factoryId = System.identityHashCode(beanFactory);
if (this.factoriesPostProcessed.contains(factoryId)) {
@@ -366,10 +371,12 @@ public class ConfigurationClassPostProcessor implements BeanDefinitionRegistryPo
private BeanFactory beanFactory;
@Override
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
this.beanFactory = beanFactory;
}
@Override
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
if (bean instanceof ImportAware) {
ImportRegistry importRegistry = this.beanFactory.getBean(IMPORT_REGISTRY_BEAN_NAME, ImportRegistry.class);
@@ -392,10 +399,12 @@ public class ConfigurationClassPostProcessor implements BeanDefinitionRegistryPo
return bean;
}
@Override
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
return bean;
}
@Override
public int getOrder() {
return Ordered.HIGHEST_PRECEDENCE;
}

View File

@@ -81,6 +81,7 @@ public class Jsr330ScopeMetadataResolver implements ScopeMetadataResolver {
}
@Override
public ScopeMetadata resolveScopeMetadata(BeanDefinition definition) {
ScopeMetadata metadata = new ScopeMetadata();
metadata.setScopeName(BeanDefinition.SCOPE_PROTOTYPE);

View File

@@ -52,6 +52,7 @@ public class LoadTimeWeavingConfiguration implements ImportAware, BeanClassLoade
private ClassLoader beanClassLoader;
@Override
public void setImportMetadata(AnnotationMetadata importMetadata) {
this.enableLTW = MetadataUtils.attributesFor(importMetadata, EnableLoadTimeWeaving.class);
Assert.notNull(this.enableLTW,
@@ -59,6 +60,7 @@ public class LoadTimeWeavingConfiguration implements ImportAware, BeanClassLoade
importMetadata.getClassName());
}
@Override
public void setBeanClassLoader(ClassLoader beanClassLoader) {
this.beanClassLoader = beanClassLoader;
}

View File

@@ -56,6 +56,7 @@ public class MBeanExportConfiguration implements ImportAware, BeanFactoryAware {
private BeanFactory beanFactory;
@Override
public void setImportMetadata(AnnotationMetadata importMetadata) {
Map<String, Object> map = importMetadata.getAnnotationAttributes(EnableMBeanExport.class.getName());
this.attributes = AnnotationAttributes.fromMap(map);
@@ -63,6 +64,7 @@ public class MBeanExportConfiguration implements ImportAware, BeanFactoryAware {
"importing class " + importMetadata.getClassName());
}
@Override
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
this.beanFactory = beanFactory;
}

View File

@@ -29,6 +29,7 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
*/
class ProfileCondition implements Condition {
@Override
public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
if (context.getEnvironment() != null && metadata.isAnnotated(Profile.class.getName())) {
AnnotationAttributes profile = AnnotationAttributes.fromMap(metadata.getAnnotationAttributes(Profile.class.getName()));

View File

@@ -61,6 +61,7 @@ public class ScannedGenericBeanDefinition extends GenericBeanDefinition implemen
}
@Override
public final AnnotationMetadata getMetadata() {
return this.metadata;
}

View File

@@ -30,6 +30,7 @@ import org.springframework.context.annotation.ComponentScanBeanDefinitionParser;
*/
public class ContextNamespaceHandler extends NamespaceHandlerSupport {
@Override
public void init() {
registerBeanDefinitionParser("property-placeholder", new PropertyPlaceholderBeanDefinitionParser());
registerBeanDefinitionParser("property-override", new PropertyOverrideBeanDefinitionParser());

View File

@@ -43,6 +43,7 @@ class SpringConfiguredBeanDefinitionParser implements BeanDefinitionParser {
"org.springframework.beans.factory.aspectj.AnnotationBeanConfigurerAspect";
@Override
public BeanDefinition parse(Element element, ParserContext parserContext) {
if (!parserContext.getRegistry().containsBeanDefinition(BEAN_CONFIGURER_ASPECT_BEAN_NAME)) {
RootBeanDefinition def = new RootBeanDefinition();

View File

@@ -58,6 +58,7 @@ public abstract class AbstractApplicationEventMulticaster implements Application
private BeanFactory beanFactory;
@Override
public void addApplicationListener(ApplicationListener listener) {
synchronized (this.defaultRetriever) {
this.defaultRetriever.applicationListeners.add(listener);
@@ -65,6 +66,7 @@ public abstract class AbstractApplicationEventMulticaster implements Application
}
}
@Override
public void addApplicationListenerBean(String listenerBeanName) {
synchronized (this.defaultRetriever) {
this.defaultRetriever.applicationListenerBeans.add(listenerBeanName);
@@ -72,6 +74,7 @@ public abstract class AbstractApplicationEventMulticaster implements Application
}
}
@Override
public void removeApplicationListener(ApplicationListener listener) {
synchronized (this.defaultRetriever) {
this.defaultRetriever.applicationListeners.remove(listener);
@@ -79,6 +82,7 @@ public abstract class AbstractApplicationEventMulticaster implements Application
}
}
@Override
public void removeApplicationListenerBean(String listenerBeanName) {
synchronized (this.defaultRetriever) {
this.defaultRetriever.applicationListenerBeans.remove(listenerBeanName);
@@ -86,6 +90,7 @@ public abstract class AbstractApplicationEventMulticaster implements Application
}
}
@Override
public void removeAllListeners() {
synchronized (this.defaultRetriever) {
this.defaultRetriever.applicationListeners.clear();
@@ -94,6 +99,7 @@ public abstract class AbstractApplicationEventMulticaster implements Application
}
}
@Override
public final void setBeanFactory(BeanFactory beanFactory) {
this.beanFactory = beanFactory;
}

View File

@@ -77,10 +77,12 @@ public class EventPublicationInterceptor
}
}
@Override
public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) {
this.applicationEventPublisher = applicationEventPublisher;
}
@Override
public void afterPropertiesSet() throws Exception {
if (this.applicationEventClassConstructor == null) {
throw new IllegalArgumentException("applicationEventClass is required");
@@ -88,6 +90,7 @@ public class EventPublicationInterceptor
}
@Override
public Object invoke(MethodInvocation invocation) throws Throwable {
Object retVal = invocation.proceed();

View File

@@ -46,11 +46,13 @@ public class GenericApplicationListenerAdapter implements SmartApplicationListen
}
@Override
@SuppressWarnings("unchecked")
public void onApplicationEvent(ApplicationEvent event) {
this.delegate.onApplicationEvent(event);
}
@Override
public boolean supportsEventType(Class<? extends ApplicationEvent> eventType) {
Class typeArg = GenericTypeResolver.resolveTypeArgument(this.delegate.getClass(), ApplicationListener.class);
if (typeArg == null || typeArg.equals(ApplicationEvent.class)) {
@@ -62,10 +64,12 @@ public class GenericApplicationListenerAdapter implements SmartApplicationListen
return (typeArg == null || typeArg.isAssignableFrom(eventType));
}
@Override
public boolean supportsSourceType(Class<?> sourceType) {
return true;
}
@Override
public int getOrder() {
return (this.delegate instanceof Ordered ? ((Ordered) this.delegate).getOrder() : Ordered.LOWEST_PRECEDENCE);
}

View File

@@ -81,12 +81,14 @@ public class SimpleApplicationEventMulticaster extends AbstractApplicationEventM
}
@Override
@SuppressWarnings("unchecked")
public void multicastEvent(final ApplicationEvent event) {
for (final ApplicationListener listener : getApplicationListeners(event)) {
Executor executor = getTaskExecutor();
if (executor != null) {
executor.execute(new Runnable() {
@Override
public void run() {
listener.onApplicationEvent(event);
}

View File

@@ -63,20 +63,24 @@ public class SourceFilteringListener implements SmartApplicationListener {
}
@Override
public void onApplicationEvent(ApplicationEvent event) {
if (event.getSource() == this.source) {
onApplicationEventInternal(event);
}
}
@Override
public boolean supportsEventType(Class<? extends ApplicationEvent> eventType) {
return (this.delegate == null || this.delegate.supportsEventType(eventType));
}
@Override
public boolean supportsSourceType(Class<?> sourceType) {
return sourceType.isInstance(this.source);
}
@Override
public int getOrder() {
return (this.delegate != null ? this.delegate.getOrder() : Ordered.LOWEST_PRECEDENCE);
}

View File

@@ -32,22 +32,27 @@ import org.springframework.expression.TypedValue;
*/
public class BeanExpressionContextAccessor implements PropertyAccessor {
@Override
public boolean canRead(EvaluationContext context, Object target, String name) throws AccessException {
return ((BeanExpressionContext) target).containsObject(name);
}
@Override
public TypedValue read(EvaluationContext context, Object target, String name) throws AccessException {
return new TypedValue(((BeanExpressionContext) target).getObject(name));
}
@Override
public boolean canWrite(EvaluationContext context, Object target, String name) throws AccessException {
return false;
}
@Override
public void write(EvaluationContext context, Object target, String name, Object newValue) throws AccessException {
throw new AccessException("Beans in a BeanFactory are read-only");
}
@Override
public Class[] getSpecificTargetClasses() {
return new Class[] {BeanExpressionContext.class};
}

View File

@@ -32,22 +32,27 @@ import org.springframework.expression.TypedValue;
*/
public class BeanFactoryAccessor implements PropertyAccessor {
@Override
public boolean canRead(EvaluationContext context, Object target, String name) throws AccessException {
return (((BeanFactory) target).containsBean(name));
}
@Override
public TypedValue read(EvaluationContext context, Object target, String name) throws AccessException {
return new TypedValue(((BeanFactory) target).getBean(name));
}
@Override
public boolean canWrite(EvaluationContext context, Object target, String name) throws AccessException {
return false;
}
@Override
public void write(EvaluationContext context, Object target, String name, Object newValue) throws AccessException {
throw new AccessException("Beans in a BeanFactory are read-only");
}
@Override
public Class[] getSpecificTargetClasses() {
return new Class[] {BeanFactory.class};
}

View File

@@ -39,6 +39,7 @@ public class BeanFactoryResolver implements BeanResolver {
this.beanFactory = beanFactory;
}
@Override
public Object resolve(EvaluationContext context, String beanName) throws AccessException {
try {
return this.beanFactory.getBean(beanName);

View File

@@ -31,6 +31,7 @@ import org.springframework.expression.TypedValue;
*/
public class EnvironmentAccessor implements PropertyAccessor {
@Override
public Class<?>[] getSpecificTargetClasses() {
return new Class[] { Environment.class };
}
@@ -39,6 +40,7 @@ public class EnvironmentAccessor implements PropertyAccessor {
* Can read any {@link Environment}, thus always returns true.
* @return true
*/
@Override
public boolean canRead(EvaluationContext context, Object target, String name) throws AccessException {
return true;
}
@@ -47,6 +49,7 @@ public class EnvironmentAccessor implements PropertyAccessor {
* Access the given target object by resolving the given property name against the given target
* environment.
*/
@Override
public TypedValue read(EvaluationContext context, Object target, String name) throws AccessException {
return new TypedValue(((Environment)target).getProperty(name));
}
@@ -55,6 +58,7 @@ public class EnvironmentAccessor implements PropertyAccessor {
* Read only.
* @return false
*/
@Override
public boolean canWrite(EvaluationContext context, Object target, String name) throws AccessException {
return false;
}
@@ -62,6 +66,7 @@ public class EnvironmentAccessor implements PropertyAccessor {
/**
* Read only. No-op.
*/
@Override
public void write(EvaluationContext context, Object target, String name, Object newValue) throws AccessException {
}

View File

@@ -33,11 +33,13 @@ import org.springframework.expression.TypedValue;
*/
public class MapAccessor implements PropertyAccessor {
@Override
public boolean canRead(EvaluationContext context, Object target, String name) throws AccessException {
Map map = (Map) target;
return map.containsKey(name);
}
@Override
public TypedValue read(EvaluationContext context, Object target, String name) throws AccessException {
Map map = (Map) target;
Object value = map.get(name);
@@ -47,16 +49,19 @@ public class MapAccessor implements PropertyAccessor {
return new TypedValue(value);
}
@Override
public boolean canWrite(EvaluationContext context, Object target, String name) throws AccessException {
return true;
}
@Override
@SuppressWarnings("unchecked")
public void write(EvaluationContext context, Object target, String name, Object newValue) throws AccessException {
Map map = (Map) target;
map.put(name, newValue);
}
@Override
public Class[] getSpecificTargetClasses() {
return new Class[] {Map.class};
}

View File

@@ -66,12 +66,15 @@ public class StandardBeanExpressionResolver implements BeanExpressionResolver {
new ConcurrentHashMap<BeanExpressionContext, StandardEvaluationContext>(8);
private final ParserContext beanExpressionParserContext = new ParserContext() {
@Override
public boolean isTemplate() {
return true;
}
@Override
public String getExpressionPrefix() {
return expressionPrefix;
}
@Override
public String getExpressionSuffix() {
return expressionSuffix;
}
@@ -109,6 +112,7 @@ public class StandardBeanExpressionResolver implements BeanExpressionResolver {
}
@Override
public Object evaluate(String value, BeanExpressionContext evalContext) throws BeansException {
if (!StringUtils.hasLength(value)) {
return value;

View File

@@ -42,6 +42,7 @@ public class SimpleLocaleContext implements LocaleContext {
this.locale = locale;
}
@Override
public Locale getLocale() {
return this.locale;
}

View File

@@ -240,14 +240,17 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
* of the context bean if the context is itself defined as a bean.
* @param id the unique id of the context
*/
@Override
public void setId(String id) {
this.id = id;
}
@Override
public String getId() {
return this.id;
}
@Override
public String getApplicationName() {
return "";
}
@@ -266,6 +269,7 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
* Return a friendly name for this context.
* @return a display name for this context (never {@code null})
*/
@Override
public String getDisplayName() {
return this.displayName;
}
@@ -274,6 +278,7 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
* Return the parent context, or {@code null} if there is no parent
* (that is, this context is the root of the context hierarchy).
*/
@Override
public ApplicationContext getParent() {
return this.parent;
}
@@ -283,6 +288,7 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
* <p>If {@code null}, a new environment will be initialized via
* {@link #createEnvironment()}.
*/
@Override
public ConfigurableEnvironment getEnvironment() {
if (this.environment == null) {
this.environment = createEnvironment();
@@ -298,6 +304,7 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
* should be performed <em>before</em> {@link #refresh()}.
* @see org.springframework.context.support.AbstractApplicationContext#createEnvironment
*/
@Override
public void setEnvironment(ConfigurableEnvironment environment) {
this.environment = environment;
}
@@ -307,6 +314,7 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
* if already available.
* @see #getBeanFactory()
*/
@Override
public AutowireCapableBeanFactory getAutowireCapableBeanFactory() throws IllegalStateException {
return getBeanFactory();
}
@@ -314,6 +322,7 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
/**
* Return the timestamp (ms) when this context was first loaded.
*/
@Override
public long getStartupDate() {
return this.startupDate;
}
@@ -326,6 +335,7 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
* @param event the event to publish (may be application-specific or a
* standard framework event)
*/
@Override
public void publishEvent(ApplicationEvent event) {
Assert.notNull(event, "Event must not be null");
if (logger.isTraceEnabled()) {
@@ -394,6 +404,7 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
* its environment is an instance of {@link ConfigurableEnvironment}.
* @see ConfigurableEnvironment#merge(ConfigurableEnvironment)
*/
@Override
public void setParent(ApplicationContext parent) {
this.parent = parent;
if (parent != null) {
@@ -404,6 +415,7 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
}
}
@Override
public void addBeanFactoryPostProcessor(BeanFactoryPostProcessor beanFactoryPostProcessor) {
this.beanFactoryPostProcessors.add(beanFactoryPostProcessor);
}
@@ -417,6 +429,7 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
return this.beanFactoryPostProcessors;
}
@Override
public void addApplicationListener(ApplicationListener<?> listener) {
if (this.applicationEventMulticaster != null) {
this.applicationEventMulticaster.addApplicationListener(listener);
@@ -442,6 +455,7 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
return new StandardEnvironment();
}
@Override
public void refresh() throws BeansException, IllegalStateException {
synchronized (this.startupShutdownMonitor) {
// Prepare this context for refreshing.
@@ -957,6 +971,7 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
* @see #close()
* @see #doClose()
*/
@Override
public void registerShutdownHook() {
if (this.shutdownHook == null) {
// No shutdown hook registered yet.
@@ -980,6 +995,7 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
* @see #close()
* @see org.springframework.beans.factory.access.SingletonBeanFactoryLocator
*/
@Override
public void destroy() {
close();
}
@@ -991,6 +1007,7 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
* @see #doClose()
* @see #registerShutdownHook()
*/
@Override
public void close() {
synchronized (this.startupShutdownMonitor) {
doClose();
@@ -1088,6 +1105,7 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
// For subclasses: do nothing by default.
}
@Override
public boolean isActive() {
synchronized (this.activeMonitor) {
return this.active;
@@ -1121,50 +1139,60 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
// Implementation of BeanFactory interface
//---------------------------------------------------------------------
@Override
public Object getBean(String name) throws BeansException {
assertBeanFactoryActive();
return getBeanFactory().getBean(name);
}
@Override
public <T> T getBean(String name, Class<T> requiredType) throws BeansException {
assertBeanFactoryActive();
return getBeanFactory().getBean(name, requiredType);
}
@Override
public <T> T getBean(Class<T> requiredType) throws BeansException {
assertBeanFactoryActive();
return getBeanFactory().getBean(requiredType);
}
@Override
public Object getBean(String name, Object... args) throws BeansException {
assertBeanFactoryActive();
return getBeanFactory().getBean(name, args);
}
@Override
public boolean containsBean(String name) {
return getBeanFactory().containsBean(name);
}
@Override
public boolean isSingleton(String name) throws NoSuchBeanDefinitionException {
assertBeanFactoryActive();
return getBeanFactory().isSingleton(name);
}
@Override
public boolean isPrototype(String name) throws NoSuchBeanDefinitionException {
assertBeanFactoryActive();
return getBeanFactory().isPrototype(name);
}
@Override
public boolean isTypeMatch(String name, Class<?> targetType) throws NoSuchBeanDefinitionException {
assertBeanFactoryActive();
return getBeanFactory().isTypeMatch(name, targetType);
}
@Override
public Class<?> getType(String name) throws NoSuchBeanDefinitionException {
assertBeanFactoryActive();
return getBeanFactory().getType(name);
}
@Override
public String[] getAliases(String name) {
return getBeanFactory().getAliases(name);
}
@@ -1174,33 +1202,40 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
// Implementation of ListableBeanFactory interface
//---------------------------------------------------------------------
@Override
public boolean containsBeanDefinition(String beanName) {
return getBeanFactory().containsBeanDefinition(beanName);
}
@Override
public int getBeanDefinitionCount() {
return getBeanFactory().getBeanDefinitionCount();
}
@Override
public String[] getBeanDefinitionNames() {
return getBeanFactory().getBeanDefinitionNames();
}
@Override
public String[] getBeanNamesForType(Class<?> type) {
assertBeanFactoryActive();
return getBeanFactory().getBeanNamesForType(type);
}
@Override
public String[] getBeanNamesForType(Class<?> type, boolean includeNonSingletons, boolean allowEagerInit) {
assertBeanFactoryActive();
return getBeanFactory().getBeanNamesForType(type, includeNonSingletons, allowEagerInit);
}
@Override
public <T> Map<String, T> getBeansOfType(Class<T> type) throws BeansException {
assertBeanFactoryActive();
return getBeanFactory().getBeansOfType(type);
}
@Override
public <T> Map<String, T> getBeansOfType(Class<T> type, boolean includeNonSingletons, boolean allowEagerInit)
throws BeansException {
@@ -1208,6 +1243,7 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
return getBeanFactory().getBeansOfType(type, includeNonSingletons, allowEagerInit);
}
@Override
public Map<String, Object> getBeansWithAnnotation(Class<? extends Annotation> annotationType)
throws BeansException {
@@ -1215,6 +1251,7 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
return getBeanFactory().getBeansWithAnnotation(annotationType);
}
@Override
public <A extends Annotation> A findAnnotationOnBean(String beanName, Class<A> annotationType) {
assertBeanFactoryActive();
return getBeanFactory().findAnnotationOnBean(beanName, annotationType);
@@ -1225,10 +1262,12 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
// Implementation of HierarchicalBeanFactory interface
//---------------------------------------------------------------------
@Override
public BeanFactory getParentBeanFactory() {
return getParent();
}
@Override
public boolean containsLocalBean(String name) {
return getBeanFactory().containsLocalBean(name);
}
@@ -1248,14 +1287,17 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
// Implementation of MessageSource interface
//---------------------------------------------------------------------
@Override
public String getMessage(String code, Object args[], String defaultMessage, Locale locale) {
return getMessageSource().getMessage(code, args, defaultMessage, locale);
}
@Override
public String getMessage(String code, Object args[], Locale locale) throws NoSuchMessageException {
return getMessageSource().getMessage(code, args, locale);
}
@Override
public String getMessage(MessageSourceResolvable resolvable, Locale locale) throws NoSuchMessageException {
return getMessageSource().getMessage(resolvable, locale);
}
@@ -1287,6 +1329,7 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
// Implementation of ResourcePatternResolver interface
//---------------------------------------------------------------------
@Override
public Resource[] getResources(String locationPattern) throws IOException {
return this.resourcePatternResolver.getResources(locationPattern);
}
@@ -1296,16 +1339,19 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
// Implementation of Lifecycle interface
//---------------------------------------------------------------------
@Override
public void start() {
getLifecycleProcessor().start();
publishEvent(new ContextStartedEvent(this));
}
@Override
public void stop() {
getLifecycleProcessor().stop();
publishEvent(new ContextStoppedEvent(this));
}
@Override
public boolean isRunning() {
return getLifecycleProcessor().isRunning();
}
@@ -1347,6 +1393,7 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
* @see #refreshBeanFactory()
* @see #closeBeanFactory()
*/
@Override
public abstract ConfigurableListableBeanFactory getBeanFactory() throws IllegalStateException;
@@ -1385,10 +1432,12 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
this.beanPostProcessorTargetCount = beanPostProcessorTargetCount;
}
@Override
public Object postProcessBeforeInitialization(Object bean, String beanName) {
return bean;
}
@Override
public Object postProcessAfterInitialization(Object bean, String beanName) {
if (bean != null && !(bean instanceof BeanPostProcessor) &&
this.beanFactory.getBeanPostProcessorCount() < this.beanPostProcessorTargetCount) {
@@ -1411,16 +1460,19 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
private final Map<String, Boolean> singletonNames = new ConcurrentHashMap<String, Boolean>(64);
@Override
public void postProcessMergedBeanDefinition(RootBeanDefinition beanDefinition, Class<?> beanType, String beanName) {
if (beanDefinition.isSingleton()) {
this.singletonNames.put(beanName, Boolean.TRUE);
}
}
@Override
public Object postProcessBeforeInitialization(Object bean, String beanName) {
return bean;
}
@Override
public Object postProcessAfterInitialization(Object bean, String beanName) {
if (bean instanceof ApplicationListener) {
// potentially not detected as a listener by getBeanNamesForType retrieval

View File

@@ -70,10 +70,12 @@ public abstract class AbstractMessageSource extends MessageSourceSupport impleme
private boolean useCodeAsDefaultMessage = false;
@Override
public void setParentMessageSource(MessageSource parent) {
this.parentMessageSource = parent;
}
@Override
public MessageSource getParentMessageSource() {
return this.parentMessageSource;
}
@@ -129,6 +131,7 @@ public abstract class AbstractMessageSource extends MessageSourceSupport impleme
}
@Override
public final String getMessage(String code, Object[] args, String defaultMessage, Locale locale) {
String msg = getMessageInternal(code, args, locale);
if (msg != null) {
@@ -143,6 +146,7 @@ public abstract class AbstractMessageSource extends MessageSourceSupport impleme
return renderDefaultMessage(defaultMessage, args, locale);
}
@Override
public final String getMessage(String code, Object[] args, Locale locale) throws NoSuchMessageException {
String msg = getMessageInternal(code, args, locale);
if (msg != null) {
@@ -155,6 +159,7 @@ public abstract class AbstractMessageSource extends MessageSourceSupport impleme
throw new NoSuchMessageException(code, locale);
}
@Override
public final String getMessage(MessageSourceResolvable resolvable, Locale locale)
throws NoSuchMessageException {

View File

@@ -133,6 +133,7 @@ public abstract class AbstractRefreshableConfigApplicationContext extends Abstra
* Sets the id of this context to the bean name by default,
* for cases where the context instance is itself defined as a bean.
*/
@Override
public void setBeanName(String name) {
if (!this.setIdCalled) {
super.setId(name);
@@ -144,6 +145,7 @@ public abstract class AbstractRefreshableConfigApplicationContext extends Abstra
* Triggers {@link #refresh()} if not refreshed in the concrete context's
* constructor already.
*/
@Override
public void afterPropertiesSet() {
if (!isActive()) {
refresh();

View File

@@ -70,6 +70,7 @@ class ApplicationContextAwareProcessor implements BeanPostProcessor {
}
@Override
public Object postProcessBeforeInitialization(final Object bean, String beanName) throws BeansException {
AccessControlContext acc = null;
@@ -82,6 +83,7 @@ class ApplicationContextAwareProcessor implements BeanPostProcessor {
if (acc != null) {
AccessController.doPrivileged(new PrivilegedAction<Object>() {
@Override
public Object run() {
invokeAwareInterfaces(bean);
return null;
@@ -119,6 +121,7 @@ class ApplicationContextAwareProcessor implements BeanPostProcessor {
}
}
@Override
public Object postProcessAfterInitialization(Object bean, String beanName) {
return bean;
}
@@ -132,6 +135,7 @@ class ApplicationContextAwareProcessor implements BeanPostProcessor {
this.beanFactory = beanFactory;
}
@Override
public String resolveStringValue(String strVal) {
return this.beanFactory.resolveEmbeddedValue(strVal);
}

View File

@@ -56,6 +56,7 @@ public abstract class ApplicationObjectSupport implements ApplicationContextAwar
private MessageSourceAccessor messageSourceAccessor;
@Override
public final void setApplicationContext(ApplicationContext context) throws BeansException {
if (context == null && !isContextRequired()) {
// Reset internal context state.

View File

@@ -63,6 +63,7 @@ class ContextTypeMatchClassLoader extends DecoratingClassLoader implements Smart
return new ContextOverridingClassLoader(getParent()).loadClass(name);
}
@Override
public boolean isClassReloadable(Class clazz) {
return (clazz.getClassLoader() instanceof ContextOverridingClassLoader);
}

View File

@@ -64,6 +64,7 @@ public class ConversionServiceFactoryBean implements FactoryBean<ConversionServi
this.converters = converters;
}
@Override
public void afterPropertiesSet() {
this.conversionService = createConversionService();
ConversionServiceFactory.registerConverters(this.converters, this.conversionService);
@@ -82,14 +83,17 @@ public class ConversionServiceFactoryBean implements FactoryBean<ConversionServi
// implementing FactoryBean
@Override
public ConversionService getObject() {
return this.conversionService;
}
@Override
public Class<? extends ConversionService> getObjectType() {
return GenericConversionService.class;
}
@Override
public boolean isSingleton() {
return true;
}

View File

@@ -68,6 +68,7 @@ public class DefaultLifecycleProcessor implements LifecycleProcessor, BeanFactor
this.timeoutPerShutdownPhase = timeoutPerShutdownPhase;
}
@Override
public void setBeanFactory(BeanFactory beanFactory) {
Assert.isInstanceOf(ConfigurableListableBeanFactory.class, beanFactory);
this.beanFactory = (ConfigurableListableBeanFactory) beanFactory;
@@ -85,6 +86,7 @@ public class DefaultLifecycleProcessor implements LifecycleProcessor, BeanFactor
* declared as a dependency of another bean will be started before
* the dependent bean regardless of the declared phase.
*/
@Override
public void start() {
startBeans(false);
this.running = true;
@@ -99,21 +101,25 @@ public class DefaultLifecycleProcessor implements LifecycleProcessor, BeanFactor
* declared as dependent on another bean will be stopped before
* the dependency bean regardless of the declared phase.
*/
@Override
public void stop() {
stopBeans();
this.running = false;
}
@Override
public void onRefresh() {
startBeans(true);
this.running = true;
}
@Override
public void onClose() {
stopBeans();
this.running = false;
}
@Override
public boolean isRunning() {
return this.running;
}
@@ -221,6 +227,7 @@ public class DefaultLifecycleProcessor implements LifecycleProcessor, BeanFactor
}
countDownBeanNames.add(beanName);
((SmartLifecycle) bean).stop(new Runnable() {
@Override
public void run() {
latch.countDown();
countDownBeanNames.remove(beanName);
@@ -389,6 +396,7 @@ public class DefaultLifecycleProcessor implements LifecycleProcessor, BeanFactor
this.bean = bean;
}
@Override
public int compareTo(LifecycleGroupMember other) {
int thisOrder = getPhase(this.bean);
int otherOrder = getPhase(other.bean);

View File

@@ -96,6 +96,7 @@ public class DefaultMessageSourceResolvable implements MessageSourceResolvable,
}
@Override
public String[] getCodes() {
return this.codes;
}
@@ -108,10 +109,12 @@ public class DefaultMessageSourceResolvable implements MessageSourceResolvable,
return (this.codes != null && this.codes.length > 0) ? this.codes[this.codes.length - 1] : null;
}
@Override
public Object[] getArguments() {
return this.arguments;
}
@Override
public String getDefaultMessage() {
return this.defaultMessage;
}

View File

@@ -39,15 +39,18 @@ public class DelegatingMessageSource extends MessageSourceSupport implements Hie
private MessageSource parentMessageSource;
@Override
public void setParentMessageSource(MessageSource parent) {
this.parentMessageSource = parent;
}
@Override
public MessageSource getParentMessageSource() {
return this.parentMessageSource;
}
@Override
public String getMessage(String code, Object[] args, String defaultMessage, Locale locale) {
if (this.parentMessageSource != null) {
return this.parentMessageSource.getMessage(code, args, defaultMessage, locale);
@@ -57,6 +60,7 @@ public class DelegatingMessageSource extends MessageSourceSupport implements Hie
}
}
@Override
public String getMessage(String code, Object[] args, Locale locale) throws NoSuchMessageException {
if (this.parentMessageSource != null) {
return this.parentMessageSource.getMessage(code, args, locale);
@@ -66,6 +70,7 @@ public class DelegatingMessageSource extends MessageSourceSupport implements Hie
}
}
@Override
public String getMessage(MessageSourceResolvable resolvable, Locale locale) throws NoSuchMessageException {
if (this.parentMessageSource != null) {
return this.parentMessageSource.getMessage(resolvable, locale);

View File

@@ -286,32 +286,39 @@ public class GenericApplicationContext extends AbstractApplicationContext implem
// Implementation of BeanDefinitionRegistry
//---------------------------------------------------------------------
@Override
public void registerBeanDefinition(String beanName, BeanDefinition beanDefinition)
throws BeanDefinitionStoreException {
this.beanFactory.registerBeanDefinition(beanName, beanDefinition);
}
@Override
public void removeBeanDefinition(String beanName) throws NoSuchBeanDefinitionException {
this.beanFactory.removeBeanDefinition(beanName);
}
@Override
public BeanDefinition getBeanDefinition(String beanName) throws NoSuchBeanDefinitionException {
return this.beanFactory.getBeanDefinition(beanName);
}
@Override
public boolean isBeanNameInUse(String beanName) {
return this.beanFactory.isBeanNameInUse(beanName);
}
@Override
public void registerAlias(String beanName, String alias) {
this.beanFactory.registerAlias(beanName, alias);
}
@Override
public void removeAlias(String alias) {
this.beanFactory.removeAlias(alias);
}
@Override
public boolean isAlias(String beanName) {
return this.beanFactory.isAlias(beanName);
}

View File

@@ -93,6 +93,7 @@ public class LiveBeansView implements LiveBeansViewMBean, ApplicationContextAwar
private ConfigurableApplicationContext applicationContext;
@Override
public void setApplicationContext(ApplicationContext applicationContext) {
Assert.isTrue(applicationContext instanceof ConfigurableApplicationContext,
"ApplicationContext does not implement ConfigurableApplicationContext");
@@ -105,6 +106,7 @@ public class LiveBeansView implements LiveBeansViewMBean, ApplicationContextAwar
* finding all active ApplicationContexts through {@link #findApplicationContexts()},
* then delegating to {@link #generateJson(java.util.Set)}.
*/
@Override
public String getSnapshotAsJson() {
Set<ConfigurableApplicationContext> contexts;
if (this.applicationContext != null) {

View File

@@ -101,6 +101,7 @@ public class PropertySourcesPlaceholderConfigurer extends PlaceholderConfigurerS
* @see #setPropertySources
* @see #postProcessBeanFactory
*/
@Override
public void setEnvironment(Environment environment) {
this.environment = environment;
}
@@ -167,6 +168,7 @@ public class PropertySourcesPlaceholderConfigurer extends PlaceholderConfigurerS
propertyResolver.setValueSeparator(this.valueSeparator);
StringValueResolver valueResolver = new StringValueResolver() {
@Override
public String resolveStringValue(String strVal) {
String resolved = ignoreUnresolvablePlaceholders ?
propertyResolver.resolvePlaceholders(strVal) :

View File

@@ -250,6 +250,7 @@ public class ReloadableResourceBundleMessageSource extends AbstractMessageSource
* @see org.springframework.core.io.DefaultResourceLoader
* @see org.springframework.context.ResourceLoaderAware
*/
@Override
public void setResourceLoader(ResourceLoader resourceLoader) {
this.resourceLoader = (resourceLoader != null ? resourceLoader : new DefaultResourceLoader());
}

View File

@@ -214,6 +214,7 @@ public class ResourceBundleMessageSource extends AbstractMessageSource implement
return (this.bundleClassLoader != null ? this.bundleClassLoader : this.beanClassLoader);
}
@Override
public void setBeanClassLoader(ClassLoader classLoader) {
this.beanClassLoader = (classLoader != null ? classLoader : ClassUtils.getDefaultClassLoader());
}
@@ -402,6 +403,7 @@ public class ResourceBundleMessageSource extends AbstractMessageSource implement
try {
stream = AccessController.doPrivileged(
new PrivilegedExceptionAction<InputStream>() {
@Override
public InputStream run() throws IOException {
InputStream is = null;
if (reloadFlag) {

View File

@@ -55,6 +55,7 @@ public class SimpleThreadScope implements Scope {
}
};
@Override
public Object get(String name, ObjectFactory objectFactory) {
Map<String, Object> scope = threadScope.get();
Object object = scope.get(name);
@@ -65,20 +66,24 @@ public class SimpleThreadScope implements Scope {
return object;
}
@Override
public Object remove(String name) {
Map<String, Object> scope = threadScope.get();
return scope.remove(name);
}
@Override
public void registerDestructionCallback(String name, Runnable callback) {
logger.warn("SimpleThreadScope does not support descruction callbacks. " +
"Consider using a RequestScope in a Web environment.");
}
@Override
public Object resolveContextualObject(String key) {
return null;
}
@Override
public String getConversationId() {
return Thread.currentThread().getName();
}

View File

@@ -51,18 +51,22 @@ public class AspectJWeavingEnabler
public static final String ASPECTJ_AOP_XML_RESOURCE = "META-INF/aop.xml";
@Override
public void setBeanClassLoader(ClassLoader classLoader) {
this.beanClassLoader = classLoader;
}
@Override
public void setLoadTimeWeaver(LoadTimeWeaver loadTimeWeaver) {
this.loadTimeWeaver = loadTimeWeaver;
}
@Override
public int getOrder() {
return HIGHEST_PRECEDENCE;
}
@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
enableAspectJWeaving(this.loadTimeWeaver, this.beanClassLoader);
}
@@ -94,6 +98,7 @@ public class AspectJWeavingEnabler
this.delegate = delegate;
}
@Override
public byte[] transform(ClassLoader loader, String className, Class<?> classBeingRedefined,
ProtectionDomain protectionDomain, byte[] classfileBuffer) throws IllegalClassFormatException {

View File

@@ -69,6 +69,7 @@ public class DefaultContextLoadTimeWeaver implements LoadTimeWeaver, BeanClassLo
setBeanClassLoader(beanClassLoader);
}
@Override
public void setBeanClassLoader(ClassLoader classLoader) {
LoadTimeWeaver serverSpecificLoadTimeWeaver = createServerSpecificLoadTimeWeaver(classLoader);
if (serverSpecificLoadTimeWeaver != null) {
@@ -126,6 +127,7 @@ public class DefaultContextLoadTimeWeaver implements LoadTimeWeaver, BeanClassLo
return null;
}
@Override
public void destroy() {
if (this.loadTimeWeaver instanceof InstrumentationLoadTimeWeaver) {
logger.info("Removing all registered transformers for class loader: " +
@@ -135,14 +137,17 @@ public class DefaultContextLoadTimeWeaver implements LoadTimeWeaver, BeanClassLo
}
@Override
public void addTransformer(ClassFileTransformer transformer) {
this.loadTimeWeaver.addTransformer(transformer);
}
@Override
public ClassLoader getInstrumentableClassLoader() {
return this.loadTimeWeaver.getInstrumentableClassLoader();
}
@Override
public ClassLoader getThrowawayClassLoader() {
return this.loadTimeWeaver.getThrowawayClassLoader();
}

View File

@@ -81,11 +81,13 @@ public class LoadTimeWeaverAwareProcessor implements BeanPostProcessor, BeanFact
}
@Override
public void setBeanFactory(BeanFactory beanFactory) {
this.beanFactory = beanFactory;
}
@Override
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
if (bean instanceof LoadTimeWeaverAware) {
LoadTimeWeaver ltw = this.loadTimeWeaver;
@@ -100,6 +102,7 @@ public class LoadTimeWeaverAwareProcessor implements BeanPostProcessor, BeanFact
return bean;
}
@Override
public Object postProcessAfterInitialization(Object bean, String name) {
return bean;
}

View File

@@ -183,6 +183,7 @@ public abstract class AbstractSlsbInvokerInterceptor extends JndiObjectLocator
* Prepares the thread context if necessar, and delegates to
* {@link #invokeInContext}.
*/
@Override
public Object invoke(MethodInvocation invocation) throws Throwable {
Context ctx = (this.exposeAccessContext ? getJndiTemplate().getContext() : null);
try {

View File

@@ -77,6 +77,7 @@ public class LocalStatelessSessionProxyFactoryBean extends LocalSlsbInvokerInter
return this.businessInterface;
}
@Override
public void setBeanClassLoader(ClassLoader classLoader) {
this.beanClassLoader = classLoader;
}
@@ -91,14 +92,17 @@ public class LocalStatelessSessionProxyFactoryBean extends LocalSlsbInvokerInter
}
@Override
public Object getObject() {
return this.proxy;
}
@Override
public Class<?> getObjectType() {
return this.businessInterface;
}
@Override
public boolean isSingleton() {
return true;
}

View File

@@ -171,6 +171,7 @@ public class SimpleRemoteSlsbInvokerInterceptor extends AbstractRemoteSlsbInvoke
/**
* Remove the cached session bean instance, if necessary.
*/
@Override
public void destroy() {
if (this.cacheSessionBean) {
synchronized (this.beanInstanceMonitor) {

View File

@@ -91,6 +91,7 @@ public class SimpleRemoteStatelessSessionProxyFactoryBean extends SimpleRemoteSl
return this.businessInterface;
}
@Override
public void setBeanClassLoader(ClassLoader classLoader) {
this.beanClassLoader = classLoader;
}
@@ -105,14 +106,17 @@ public class SimpleRemoteStatelessSessionProxyFactoryBean extends SimpleRemoteSl
}
@Override
public Object getObject() {
return this.proxy;
}
@Override
public Class<?> getObjectType() {
return this.businessInterface;
}
@Override
public boolean isSingleton() {
return true;
}

View File

@@ -27,6 +27,7 @@ import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
*/
public class JeeNamespaceHandler extends NamespaceHandlerSupport {
@Override
public void init() {
registerBeanDefinitionParser("jndi-lookup", new JndiLookupBeanDefinitionParser());
registerBeanDefinitionParser("local-slsb", new LocalStatelessSessionBeanDefinitionParser());

View File

@@ -146,10 +146,12 @@ public class DateFormatter implements Formatter<Date> {
}
@Override
public String print(Date date, Locale locale) {
return getDateFormat(locale).format(date);
}
@Override
public Date parse(String text, Locale locale) throws ParseException {
return getDateFormat(locale).parse(text);
}

View File

@@ -53,6 +53,7 @@ public class DateFormatterRegistrar implements FormatterRegistrar {
}
@Override
public void registerFormatters(FormatterRegistry registry) {
addDateConverters(registry);
registry.addFormatterForFieldAnnotation(new DateTimeFormatAnnotationFormatterFactory());
@@ -81,6 +82,7 @@ public class DateFormatterRegistrar implements FormatterRegistrar {
private static class DateToLongConverter implements Converter<Date, Long> {
@Override
public Long convert(Date source) {
return source.getTime();
}
@@ -89,6 +91,7 @@ public class DateFormatterRegistrar implements FormatterRegistrar {
private static class DateToCalendarConverter implements Converter<Date, Calendar> {
@Override
public Calendar convert(Date source) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(source);
@@ -99,6 +102,7 @@ public class DateFormatterRegistrar implements FormatterRegistrar {
private static class CalendarToDateConverter implements Converter<Calendar, Date> {
@Override
public Date convert(Calendar source) {
return source.getTime();
}
@@ -107,6 +111,7 @@ public class DateFormatterRegistrar implements FormatterRegistrar {
private static class CalendarToLongConverter implements Converter<Calendar, Long> {
@Override
public Long convert(Calendar source) {
return source.getTime().getTime();
}
@@ -115,6 +120,7 @@ public class DateFormatterRegistrar implements FormatterRegistrar {
private static class LongToDateConverter implements Converter<Long, Date> {
@Override
public Date convert(Long source) {
return new Date(source);
}
@@ -125,6 +131,7 @@ public class DateFormatterRegistrar implements FormatterRegistrar {
private final DateToCalendarConverter dateToCalendarConverter = new DateToCalendarConverter();
@Override
public Calendar convert(Long source) {
return this.dateToCalendarConverter.convert(new Date(source));
}

View File

@@ -55,18 +55,22 @@ public class DateTimeFormatAnnotationFormatterFactory implements
private StringValueResolver embeddedValueResolver;
@Override
public void setEmbeddedValueResolver(StringValueResolver resolver) {
this.embeddedValueResolver = resolver;
}
@Override
public Set<Class<?>> getFieldTypes() {
return FIELD_TYPES;
}
@Override
public Printer<?> getPrinter(DateTimeFormat annotation, Class<?> fieldType) {
return getFormatter(annotation, fieldType);
}
@Override
public Parser<?> getParser(DateTimeFormat annotation, Class<?> fieldType) {
return getFormatter(annotation, fieldType);
}

View File

@@ -39,18 +39,22 @@ public class DateTimeFormatterFactoryBean extends DateTimeFormatterFactory
private DateTimeFormatter dateTimeFormatter;
@Override
public void afterPropertiesSet() {
this.dateTimeFormatter = createDateTimeFormatter();
}
@Override
public DateTimeFormatter getObject() {
return this.dateTimeFormatter;
}
@Override
public Class<?> getObjectType() {
return DateTimeFormatter.class;
}
@Override
public boolean isSingleton() {
return true;
}

View File

@@ -44,6 +44,7 @@ public final class DateTimeParser implements Parser<DateTime> {
}
@Override
public DateTime parse(String text, Locale locale) throws ParseException {
return JodaTimeContextHolder.getFormatter(this.formatter, locale).parseDateTime(text);
}

View File

@@ -71,6 +71,7 @@ public class JodaDateTimeFormatAnnotationFormatterFactory
private StringValueResolver embeddedValueResolver;
@Override
public void setEmbeddedValueResolver(StringValueResolver resolver) {
this.embeddedValueResolver = resolver;
}
@@ -80,10 +81,12 @@ public class JodaDateTimeFormatAnnotationFormatterFactory
}
@Override
public final Set<Class<?>> getFieldTypes() {
return FIELD_TYPES;
}
@Override
public Printer<?> getPrinter(DateTimeFormat annotation, Class<?> fieldType) {
DateTimeFormatter formatter = getFormatter(annotation, fieldType);
if (ReadablePartial.class.isAssignableFrom(fieldType)) {
@@ -99,6 +102,7 @@ public class JodaDateTimeFormatAnnotationFormatterFactory
}
}
@Override
public Parser<DateTime> getParser(DateTimeFormat annotation, Class<?> fieldType) {
return new DateTimeParser(getFormatter(annotation, fieldType));
}

View File

@@ -64,6 +64,7 @@ final class JodaTimeConverters {
private static class DateTimeToLocalDateConverter implements Converter<DateTime, LocalDate> {
@Override
public LocalDate convert(DateTime source) {
return source.toLocalDate();
}
@@ -72,6 +73,7 @@ final class JodaTimeConverters {
private static class DateTimeToLocalTimeConverter implements Converter<DateTime, LocalTime> {
@Override
public LocalTime convert(DateTime source) {
return source.toLocalTime();
}
@@ -80,6 +82,7 @@ final class JodaTimeConverters {
private static class DateTimeToLocalDateTimeConverter implements Converter<DateTime, LocalDateTime> {
@Override
public LocalDateTime convert(DateTime source) {
return source.toLocalDateTime();
}
@@ -88,6 +91,7 @@ final class JodaTimeConverters {
private static class DateTimeToDateMidnightConverter implements Converter<DateTime, DateMidnight> {
@Override
public DateMidnight convert(DateTime source) {
return source.toDateMidnight();
}
@@ -96,6 +100,7 @@ final class JodaTimeConverters {
private static class DateTimeToMutableDateTimeConverter implements Converter<DateTime, MutableDateTime> {
@Override
public MutableDateTime convert(DateTime source) {
return source.toMutableDateTime();
}
@@ -104,6 +109,7 @@ final class JodaTimeConverters {
private static class DateTimeToInstantConverter implements Converter<DateTime, Instant> {
@Override
public Instant convert(DateTime source) {
return source.toInstant();
}
@@ -112,6 +118,7 @@ final class JodaTimeConverters {
private static class DateTimeToDateConverter implements Converter<DateTime, Date> {
@Override
public Date convert(DateTime source) {
return source.toDate();
}
@@ -120,6 +127,7 @@ final class JodaTimeConverters {
private static class DateTimeToCalendarConverter implements Converter<DateTime, Calendar> {
@Override
public Calendar convert(DateTime source) {
return source.toGregorianCalendar();
}
@@ -128,6 +136,7 @@ final class JodaTimeConverters {
private static class DateTimeToLongConverter implements Converter<DateTime, Long> {
@Override
public Long convert(DateTime source) {
return source.getMillis();
}
@@ -141,6 +150,7 @@ final class JodaTimeConverters {
*/
private static class DateToReadableInstantConverter implements Converter<Date, ReadableInstant> {
@Override
public ReadableInstant convert(Date source) {
return new DateTime(source);
}
@@ -154,6 +164,7 @@ final class JodaTimeConverters {
*/
private static class CalendarToReadableInstantConverter implements Converter<Calendar, ReadableInstant> {
@Override
public ReadableInstant convert(Calendar source) {
return new DateTime(source);
}

View File

@@ -155,6 +155,7 @@ public class JodaTimeFormatterRegistrar implements FormatterRegistrar {
}
@Override
public void registerFormatters(FormatterRegistry registry) {
JodaTimeConverters.registerConverters(registry);

View File

@@ -42,6 +42,7 @@ public final class MillisecondInstantPrinter implements Printer<Long> {
}
@Override
public String print(Long instant, Locale locale) {
return JodaTimeContextHolder.getFormatter(this.formatter, locale).print(instant);
}

View File

@@ -43,6 +43,7 @@ public final class ReadableInstantPrinter implements Printer<ReadableInstant> {
}
@Override
public String print(ReadableInstant instant, Locale locale) {
return JodaTimeContextHolder.getFormatter(this.formatter, locale).print(instant);
}

View File

@@ -43,6 +43,7 @@ public final class ReadablePartialPrinter implements Printer<ReadablePartial> {
}
@Override
public String print(ReadablePartial partial, Locale locale) {
return JodaTimeContextHolder.getFormatter(this.formatter, locale).print(partial);
}

View File

@@ -39,18 +39,22 @@ public class DateTimeFormatterFactoryBean extends DateTimeFormatterFactory
private DateTimeFormatter dateTimeFormatter;
@Override
public void afterPropertiesSet() {
this.dateTimeFormatter = createDateTimeFormatter();
}
@Override
public DateTimeFormatter getObject() {
return this.dateTimeFormatter;
}
@Override
public Class<?> getObjectType() {
return DateTimeFormatter.class;
}
@Override
public boolean isSingleton() {
return true;
}

View File

@@ -147,6 +147,7 @@ public class DateTimeFormatterRegistrar implements FormatterRegistrar {
}
@Override
public void registerFormatters(FormatterRegistry registry) {
DateTimeFormatter dateFormatter = getFormatter(Type.DATE);
DateTimeFormatter timeFormatter = getFormatter(Type.TIME);

View File

@@ -33,10 +33,12 @@ import org.springframework.format.Formatter;
*/
public class InstantFormatter implements Formatter<Instant> {
@Override
public Instant parse(String text, Locale locale) throws ParseException {
return Instant.parse(text);
}
@Override
public String print(Instant object, Locale locale) {
return object.toString();
}

View File

@@ -63,6 +63,7 @@ public class Jsr310DateTimeFormatAnnotationFormatterFactory
private StringValueResolver embeddedValueResolver;
@Override
public void setEmbeddedValueResolver(StringValueResolver resolver) {
this.embeddedValueResolver = resolver;
}
@@ -72,15 +73,18 @@ public class Jsr310DateTimeFormatAnnotationFormatterFactory
}
@Override
public final Set<Class<?>> getFieldTypes() {
return FIELD_TYPES;
}
@Override
public Printer<?> getPrinter(DateTimeFormat annotation, Class<?> fieldType) {
DateTimeFormatter formatter = getFormatter(annotation, fieldType);
return new TemporalAccessorPrinter(formatter);
}
@Override
@SuppressWarnings("unchecked")
public Parser<?> getParser(DateTimeFormat annotation, Class<?> fieldType) {
DateTimeFormatter formatter = getFormatter(annotation, fieldType);

View File

@@ -62,6 +62,7 @@ public final class TemporalAccessorParser implements Parser<TemporalAccessor> {
}
@Override
public TemporalAccessor parse(String text, Locale locale) throws ParseException {
DateTimeFormatter formatterToUse = DateTimeContextHolder.getFormatter(this.formatter, locale);
if (LocalDate.class.equals(this.temporalAccessorType)) {

View File

@@ -45,6 +45,7 @@ public final class TemporalAccessorPrinter implements Printer<TemporalAccessor>
}
@Override
public String print(TemporalAccessor partial, Locale locale) {
return DateTimeContextHolder.getFormatter(this.formatter, locale).format(partial);
}

View File

@@ -44,10 +44,12 @@ public abstract class AbstractNumberFormatter implements Formatter<Number> {
this.lenient = lenient;
}
@Override
public String print(Number number, Locale locale) {
return getNumberFormat(locale).format(number);
}
@Override
public Number parse(String text, Locale locale) throws ParseException {
NumberFormat format = getNumberFormat(locale);
ParsePosition position = new ParsePosition(0);

View File

@@ -75,6 +75,7 @@ public class CurrencyFormatter extends AbstractNumberFormatter {
}
@Override
public BigDecimal parse(String text, Locale locale) throws ParseException {
BigDecimal decimal = (BigDecimal) super.parse(text, locale);
if (decimal != null) {
@@ -88,6 +89,7 @@ public class CurrencyFormatter extends AbstractNumberFormatter {
return decimal;
}
@Override
protected NumberFormat getNumberFormat(Locale locale) {
DecimalFormat format = (DecimalFormat) NumberFormat.getCurrencyInstance(locale);
format.setParseBigDecimal(true);

View File

@@ -59,11 +59,13 @@ public class NumberFormatAnnotationFormatterFactory
this.fieldTypes = Collections.unmodifiableSet(rawFieldTypes);
}
@Override
public final Set<Class<?>> getFieldTypes() {
return this.fieldTypes;
}
@Override
public void setEmbeddedValueResolver(StringValueResolver resolver) {
this.embeddedValueResolver = resolver;
}
@@ -73,10 +75,12 @@ public class NumberFormatAnnotationFormatterFactory
}
@Override
public Printer<Number> getPrinter(NumberFormat annotation, Class<?> fieldType) {
return configureFormatterFrom(annotation);
}
@Override
public Parser<Number> getParser(NumberFormat annotation, Class<?> fieldType) {
return configureFormatterFrom(annotation);
}

Some files were not shown because too many files have changed in this diff Show More