org.springframework.cglib.core.Signature Java Examples

The following examples show how to use org.springframework.cglib.core.Signature. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MethodProxy.java    From spring-analysis-note with MIT License 5 votes vote down vote up
/**
 * For internal use by {@link Enhancer} only; see the {@link org.springframework.cglib.reflect.FastMethod} class
 * for similar functionality.
 */
public static MethodProxy create(Class c1, Class c2, String desc, String name1, String name2) {
	MethodProxy proxy = new MethodProxy();
	proxy.sig1 = new Signature(name1, desc);
	proxy.sig2 = new Signature(name2, desc);
	proxy.createInfo = new CreateInfo(c1, c2);
	return proxy;
}
 
Example #2
Source File: Enhancer.java    From spring-analysis-note with MIT License 5 votes vote down vote up
private void emitConstructors(ClassEmitter ce, List constructors) {
	boolean seenNull = false;
	for (Iterator it = constructors.iterator(); it.hasNext(); ) {
		MethodInfo constructor = (MethodInfo) it.next();
		if (currentData != null && !"()V".equals(constructor.getSignature().getDescriptor())) {
			continue;
		}
		CodeEmitter e = EmitUtils.begin_method(ce, constructor, Constants.ACC_PUBLIC);
		e.load_this();
		e.dup();
		e.load_args();
		Signature sig = constructor.getSignature();
		seenNull = seenNull || sig.getDescriptor().equals("()V");
		e.super_invoke_constructor(sig);
		if (currentData == null) {
			e.invoke_static_this(BIND_CALLBACKS);
			if (!interceptDuringConstruction) {
				e.load_this();
				e.push(1);
				e.putfield(CONSTRUCTED_FIELD);
			}
		}
		e.return_value();
		e.end_method();
	}
	if (!classOnly && !seenNull && arguments == null)
		throw new IllegalArgumentException("Superclass has no null constructors but no arguments were given");
}
 
Example #3
Source File: MethodProxy.java    From java-technology-stack with MIT License 5 votes vote down vote up
/**
 * For internal use by {@link Enhancer} only; see the {@link org.springframework.cglib.reflect.FastMethod} class
 * for similar functionality.
 */
public static MethodProxy create(Class c1, Class c2, String desc, String name1, String name2) {
	MethodProxy proxy = new MethodProxy();
	proxy.sig1 = new Signature(name1, desc);
	proxy.sig2 = new Signature(name2, desc);
	proxy.createInfo = new CreateInfo(c1, c2);
	return proxy;
}
 
Example #4
Source File: Enhancer.java    From java-technology-stack with MIT License 5 votes vote down vote up
private void emitConstructors(ClassEmitter ce, List constructors) {
	boolean seenNull = false;
	for (Iterator it = constructors.iterator(); it.hasNext(); ) {
		MethodInfo constructor = (MethodInfo) it.next();
		if (currentData != null && !"()V".equals(constructor.getSignature().getDescriptor())) {
			continue;
		}
		CodeEmitter e = EmitUtils.begin_method(ce, constructor, Constants.ACC_PUBLIC);
		e.load_this();
		e.dup();
		e.load_args();
		Signature sig = constructor.getSignature();
		seenNull = seenNull || sig.getDescriptor().equals("()V");
		e.super_invoke_constructor(sig);
		if (currentData == null) {
			e.invoke_static_this(BIND_CALLBACKS);
			if (!interceptDuringConstruction) {
				e.load_this();
				e.push(1);
				e.putfield(CONSTRUCTED_FIELD);
			}
		}
		e.return_value();
		e.end_method();
	}
	if (!classOnly && !seenNull && arguments == null)
		throw new IllegalArgumentException("Superclass has no null constructors but no arguments were given");
}
 
Example #5
Source File: MethodProxy.java    From spring-analysis-note with MIT License 4 votes vote down vote up
/**
 * Return the signature of the proxied method.
 */
public Signature getSignature() {
	return sig1;
}
 
Example #6
Source File: Enhancer.java    From spring-analysis-note with MIT License 4 votes vote down vote up
private Signature rename(Signature sig, int index) {
	return new Signature("CGLIB$" + sig.getName() + "$" + index,
			sig.getDescriptor());
}
 
Example #7
Source File: MethodProxy.java    From java-technology-stack with MIT License 4 votes vote down vote up
/**
 * Return the signature of the proxied method.
 */
public Signature getSignature() {
	return sig1;
}
 
Example #8
Source File: Enhancer.java    From java-technology-stack with MIT License 4 votes vote down vote up
private Signature rename(Signature sig, int index) {
	return new Signature("CGLIB$" + sig.getName() + "$" + index,
			sig.getDescriptor());
}