Class ClassFile
java.lang.Object
org.vesalainen.bcc.ClassFile
- All Implemented Interfaces:
AnnotatedConstruct, Element, Parameterizable, QualifiedNameable, TypeElement, Writable
- Direct Known Subclasses:
SubClass
ClassFile wraps java classfile
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected List<AttributeInfo> protected List<ConstantInfo> protected Map<ConstantInfo, Integer> protected Map<Class<? extends ConstantInfo>, List<ConstantInfo>> protected intprotected intprotected List<MethodInfo> protected intprotected PackageElementprotected Nameprivate Nameprotected intprotected TypeElementprivate booleanprotected intprotected ClassFile.ClassTypeprotected Map<String, TypeParameterElement> -
Constructor Summary
ConstructorsModifierConstructorDescriptionClassFile(byte[] bytes) privateClassFile(DataInputStream oin) ClassFile(InputStream in) protectedClassFile(TypeElement superClass, String qualifiedName, Modifier... modifiers) -
Method Summary
Modifier and TypeMethodDescription<R,P> R accept(ElementVisitor<R, P> v, P p) voidAdds a new attributeprivate intprotected intaddConstantInfo(ConstantInfo ci, int fromIndex) protected voidaddFieldInfo(FieldInfo fieldInfo) protected voidaddIndexedElement(int index, Object type) voidaddInterface(short intf) protected voidaddMethodInfo(MethodInfo methodInfo) asType()<A extends Annotation>
AgetAnnotation(Class<A> annotationType) List<? extends AnnotationMirror> <A extends Annotation>
A[]getAnnotationsByType(Class<A> annotationType) getClassDescription(int index) Returns a descriptor to class at index.private final intgetClassIndex(String name) protected final intgetClassIndex(TypeElement type) protected final intfinal intgetConstantIndex(double constant) Returns the constant map index to constantfinal intgetConstantIndex(float constant) Returns the constant map index to constantfinal intgetConstantIndex(int constant) Returns the constant map index to integer constantfinal intgetConstantIndex(long constant) Returns the constant map index to constantfinal intgetConstantIndex(String constant) Returns the constant map index to constantfinal ConstantInfogetConstantInfo(int index) Return constantInfo at index.(package private) intgetFieldDescription(int index) Returns a descriptor to fields at index.(package private) intgetFieldIndex(TypeElement declaringClass, String name, String descriptor) Returns the constant map index to field(package private) intgetFieldIndex(TypeElement declaringClass, String name, TypeMirror type) Returns the constant map index to field(package private) ObjectgetIndexedType(int index) Returns a element from constant mapList<? extends TypeMirror> getKind()getMethodDescription(int index) Returns a descriptor to method at index.(package private) intgetMethodIndex(ExecutableElement method) Returns the constant map index to methodprotected List<MethodInfo> intgetNameAndTypeIndex(String name, String descriptor) Returns the constant map index to name and typeintgetNameIndex(CharSequence name) Returns the constant map index to nameReturns all classnames (in internal form) that this class referencesprotected intgetRefIndex(Class<? extends ConstantInfo.Ref> refType, String fullyQualifiedname, String name, String descriptor) Returns the constant map index to referencefinal StringgetString(int index) Return a constant string at index.List<? extends TypeParameterElement> booleanisImplemented(ExecutableElement method) booleanprivate List<ConstantInfo> listConstantInfo(Class<? extends ConstantInfo> cls) booleanreferencesClass(TypeElement type) booleanreferencesMethod(ExecutableElement method) Return true if class contains method ref to given methodvoidwrite(DataOutput out) Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface TypeElement
getPermittedSubclasses, getRecordComponents
-
Field Details
-
magic
protected int magic -
minor_version
protected int minor_version -
major_version
protected int major_version -
constant_pool
-
this_class
protected int this_class -
super_class
protected int super_class -
interfaces
-
fields
-
methods
-
attributes
-
indexedElementMap
-
constantPoolMap
-
constantPoolIndexMap
-
typeParameterMap
-
superClass
-
modifiers
-
type
-
qualifiedName
-
packageElement
-
enclosedElements
-
simpleName
-
synthetic
private boolean synthetic
-
-
Constructor Details
-
ClassFile
-
ClassFile
- Throws:
IOException
-
ClassFile
- Throws:
IOException
-
ClassFile
- Throws:
IOException
-
ClassFile
- Throws:
IOException
-
ClassFile
- Throws:
IOException
-
-
Method Details
-
getConstantPoolSize
int getConstantPoolSize() -
getFieldIndex
Returns the constant map index to field- Parameters:
declaringClass-name-type-- Returns:
-
getFieldIndex
Returns the constant map index to field- Parameters:
declaringClass-name-descriptor-- Returns:
-
getMethodIndex
Returns the constant map index to method- Parameters:
method-- Returns:
-
getRefIndex
protected int getRefIndex(Class<? extends ConstantInfo.Ref> refType, String fullyQualifiedname, String name, String descriptor) Returns the constant map index to reference- Parameters:
refType-fullyQualifiedname-name-descriptor-- Returns:
-
getNameIndex
Returns the constant map index to name- Parameters:
name-- Returns:
-
getNameAndTypeIndex
-
getConstantIndex
public final int getConstantIndex(int constant) Returns the constant map index to integer constant- Parameters:
constant-- Returns:
-
getConstantIndex
public final int getConstantIndex(float constant) Returns the constant map index to constant- Parameters:
constant-- Returns:
-
getConstantIndex
public final int getConstantIndex(double constant) Returns the constant map index to constant- Parameters:
constant-- Returns:
-
getConstantIndex
public final int getConstantIndex(long constant) Returns the constant map index to constant- Parameters:
constant-- Returns:
-
getConstantIndex
Returns the constant map index to constant- Parameters:
constant-- Returns:
-
addMethodInfo
-
addFieldInfo
-
getFields
-
getMethodInfos
-
getReferencedClassnames
-
addConstantInfo
-
addConstantInfo
-
addIndexedElement
-
listConstantInfo
-
addInterface
public void addInterface(short intf) -
addAttribute
-
getIndexedType
-
getFieldDescription
Returns a descriptor to fields at index.- Parameters:
index-- Returns:
-
getMethodDescription
Returns a descriptor to method at index.- Parameters:
index-- Returns:
-
getClassDescription
Returns a descriptor to class at index.- Parameters:
index-- Returns:
-
isImplemented
-
referencesMethod
Return true if class contains method ref to given method- Parameters:
method-- Returns:
-
referencesClass
-
getClassIndex
-
getClassIndex
-
getClassIndex
-
getConstantInfo
Return constantInfo at index.- Parameters:
index-- Returns:
-
getString
Return a constant string at index.- Parameters:
index-- Returns:
-
isSynthetic
public boolean isSynthetic() -
getQualifiedName
- Specified by:
getQualifiedNamein interfaceQualifiedNameable- Specified by:
getQualifiedNamein interfaceTypeElement
-
getAnnotationMirrors
- Specified by:
getAnnotationMirrorsin interfaceAnnotatedConstruct- Specified by:
getAnnotationMirrorsin interfaceElement
-
getAnnotation
- Specified by:
getAnnotationin interfaceAnnotatedConstruct- Specified by:
getAnnotationin interfaceElement
-
getSuperclass
- Specified by:
getSuperclassin interfaceTypeElement
-
getEnclosedElements
- Specified by:
getEnclosedElementsin interfaceElement- Specified by:
getEnclosedElementsin interfaceTypeElement
-
getNestingKind
- Specified by:
getNestingKindin interfaceTypeElement
-
getSimpleName
- Specified by:
getSimpleNamein interfaceElement- Specified by:
getSimpleNamein interfaceTypeElement
-
getInterfaces
- Specified by:
getInterfacesin interfaceTypeElement
-
getTypeParameters
- Specified by:
getTypeParametersin interfaceParameterizable- Specified by:
getTypeParametersin interfaceTypeElement
-
getEnclosingElement
- Specified by:
getEnclosingElementin interfaceElement- Specified by:
getEnclosingElementin interfaceTypeElement
-
asType
- Specified by:
asTypein interfaceElement- Specified by:
asTypein interfaceTypeElement
-
getKind
-
getModifiers
- Specified by:
getModifiersin interfaceElement
-
accept
-
write
- Specified by:
writein interfaceWritable- Throws:
IOException
-
getAnnotationsByType
- Specified by:
getAnnotationsByTypein interfaceAnnotatedConstruct- Specified by:
getAnnotationsByTypein interfaceElement
-