Whitespace and license polish
This commit is contained in:
parent
a2c87ae67a
commit
dc191bec2d
|
|
@ -113,12 +113,12 @@ public abstract class AbstractConfigurationClassProcessor {
|
|||
// populate a new ConfigurationModel by parsing each @Configuration classes
|
||||
ConfigurationParser parser = createConfigurationParser();
|
||||
|
||||
for(String beanName : configBeanDefs.getBeanDefinitionNames()) {
|
||||
BeanDefinition beanDef = configBeanDefs.getBeanDefinition(beanName);
|
||||
String className = beanDef.getBeanClassName();
|
||||
for(String beanName : configBeanDefs.getBeanDefinitionNames()) {
|
||||
BeanDefinition beanDef = configBeanDefs.getBeanDefinition(beanName);
|
||||
String className = beanDef.getBeanClassName();
|
||||
|
||||
parser.parse(className, beanName);
|
||||
}
|
||||
parser.parse(className, beanName);
|
||||
}
|
||||
|
||||
ConfigurationModel configModel = parser.getConfigurationModel();
|
||||
|
||||
|
|
@ -126,7 +126,7 @@ public abstract class AbstractConfigurationClassProcessor {
|
|||
validateModel(configModel);
|
||||
|
||||
// read the model and create bean definitions based on its content
|
||||
return new ConfigurationModelBeanDefinitionReader().loadBeanDefinitions(configModel);
|
||||
}
|
||||
return new ConfigurationModelBeanDefinitionReader().loadBeanDefinitions(configModel);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,8 +53,8 @@ class AddAnnotationAdapter extends ClassAdapter {
|
|||
* Ensures that the version of the resulting class is Java 5 or better.
|
||||
*/
|
||||
@Override
|
||||
public void visit(int version, int access, String name, String signature, String superName,
|
||||
String[] interfaces) {
|
||||
public void visit(int version, int access, String name, String signature,
|
||||
String superName, String[] interfaces) {
|
||||
int v = (version & 0xFF) < Constants.V1_5 ? Constants.V1_5 : version;
|
||||
cv.visit(v, access, name, signature, superName, interfaces);
|
||||
}
|
||||
|
|
@ -83,8 +83,7 @@ class AddAnnotationAdapter extends ClassAdapter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public MethodVisitor visitMethod(int access, String name, String desc, String signature,
|
||||
String[] exceptions) {
|
||||
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
|
||||
addAnnotation();
|
||||
return cv.visitMethod(access, name, desc, signature, exceptions);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -109,8 +109,6 @@ class AsmUtils {
|
|||
*
|
||||
* @param bytes byte array that will be provided as input to the new ClassReader
|
||||
* instance.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static ClassReader newClassReader(byte[] bytes) {
|
||||
return new ClassReader(bytes);
|
||||
|
|
@ -129,8 +127,7 @@ class AsmUtils {
|
|||
try {
|
||||
return new ClassReader(is);
|
||||
} catch (IOException ex) {
|
||||
throw new RuntimeException("An unexpected exception occurred while creating ASM ClassReader: "
|
||||
+ ex);
|
||||
throw new RuntimeException("An unexpected exception occurred while creating ASM ClassReader: " + ex);
|
||||
} finally {
|
||||
try {
|
||||
is.close();
|
||||
|
|
|
|||
|
|
@ -1,3 +1,18 @@
|
|||
/*
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.config.java.support;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -140,8 +140,8 @@ final class BeanMethod {
|
|||
@Override
|
||||
public String toString() {
|
||||
String returnTypeName = returnType == null ? "<unknown>" : returnType.getSimpleName();
|
||||
return String.format("%s: name=%s; returnType=%s; modifiers=%d", getClass().getSimpleName(), name,
|
||||
returnTypeName, modifiers);
|
||||
return format("%s: name=%s; returnType=%s; modifiers=%d",
|
||||
getClass().getSimpleName(), name, returnTypeName, modifiers);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -187,24 +187,24 @@ final class BeanMethod {
|
|||
/** {@link Bean} methods must be non-private in order to accommodate CGLIB. */
|
||||
public class PrivateMethodError extends Problem {
|
||||
public PrivateMethodError() {
|
||||
super(format("method '%s' may not be private", getName()), new Location(new FileSystemResource("/dev/null")));
|
||||
super(format("method '%s' may not be private", getName()),
|
||||
new Location(new FileSystemResource("/dev/null")));
|
||||
}
|
||||
}
|
||||
|
||||
/** {@link Bean} methods must be non-final in order to accommodate CGLIB. */
|
||||
public class FinalMethodError extends Problem {
|
||||
public FinalMethodError() {
|
||||
super(format("method '%s' may not be final. remove the final modifier to continue", getName()), new Location(new FileSystemResource("/dev/null")));
|
||||
super(format("method '%s' may not be final. remove the final modifier to continue", getName()),
|
||||
new Location(new FileSystemResource("/dev/null")));
|
||||
}
|
||||
}
|
||||
|
||||
public class InvalidScopedProxyDeclarationError extends Problem {
|
||||
public InvalidScopedProxyDeclarationError(BeanMethod method) {
|
||||
super(
|
||||
String.format("method %s contains an invalid annotation declaration: scoped proxies "
|
||||
+ "cannot be created for singleton/prototype beans", method.getName()),
|
||||
new Location(new FileSystemResource("/dev/null"))
|
||||
);
|
||||
super(format("method %s contains an invalid annotation declaration: scoped proxies "
|
||||
+ "cannot be created for singleton/prototype beans", method.getName()),
|
||||
new Location(new FileSystemResource("/dev/null")));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,8 +83,8 @@ class BeanMethodInterceptor implements BeanFactoryAware, MethodInterceptor {
|
|||
// we have an already existing cached instance of this bean -> retrieve it
|
||||
Object cachedBean = beanFactory.getBean(beanName);
|
||||
if (log.isInfoEnabled())
|
||||
log.info(format("Returning cached singleton object [%s] for @Bean method %s.%s", cachedBean,
|
||||
method.getDeclaringClass().getSimpleName(), beanName));
|
||||
log.info(format("Returning cached singleton object [%s] for @Bean method %s.%s",
|
||||
cachedBean, method.getDeclaringClass().getSimpleName(), beanName));
|
||||
|
||||
return cachedBean;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,18 @@
|
|||
/*
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.config.java.support;
|
||||
|
||||
import static java.lang.String.*;
|
||||
|
|
@ -24,8 +39,6 @@ import org.springframework.core.annotation.AnnotationUtils;
|
|||
import org.springframework.util.Assert;
|
||||
|
||||
|
||||
// TODO: SJC-242 document BeanHandler
|
||||
// TODO: SJC-242 make package-private
|
||||
class BeanRegistrar implements BeanDefinitionRegistrar {
|
||||
|
||||
private static final Log logger = LogFactory.getLog(BeanRegistrar.class);
|
||||
|
|
@ -41,7 +54,6 @@ class BeanRegistrar implements BeanDefinitionRegistrar {
|
|||
return AnnotationUtils.findAnnotation(method, Bean.class) != null;
|
||||
}
|
||||
|
||||
// TODO: SJC-242 method too long
|
||||
public void register(BeanMethod method, BeanDefinitionRegistry registry) {
|
||||
RootBeanDefinition beanDef = new ConfigurationClassBeanDefinition();
|
||||
|
||||
|
|
@ -119,7 +131,7 @@ class BeanRegistrar implements BeanDefinitionRegistrar {
|
|||
// is this method annotated with @Scope(scopedProxy=...)?
|
||||
if (scope != null && scope.proxyMode() != ScopedProxyMode.NO) {
|
||||
RootBeanDefinition targetDef = beanDef;
|
||||
//
|
||||
|
||||
// Create a scoped proxy definition for the original bean name,
|
||||
// "hiding" the target bean in an internal target definition.
|
||||
String targetBeanName = resolveHiddenScopedProxyBeanName(beanName);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -15,7 +15,6 @@
|
|||
*/
|
||||
package org.springframework.config.java.support;
|
||||
|
||||
|
||||
import static java.lang.String.*;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
|
|
@ -147,7 +146,6 @@ final class ConfigurationClass extends ModelClass {
|
|||
return this;
|
||||
}
|
||||
|
||||
|
||||
public ConfigurationClass setDeclaringClass(ConfigurationClass configurationClass) {
|
||||
this.declaringClass = configurationClass;
|
||||
return this;
|
||||
|
|
@ -190,7 +188,6 @@ final class ConfigurationClass extends ModelClass {
|
|||
method.validate(problemReporter);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return format("%s; modifiers=%d; methods=%s", super.toString(), modifiers, methods);
|
||||
|
|
@ -252,23 +249,22 @@ final class ConfigurationClass extends ModelClass {
|
|||
/** Configuration classes must be annotated with {@link Configuration @Configuration}. */
|
||||
public class NonAnnotatedConfigurationError extends Problem {
|
||||
public NonAnnotatedConfigurationError() {
|
||||
super(
|
||||
format("%s was provided as a Java Configuration class but was not annotated with @%s. "
|
||||
+ "Update the class definition to continue.", getSimpleName(), Configuration.class
|
||||
.getSimpleName()),
|
||||
new Location(new FileSystemResource("/dev/null"))
|
||||
super(format("%s was provided as a Java Configuration class but was not annotated with @%s. "
|
||||
+ "Update the class definition to continue.",
|
||||
getSimpleName(), Configuration.class.getSimpleName()),
|
||||
new Location(new FileSystemResource("/dev/null"))
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/** Configuration classes must be non-final to accommodate CGLIB subclassing. */
|
||||
public class FinalConfigurationError extends Problem {
|
||||
public FinalConfigurationError() {
|
||||
super(
|
||||
format("@%s class may not be final. Remove the final modifier to continue.",
|
||||
Configuration.class.getSimpleName()),
|
||||
new Location(new FileSystemResource("/dev/null"))
|
||||
super(format("@%s class may not be final. Remove the final modifier to continue.",
|
||||
Configuration.class.getSimpleName()),
|
||||
new Location(new FileSystemResource("/dev/null"))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -60,7 +60,7 @@ class ConfigurationClassMethodVisitor extends MethodAdapter {
|
|||
* @param modifiers modifiers for this method
|
||||
*/
|
||||
public ConfigurationClassMethodVisitor(ConfigurationClass configClass, String methodName,
|
||||
String methodDescriptor, int modifiers, ClassLoader classLoader) {
|
||||
String methodDescriptor, int modifiers, ClassLoader classLoader) {
|
||||
super(AsmUtils.EMPTY_VISITOR);
|
||||
|
||||
this.configClass = configClass;
|
||||
|
|
@ -133,12 +133,12 @@ class ConfigurationClassMethodVisitor extends MethodAdapter {
|
|||
|
||||
// detect whether the return type is an interface
|
||||
newClassReader(convertClassNameToResourcePath(returnType.getName()), classLoader).accept(
|
||||
new ClassAdapter(AsmUtils.EMPTY_VISITOR) {
|
||||
@Override
|
||||
public void visit(int arg0, int arg1, String arg2, String arg3, String arg4, String[] arg5) {
|
||||
returnType.setInterface((arg1 & Opcodes.ACC_INTERFACE) == Opcodes.ACC_INTERFACE);
|
||||
}
|
||||
}, false);
|
||||
new ClassAdapter(AsmUtils.EMPTY_VISITOR) {
|
||||
@Override
|
||||
public void visit(int arg0, int arg1, String arg2, String arg3, String arg4, String[] arg5) {
|
||||
returnType.setInterface((arg1 & Opcodes.ACC_INTERFACE) == Opcodes.ACC_INTERFACE);
|
||||
}
|
||||
}, false);
|
||||
|
||||
return returnType;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -161,8 +161,8 @@ public class ConfigurationClassPostProcessor extends AbstractConfigurationClassP
|
|||
String enhancedClassName = enhancer.enhance(configClassName);
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug(format("Replacing bean definition '%s' existing class name '%s' with enhanced class name '%s'",
|
||||
beanName, configClassName, enhancedClassName));
|
||||
logger.debug(format("Replacing bean definition '%s' existing class name '%s' "
|
||||
+ "with enhanced class name '%s'", beanName, configClassName, enhancedClassName));
|
||||
|
||||
beanDef.setBeanClassName(enhancedClassName);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -22,8 +22,6 @@ import static org.springframework.util.ClassUtils.*;
|
|||
import java.lang.annotation.Annotation;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.objectweb.asm.AnnotationVisitor;
|
||||
import org.objectweb.asm.ClassAdapter;
|
||||
import org.objectweb.asm.ClassReader;
|
||||
|
|
@ -40,7 +38,6 @@ import org.springframework.config.java.Configuration;
|
|||
*/
|
||||
class ConfigurationClassVisitor extends ClassAdapter {
|
||||
|
||||
private static final Log log = LogFactory.getLog(ConfigurationClassVisitor.class);
|
||||
private static final String OBJECT_DESC = convertClassNameToResourcePath(Object.class.getName());
|
||||
|
||||
private final ConfigurationClass configClass;
|
||||
|
|
@ -63,15 +60,16 @@ class ConfigurationClassVisitor extends ClassAdapter {
|
|||
|
||||
@Override
|
||||
public void visitSource(String sourceFile, String debug) {
|
||||
String resourcePath = convertClassNameToResourcePath(configClass.getName()).substring(0,
|
||||
configClass.getName().lastIndexOf('.') + 1).concat(sourceFile);
|
||||
String resourcePath =
|
||||
convertClassNameToResourcePath(configClass.getName())
|
||||
.substring(0, configClass.getName().lastIndexOf('.') + 1).concat(sourceFile);
|
||||
|
||||
configClass.setSource(resourcePath);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visit(int classVersion, int modifiers, String classTypeDesc, String arg3,
|
||||
String superTypeDesc, String[] arg5) {
|
||||
String superTypeDesc, String[] arg5) {
|
||||
visitSuperType(superTypeDesc);
|
||||
|
||||
configClass.setName(convertResourcePathToClassName(classTypeDesc));
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -67,9 +67,10 @@ class ConfigurationEnhancer {
|
|||
if (iter.next().accepts(candidateMethod))
|
||||
return i;
|
||||
|
||||
throw new IllegalStateException(format("No registrar is capable of "
|
||||
+ "handling method [%s]. Perhaps you forgot to add a catch-all registrar?",
|
||||
candidateMethod.getName()));
|
||||
throw new IllegalStateException(
|
||||
format("No registrar is capable of handling method [%s]. "
|
||||
+ "Perhaps you forgot to add a catch-all registrar?",
|
||||
candidateMethod.getName()));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -98,10 +99,9 @@ class ConfigurationEnhancer {
|
|||
});
|
||||
callbackInstances.add(new MethodInterceptor() {
|
||||
|
||||
public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy)
|
||||
throws Throwable {
|
||||
return null;
|
||||
}
|
||||
public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy) throws Throwable {
|
||||
return null;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
|
@ -127,8 +127,8 @@ class ConfigurationEnhancer {
|
|||
subclass = nestOneClassDeeperIfAspect(superclass, subclass);
|
||||
|
||||
if (log.isInfoEnabled())
|
||||
log.info(format("Successfully enhanced %s; enhanced class name is: %s", configClassName, subclass
|
||||
.getName()));
|
||||
log.info(format("Successfully enhanced %s; enhanced class name is: %s",
|
||||
configClassName, subclass.getName()));
|
||||
|
||||
return subclass.getName();
|
||||
}
|
||||
|
|
@ -193,8 +193,7 @@ class ConfigurationEnhancer {
|
|||
@Override
|
||||
protected byte[] transform(byte[] b) throws Exception {
|
||||
ClassWriter writer = new ClassWriter(false);
|
||||
ClassAdapter adapter = new AddAnnotationAdapter(writer,
|
||||
"Lorg/aspectj/lang/annotation/Aspect;");
|
||||
ClassAdapter adapter = new AddAnnotationAdapter(writer, "Lorg/aspectj/lang/annotation/Aspect;");
|
||||
ClassReader reader = new ClassReader(b);
|
||||
reader.accept(adapter, false);
|
||||
return writer.toByteArray();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -26,7 +26,6 @@ import org.springframework.config.java.Configuration;
|
|||
import org.springframework.core.io.FileSystemResource;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* An abstract representation of a set of user-provided "Configuration classes", usually but
|
||||
* not necessarily annotated with {@link Configuration @Configuration}. The model is
|
||||
|
|
@ -163,11 +162,9 @@ final class ConfigurationModel {
|
|||
|
||||
public class EmptyModelError extends Problem {
|
||||
public EmptyModelError() {
|
||||
super(
|
||||
format("Configuration model was empty. Make sure at least one "
|
||||
+ "@%s class has been specified.", Configuration.class.getSimpleName()),
|
||||
new Location(new FileSystemResource("/dev/null"))
|
||||
);
|
||||
super(format("Configuration model was empty. Make sure at least one "
|
||||
+ "@%s class has been specified.", Configuration.class.getSimpleName()),
|
||||
new Location(new FileSystemResource("/dev/null")));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -69,8 +69,7 @@ class ConfigurationModelBeanDefinitionReader {
|
|||
|
||||
/**
|
||||
* Reads a particular {@link ConfigurationClass}, registering bean definitions for the
|
||||
* class itself, all its {@link Bean} methods and all its {@link Extension}
|
||||
* annotations.
|
||||
* class itself, all its {@link Bean} methods
|
||||
*/
|
||||
private void loadBeanDefinitionsForConfigurationClass(ConfigurationClass configClass) {
|
||||
doLoadBeanDefinitionForConfigurationClass(configClass);
|
||||
|
|
@ -90,18 +89,6 @@ class ConfigurationModelBeanDefinitionReader {
|
|||
*/
|
||||
private void doLoadBeanDefinitionForConfigurationClass(ConfigurationClass configClass) {
|
||||
|
||||
// TODO: prune support for @Required
|
||||
// Configuration metadata = configClass.getMetadata();
|
||||
// if (metadata.checkRequired() == true) {
|
||||
// RootBeanDefinition requiredAnnotationPostProcessor = new RootBeanDefinition();
|
||||
// Class<?> beanClass = RequiredAnnotationBeanPostProcessor.class;
|
||||
// String beanName = beanClass.getName() + "#0";
|
||||
// requiredAnnotationPostProcessor.setBeanClass(beanClass);
|
||||
// requiredAnnotationPostProcessor
|
||||
// .setResourceDescription("ensures @Required methods have been invoked");
|
||||
// registry.registerBeanDefinition(beanName, requiredAnnotationPostProcessor);
|
||||
// }
|
||||
|
||||
GenericBeanDefinition configBeanDef = new GenericBeanDefinition();
|
||||
configBeanDef.setBeanClassName(configClass.getName());
|
||||
|
||||
|
|
@ -111,11 +98,9 @@ class ConfigurationModelBeanDefinitionReader {
|
|||
// and potentially has PropertyValues and ConstructorArgs)
|
||||
if (registry.containsBeanDefinition(configBeanName)) {
|
||||
if (log.isInfoEnabled())
|
||||
log.info(format(
|
||||
"Copying property and constructor arg values from existing bean definition for "
|
||||
+ "@Configuration class %s to new bean definition", configBeanName));
|
||||
AbstractBeanDefinition existing =
|
||||
(AbstractBeanDefinition) registry.getBeanDefinition(configBeanName);
|
||||
log.info(format("Copying property and constructor arg values from existing bean definition for "
|
||||
+ "@Configuration class %s to new bean definition", configBeanName));
|
||||
AbstractBeanDefinition existing = (AbstractBeanDefinition) registry.getBeanDefinition(configBeanName);
|
||||
configBeanDef.setPropertyValues(existing.getPropertyValues());
|
||||
configBeanDef.setConstructorArgumentValues(existing.getConstructorArgumentValues());
|
||||
configBeanDef.setResource(existing.getResource());
|
||||
|
|
@ -127,14 +112,12 @@ class ConfigurationModelBeanDefinitionReader {
|
|||
registry.registerBeanDefinition(configBeanName, configBeanDef);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reads a particular {@link BeanMethod}, registering bean definitions with
|
||||
* {@link #registry} based on its contents.
|
||||
*/
|
||||
private void loadBeanDefinitionsForModelMethod(BeanMethod method) {
|
||||
new BeanRegistrar().register(method, registry);
|
||||
//method.getRegistrar().register(method, registry);
|
||||
}
|
||||
|
||||
// @SuppressWarnings("unchecked")
|
||||
|
|
@ -170,5 +153,4 @@ class ConfigurationModelBeanDefinitionReader {
|
|||
// }
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -76,7 +76,7 @@ public class ConfigurationParser {
|
|||
}
|
||||
|
||||
public ConfigurationModel getConfigurationModel() {
|
||||
return model;
|
||||
}
|
||||
return model;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -27,7 +27,6 @@ import org.springframework.util.ClassUtils;
|
|||
*
|
||||
* @author Chris Beams
|
||||
*/
|
||||
// TODO: Consider eliminating in favor of just ConfigurationClass
|
||||
class ModelClass implements BeanMetadataElement {
|
||||
|
||||
private String name;
|
||||
|
|
@ -161,3 +160,5 @@ class ModelClass implements BeanMetadataElement {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
// TODO: Consider eliminating in favor of just ConfigurationClass
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -22,16 +22,11 @@ import java.lang.annotation.Annotation;
|
|||
import java.lang.reflect.Array;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.objectweb.asm.AnnotationVisitor;
|
||||
|
||||
|
||||
/** TODO: JAVADOC */
|
||||
class MutableAnnotationArrayVisitor extends AnnotationAdapter {
|
||||
|
||||
private static final Log log = LogFactory.getLog(MutableAnnotationArrayVisitor.class);
|
||||
|
||||
private final ArrayList<Object> values = new ArrayList<Object>();
|
||||
private final MutableAnnotation mutableAnno;
|
||||
private final String attribName;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -30,7 +30,6 @@ import org.springframework.util.ReflectionUtils;
|
|||
import org.springframework.util.StringUtils;
|
||||
|
||||
|
||||
/** TODO: JAVADOC */
|
||||
final class MutableAnnotationInvocationHandler implements InvocationHandler {
|
||||
|
||||
private final Class<? extends Annotation> annoType;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -19,7 +19,6 @@ import java.lang.annotation.Annotation;
|
|||
import java.lang.reflect.Proxy;
|
||||
|
||||
|
||||
/** TODO: JAVADOC */
|
||||
class MutableAnnotationUtils {
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -21,8 +21,6 @@ import static org.springframework.config.java.support.Util.*;
|
|||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.objectweb.asm.AnnotationVisitor;
|
||||
import org.objectweb.asm.Type;
|
||||
import org.springframework.util.Assert;
|
||||
|
|
@ -33,8 +31,6 @@ import org.springframework.util.Assert;
|
|||
*/
|
||||
class MutableAnnotationVisitor implements AnnotationVisitor {
|
||||
|
||||
private static final Log log = LogFactory.getLog(MutableAnnotationVisitor.class);
|
||||
|
||||
protected final MutableAnnotation mutableAnno;
|
||||
|
||||
private final ClassLoader classLoader;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,18 @@
|
|||
/*
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.config.java.support;
|
||||
|
||||
import static java.lang.String.*;
|
||||
|
|
@ -20,10 +35,6 @@ import sun.security.x509.Extension;
|
|||
*
|
||||
* @author Chris Beams
|
||||
*/
|
||||
// TODO: SJC-242 general - check cycles with s101
|
||||
// TODO: SJC-242 general - check tabs & spaces
|
||||
// TODO: SJC-242 general - check apache header
|
||||
// TODO: SJC-242 rename, repackage, document
|
||||
class Util {
|
||||
|
||||
private static final Log log = LogFactory.getLog(Util.class);
|
||||
|
|
@ -158,8 +169,8 @@ class Util {
|
|||
InputStream is = classLoader.getResourceAsStream(classFileName);
|
||||
|
||||
if (is == null)
|
||||
throw new RuntimeException(new FileNotFoundException("Class file [" + classFileName
|
||||
+ "] not found"));
|
||||
throw new RuntimeException(
|
||||
new FileNotFoundException("Class file [" + classFileName + "] not found"));
|
||||
|
||||
return is;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue