org.pure4j.model.ConstructorHandle Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pure4j-checker Show documentation
Show all versions of pure4j-checker Show documentation
Parses Byte-code to check the purity semantics defined using pure4j-core annotations
The newest version!
package org.pure4j.model;
import java.lang.annotation.Annotation;
import java.lang.reflect.Constructor;
public class ConstructorHandle extends MemberHandle implements ImplementationHandle {
public ConstructorHandle(Constructor> c) {
super(convertClassName(c.getDeclaringClass()), "", Type.getConstructorDescriptor(c), 0);
}
public ConstructorHandle(String className, String desc, int line) {
super(className, "", desc, line);
}
public Constructor> hydrate(ClassLoader cl) {
return hydrateConstructor(this, cl);
}
public Class> hydrateClass(ClassLoader cl) {
return hydrateClass(className, cl);
}
public String getDeclaringClass() {
return className;
}
public T getAnnotation(ClassLoader cl, Class c) {
Constructor> con = hydrate(cl);
return con.getAnnotation(c);
}
@Override
public Class> getDeclaringClass(ClassLoader cl) {
return hydrateClass(cl);
}
@Override
public java.lang.reflect.Type[] getGenericTypes(ClassLoader cl) {
return hydrate(cl).getGenericParameterTypes();
}
public Class>[] getRawTypes(ClassLoader cl) {
return hydrate(cl).getParameterTypes();
}
@Override
public int getModifiers(ClassLoader cl) {
return hydrate(cl).getModifiers();
}
}