public class ClassFileDeclarationBuilder extends java.lang.Object implements java.lang.Comparable<ClassFileDeclarationBuilder>
ClassFileDeclarationManager
Modifier and Type | Field and Description |
---|---|
private ClassFile |
classFile |
private CompilationUnit |
compilationUnit |
private DataLocation |
dataLocation |
private ProgramFactory |
factory |
private ClassFileDeclarationManager |
manager |
private ASTList<MemberDeclaration> |
memberDecls |
private java.lang.String |
physicalName |
private TypeDeclaration |
typeDecl |
private java.util.List<TypeParameterInfo> |
typeParameters |
Constructor and Description |
---|
ClassFileDeclarationBuilder(ClassFileDeclarationManager manager,
ClassFile classFile)
create a new ClassDeclaration builder.
|
Modifier and Type | Method and Description |
---|---|
private void |
addConstructor(ConstructorInfo constr) |
private void |
addDefaultConstructor() |
private void |
addEnumConstant(FieldInfo field) |
private void |
addField(FieldInfo field) |
private void |
addMethod(MethodInfo method) |
private void |
addTypeDeclarationToCompUnit() |
void |
attachToEnclosingDeclaration()
If this is a builder for an inner class, the declaration has to be
attached to the enclosing class.
|
int |
compareTo(ClassFileDeclarationBuilder o)
compare to class file declaration builders.
|
private void |
createTypeDeclaration() |
private TypeReference |
createTypeReference(java.lang.String typename) |
boolean |
equals(java.lang.Object o) |
private java.util.List<TypeParameterInfo> |
getAllTypeParameters() |
java.lang.String |
getClassName()
get the class name of this class.
|
java.lang.String |
getEnclosingName()
get the fully qualified name of the enclosing class of an inner class
|
java.lang.String |
getFullClassname()
get the class name stored in the class file.
|
int |
hashCode() |
private static boolean |
isAnononymous(java.lang.String tys) |
boolean |
isAnonymousClass()
is the considered ClassFile the representation of an anymous class or a class
declared within a program?
|
private boolean |
isEnumConstant(FieldInfo field) |
boolean |
isInnerClass()
is the considered ClassFile the byte code of an inner class?
|
private static boolean |
isInternal(java.lang.String name) |
CompilationUnit |
makeCompilationUnit()
retrieve the compilation unit for the class file under consideration.
|
static CompilationUnit |
makeEmptyClassDeclaration(ProgramFactory programFactory,
java.lang.String fullClassName)
make a stub class declaration for a fully qualified type reference.
|
private ASTList<DeclarationSpecifier> |
makeFieldSpecifiers(FieldInfo decl) |
private ASTList<DeclarationSpecifier> |
makeMethodSpecifiers(MethodInfo decl) |
private PackageReference |
makePackageReference(java.lang.String name) |
TypeDeclaration |
makeTypeDeclaration()
retrieve a TypeDeclaration for the class file under consideration
The second and following calls will return the cached value of the
initial calculation.
|
private java.lang.String |
resolveTypeVariable(java.lang.String typename,
java.util.List<? extends TypeParameter> additionalTypeParameters) |
void |
setDataLocation(DataLocation dataLocation)
set the location to be stored in the compilation unit, mainly for
error reporting.
|
private void |
setInheritance() |
private void |
setNameAndMods() |
private void |
setPackage() |
private static boolean |
startsWithADigit(java.lang.String string) |
java.lang.String |
toString() |
private ProgramFactory factory
private ClassFile classFile
private java.lang.String physicalName
private CompilationUnit compilationUnit
private TypeDeclaration typeDecl
private DataLocation dataLocation
private ASTList<MemberDeclaration> memberDecls
private ClassFileDeclarationManager manager
private java.util.List<TypeParameterInfo> typeParameters
public ClassFileDeclarationBuilder(ClassFileDeclarationManager manager, ClassFile classFile)
classFile
- class file to be investigatedmanager
- the manager to which this builder belongspublic java.lang.String getFullClassname()
public java.lang.String getClassName()
public CompilationUnit makeCompilationUnit()
makeTypeDeclaration()
and embeds this type
into a compilation unit.public TypeDeclaration makeTypeDeclaration()
public void setDataLocation(DataLocation dataLocation)
dataLocation
- the DataLocation to be set or nullpublic boolean isInnerClass()
public boolean isAnonymousClass()
public void attachToEnclosingDeclaration()
public java.lang.String getEnclosingName()
public static CompilationUnit makeEmptyClassDeclaration(ProgramFactory programFactory, java.lang.String fullClassName) throws ParserException
programFactory
- factory to use as parserfullClassName
- the fully qualified type nameParserException
- thrown by the parserprivate void createTypeDeclaration()
private void addTypeDeclarationToCompUnit()
private void setNameAndMods()
private void setInheritance()
private void setPackage()
private ASTList<DeclarationSpecifier> makeFieldSpecifiers(FieldInfo decl)
private boolean isEnumConstant(FieldInfo field)
private void addField(FieldInfo field)
private void addEnumConstant(FieldInfo field)
private ASTList<DeclarationSpecifier> makeMethodSpecifiers(MethodInfo decl)
private void addMethod(MethodInfo method)
private void addDefaultConstructor()
private void addConstructor(ConstructorInfo constr)
private PackageReference makePackageReference(java.lang.String name)
private java.lang.String resolveTypeVariable(java.lang.String typename, java.util.List<? extends TypeParameter> additionalTypeParameters)
private java.util.List<TypeParameterInfo> getAllTypeParameters()
private TypeReference createTypeReference(java.lang.String typename)
private static boolean isAnononymous(java.lang.String tys)
private static boolean startsWithADigit(java.lang.String string)
private static boolean isInternal(java.lang.String name)
public java.lang.String toString()
toString
in class java.lang.Object
public int compareTo(ClassFileDeclarationBuilder o)
compareTo
in interface java.lang.Comparable<ClassFileDeclarationBuilder>
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object