ua.gradsoft.javachecker.models
Class JavaTypeModel

java.lang.Object
  extended by ua.gradsoft.javachecker.models.JavaTypeModel
All Implemented Interfaces:
AttributedEntity
Direct Known Subclasses:
JavaArrayTypeModel, JavaClassTypeModel, JavaNullTypeModel, JavaPrimitiveTypeModel, JavaTermTypeAbstractModel, JavaTypeArgumentBoundTypeModel, JavaTypeVariableAbstractModel, JavaUnknownTypeModel, JavaWildcardBoundsTypeModel

public abstract class JavaTypeModel
extends java.lang.Object
implements AttributedEntity

Abstract class for type model of Java Language term

Author:
Ruslan Shevchenko

Method Summary
 JavaMemberVariableModel findMemberVariableModel(java.lang.String name)
           
 java.util.List<JavaMethodModel> findMethodModels(java.lang.String name)
           
 JavaTypeModel findNestedTypeModel(java.lang.String name)
           
 JavaAnnotationInstanceModel getAnnotation(java.lang.String annotationName)
          return annottation instance, if one exists.
abstract  java.util.Map<java.lang.String,JavaAnnotationInstanceModel> getAnnotationsMap()
          get map of annotations, declared in source code.
abstract  Term getASTTerm()
          return AST term, if exoists, otherwise - null
 Term getAttribute(java.lang.String name)
           
 JavaTypeModelAttributes getAttributes()
          return attributes of this model
 AttributesData getAttributesData()
           
 java.lang.String getCanonicalName()
          get canonical name, siutable for use in JVM
 AttributedEntity getChildAttributes(java.lang.String childName)
           
abstract  java.util.List<JavaConstructorModel> getConstructorModels()
          get list of constructor models.
abstract  JavaAnnotationInstanceModel getDefaultAnnotationInstanceModel()
          if this is annotation, get annotation instance model, otherwise return null;
abstract  JavaExpressionModel getDefaultInitializerExpression()
           
abstract  JavaStatementModel getEnclosedStatement()
          if this is local or anonimous class and it is possible to get enclosing statement - return enclosed statement, otherwise - null
abstract  JavaTypeModel getEnclosedType()
          return enclosed class
abstract  java.util.Map<java.lang.String,JavaEnumConstantModel> getEnumConstantModels()
          key of return values are names of enum constants.
 java.lang.String getErasedFullName()
          return full name (i.
abstract  java.lang.String getErasedName()
           
 java.lang.String getFullName()
          return full name (i.
abstract  Term getFullNameAsTerm()
           
abstract  java.util.List<JavaInitializerModel> getInitializerModels()
          get list of initializer models
 JavaFacts getJavaFacts()
           
abstract  java.util.Map<java.lang.String,JavaMemberVariableModel> getMemberVariableModels()
          key of return values are names of member variables.
abstract  java.util.Map<java.lang.String,java.util.List<JavaMethodModel>> getMethodModels()
          key of return values are names of methods.
abstract  Term getModelTerm()
          return TypeModel term.
abstract  JavaModifiersModel getModifiersModel()
          get modifiers moder
abstract  java.lang.String getName()
           
abstract  java.util.Map<java.lang.String,JavaTypeModel> getNestedTypeModels()
           
 JavaPackageModel getPackageModel()
          return model of package
abstract  JavaTypeModel getReferencedType()
          Nullable
abstract  Term getShortNameAsTerm()
           
abstract  JavaTypeModel getSuperClass()
          get superclass.
abstract  java.util.List<JavaTypeModel> getSuperInterfaces()
          get all superinterfaces.
abstract  java.util.List<JavaTypeVariableAbstractModel> getTypeParameters()
          return type parameters.
 JavaUnitModel getUnitModel()
           
 boolean hasAnnotation(java.lang.String annotationTypeName)
          return true, if this type is annotated by annotation with type annotationTypeName, otherwise false
abstract  boolean hasASTTerm()
          return true, if type model have AST Term
abstract  boolean hasMemberVariableModels()
           
abstract  boolean hasMethodModels()
           
abstract  boolean hasNestedTypeModels()
          when return true, getNestedTypeModels() returns set of nested types.
abstract  boolean hasTypeParameters()
          if this type hase type parameters ?
abstract  boolean isAnnotationType()
           
abstract  boolean isAnonimous()
          true, if this is anonimous type.
abstract  boolean isArray()
           
abstract  boolean isClass()
           
abstract  boolean isEnum()
           
abstract  boolean isInterface()
           
abstract  boolean isLocal()
          true, if this is local type
abstract  boolean isNested()
          return true if this type is nested inside some other type.
abstract  boolean isNull()
           
abstract  boolean isPrimitiveType()
           
abstract  boolean isTypeVariable()
           
abstract  boolean isUnknown()
          return true, if this is unknown typemodel.
abstract  boolean isWildcardBounds()
           
 void setAttribute(java.lang.String name, Term value)
           
 void setUnitModel(JavaUnitModel unitModel)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getName

public abstract java.lang.String getName()

getErasedName

public abstract java.lang.String getErasedName()

getShortNameAsTerm

public abstract Term getShortNameAsTerm()
                                 throws TermWareException
Throws:
TermWareException

getFullNameAsTerm

public abstract Term getFullNameAsTerm()
                                throws TermWareException
Throws:
TermWareException

getFullName

public java.lang.String getFullName()
return full name (i. e. with package part).


getErasedFullName

public java.lang.String getErasedFullName()
return full name (i. e. with package part).


getCanonicalName

public java.lang.String getCanonicalName()
get canonical name, siutable for use in JVM


isClass

public abstract boolean isClass()

isInterface

public abstract boolean isInterface()

isEnum

public abstract boolean isEnum()

isAnnotationType

public abstract boolean isAnnotationType()

isPrimitiveType

public abstract boolean isPrimitiveType()

isArray

public abstract boolean isArray()

isTypeVariable

public abstract boolean isTypeVariable()

isWildcardBounds

public abstract boolean isWildcardBounds()

isNull

public abstract boolean isNull()

isUnknown

public abstract boolean isUnknown()
return true, if this is unknown typemodel. (clients of library can create Unknonwn model, when it is not possible to resolve entity, but resolving is not critical in context)


getModifiersModel

public abstract JavaModifiersModel getModifiersModel()
get modifiers moder

Returns:
Modifiers model

getSuperClass

public abstract JavaTypeModel getSuperClass()
                                     throws TermWareException,
                                            EntityNotFoundException
get superclass. does not supported for primitive types, type arguments, wildcard bounds

Throws:
TermWareException
EntityNotFoundException

getSuperInterfaces

public abstract java.util.List<JavaTypeModel> getSuperInterfaces()
                                                          throws TermWareException
get all superinterfaces. does not supported for primitive types, type arguments, wildcard bounds, arrays.

Returns:
all direct superinterfaces.
Throws:
TermWareException

getEnclosedType

public abstract JavaTypeModel getEnclosedType()
                                       throws TermWareException
return enclosed class

Throws:
TermWareException

isLocal

public abstract boolean isLocal()
true, if this is local type


isAnonimous

public abstract boolean isAnonimous()
true, if this is anonimous type.


getReferencedType

public abstract JavaTypeModel getReferencedType()
                                         throws TermWareException
Nullable

Returns:
referenced type. Works only if isArray()==true, otherwise return null.
Throws:
TermWareException

hasMethodModels

public abstract boolean hasMethodModels()
Returns:
true if type has methods.

getMethodModels

public abstract java.util.Map<java.lang.String,java.util.List<JavaMethodModel>> getMethodModels()
key of return values are names of methods. When type is unappropriative for methods (example - TypeVariable) return empty map


findMethodModels

public java.util.List<JavaMethodModel> findMethodModels(java.lang.String name)
                                                 throws EntityNotFoundException
Throws:
EntityNotFoundException

hasMemberVariableModels

public abstract boolean hasMemberVariableModels()

getMemberVariableModels

public abstract java.util.Map<java.lang.String,JavaMemberVariableModel> getMemberVariableModels()
key of return values are names of member variables. When type is unappropriative for methods - return empty map


findMemberVariableModel

public JavaMemberVariableModel findMemberVariableModel(java.lang.String name)
                                                throws EntityNotFoundException
Throws:
EntityNotFoundException

getConstructorModels

public abstract java.util.List<JavaConstructorModel> getConstructorModels()
get list of constructor models.


getInitializerModels

public abstract java.util.List<JavaInitializerModel> getInitializerModels()
get list of initializer models


getEnumConstantModels

public abstract java.util.Map<java.lang.String,JavaEnumConstantModel> getEnumConstantModels()
key of return values are names of enum constants. When type is not enum - return empty map.


getDefaultAnnotationInstanceModel

public abstract JavaAnnotationInstanceModel getDefaultAnnotationInstanceModel()
                                                                       throws TermWareException,
                                                                              EntityNotFoundException
if this is annotation, get annotation instance model, otherwise return null;

Throws:
TermWareException
EntityNotFoundException

isNested

public abstract boolean isNested()
return true if this type is nested inside some other type.


hasNestedTypeModels

public abstract boolean hasNestedTypeModels()
when return true, getNestedTypeModels() returns set of nested types. Otherwise getNestedTypeModels throws NotSupportedException


getNestedTypeModels

public abstract java.util.Map<java.lang.String,JavaTypeModel> getNestedTypeModels()
                                                                           throws TermWareException
Returns:
set of nested types.
Throws:
TermWareException

findNestedTypeModel

public JavaTypeModel findNestedTypeModel(java.lang.String name)
                                  throws EntityNotFoundException,
                                         TermWareException
Throws:
EntityNotFoundException
TermWareException

hasTypeParameters

public abstract boolean hasTypeParameters()
                                   throws TermWareException
if this type hase type parameters ?

Throws:
TermWareException

getTypeParameters

public abstract java.util.List<JavaTypeVariableAbstractModel> getTypeParameters()
                                                                         throws TermWareException
return type parameters. (i. e. for class { ... } definitions are ) in case of absence of type paramters return empty list

Throws:
TermWareException

getEnclosedStatement

public abstract JavaStatementModel getEnclosedStatement()
if this is local or anonimous class and it is possible to get enclosing statement - return enclosed statement, otherwise - null


getPackageModel

public JavaPackageModel getPackageModel()
return model of package


hasAnnotation

public boolean hasAnnotation(java.lang.String annotationTypeName)
                      throws TermWareException
return true, if this type is annotated by annotation with type annotationTypeName, otherwise false

Throws:
TermWareException

getAnnotation

public JavaAnnotationInstanceModel getAnnotation(java.lang.String annotationName)
                                          throws TermWareException
return annottation instance, if one exists. Otherwise - null.

Throws:
TermWareException

getAnnotationsMap

public abstract java.util.Map<java.lang.String,JavaAnnotationInstanceModel> getAnnotationsMap()
                                                                                       throws TermWareException
get map of annotations, declared in source code.

Throws:
TermWareException

hasASTTerm

public abstract boolean hasASTTerm()
return true, if type model have AST Term


getASTTerm

public abstract Term getASTTerm()
                         throws TermWareException,
                                EntityNotFoundException
return AST term, if exoists, otherwise - null

Throws:
TermWareException
EntityNotFoundException

getModelTerm

public abstract Term getModelTerm()
                           throws TermWareException,
                                  EntityNotFoundException
return TypeModel term. TypeModel is a term which have next form: TypeModel( Model-of-ASTTree, PlaceContext )

Throws:
TermWareException
EntityNotFoundException

getDefaultInitializerExpression

public abstract JavaExpressionModel getDefaultInitializerExpression()
                                                             throws TermWareException,
                                                                    EntityNotFoundException
Returns:
default initializer erxpression, if entity is not initialized. (i.e. null for complex types, and so on)
Throws:
TermWareException
EntityNotFoundException

getAttributesData

public AttributesData getAttributesData()
                                 throws TermWareException
Throws:
TermWareException

getAttribute

public Term getAttribute(java.lang.String name)
                  throws TermWareException
Specified by:
getAttribute in interface AttributedEntity
Throws:
TermWareException

setAttribute

public void setAttribute(java.lang.String name,
                         Term value)
                  throws TermWareException
Specified by:
setAttribute in interface AttributedEntity
Throws:
TermWareException

getChildAttributes

public AttributedEntity getChildAttributes(java.lang.String childName)
                                    throws TermWareException
Specified by:
getChildAttributes in interface AttributedEntity
Throws:
TermWareException

getAttributes

public JavaTypeModelAttributes getAttributes()
return attributes of this model


getUnitModel

public JavaUnitModel getUnitModel()

setUnitModel

public void setUnitModel(JavaUnitModel unitModel)

getJavaFacts

public JavaFacts getJavaFacts()