public class ClassFileDeclarationBuilder extends Object implements 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 String |
physicalName |
private TypeDeclaration |
typeDecl |
private 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(String typename) |
boolean |
equals(Object o) |
private List<TypeParameterInfo> |
getAllTypeParameters() |
String |
getClassName()
get the class name of this class.
|
String |
getEnclosingName()
get the fully qualified name of the enclosing class of an inner class
|
String |
getFullClassname()
get the class name stored in the class file.
|
int |
hashCode() |
private static boolean |
isAnononymous(String tys) |
boolean |
isAnonymousClass()
is the considered ClassFile the representation of an anymous class or a class
declared within a program?
This is the case if the last $ is followed by a digit.
|
private boolean |
isEnumConstant(FieldInfo field) |
boolean |
isInnerClass()
is the considered ClassFile the byte code of an inner class?
This is done checking the fully qualified class name.
|
private static boolean |
isInternal(String name) |
CompilationUnit |
makeCompilationUnit()
retrieve the compilation unit for the class file under consideration.
|
static CompilationUnit |
makeEmptyClassDeclaration(ProgramFactory programFactory,
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(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 String |
resolveTypeVariable(String typename,
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(String string) |
String |
toString() |
private ProgramFactory factory
private ClassFile classFile
private String physicalName
private CompilationUnit compilationUnit
private TypeDeclaration typeDecl
private DataLocation dataLocation
private ASTList<MemberDeclaration> memberDecls
private ClassFileDeclarationManager manager
private List<TypeParameterInfo> typeParameters
public ClassFileDeclarationBuilder(ClassFileDeclarationManager manager, ClassFile classFile)
classFile
- class file to be investigatedmanager
- the manager to which this builder belongspublic String getFullClassname()
public 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 String getEnclosingName()
public static CompilationUnit makeEmptyClassDeclaration(ProgramFactory programFactory, 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(String name)
private String resolveTypeVariable(String typename, List<? extends TypeParameter> additionalTypeParameters)
private List<TypeParameterInfo> getAllTypeParameters()
private TypeReference createTypeReference(String typename)
private static boolean isAnononymous(String tys)
private static boolean startsWithADigit(String string)
private static boolean isInternal(String name)
public int compareTo(ClassFileDeclarationBuilder o)
compareTo
in interface Comparable<ClassFileDeclarationBuilder>