ua.gradsoft.javachecker.models
Class JavaTypeArgumentBoundTypeModel

java.lang.Object
  extended by ua.gradsoft.javachecker.models.JavaTypeModel
      extended by ua.gradsoft.javachecker.models.JavaTypeArgumentBoundTypeModel
All Implemented Interfaces:
AttributedEntity

public class JavaTypeArgumentBoundTypeModel
extends JavaTypeModel

Author:
Ruslan Shevchenko

Constructor Summary
JavaTypeArgumentBoundTypeModel(JavaTypeModel origin, JavaTypeArgumentsSubstitution substitution, JavaTypeModel where)
           
JavaTypeArgumentBoundTypeModel(JavaTypeModel origin, java.util.List<JavaTypeModel> resolvedTypeArguments, JavaTypeModel where)
          Creates a new instance of JavaTypeArgumentBoundTypeModel
JavaTypeArgumentBoundTypeModel(JavaTypeModel origin, Term typeArguments, JavaTypeModel where, java.util.List<JavaTypeVariableAbstractModel> typeVariables, JavaStatementModel statement)
          Creates a new instance of JavaTypeArgumentBoundTypeModel
JavaTypeArgumentBoundTypeModel(JavaTypeModel origin, Term typeArguments, JavaUnitModel unitModel, JavaPackageModel packageModel, java.util.List<JavaTypeVariableAbstractModel> typeVariables)
          Creates a new instance of JavaTypeArgumentBoundTypeModel
 
Method Summary
 void createTermTypeArguments(java.util.List<JavaTypeModel> resolvedTypes)
           
 JavaAnnotationInstanceModel getAnnotation(java.lang.String annotationName)
          return annottation instance, if one exists.
 java.util.Map<java.lang.String,JavaAnnotationInstanceModel> getAnnotationsMap()
          get map of annotations, declared in source code.
 Term getASTTerm()
          return AST term, if exoists, otherwise - null
 JavaTypeModelAttributes getAttributes()
          return attributes of this model
 java.util.List<JavaConstructorModel> getConstructorModels()
          get list of constructor models.
 JavaAnnotationInstanceModel getDefaultAnnotationInstanceModel()
          if this is annotation - get DefaultAnnotationInstance, otherwise - return null In our case emulate behaviour of origin.
 JavaExpressionModel getDefaultInitializerExpression()
           
 JavaStatementModel getEnclosedStatement()
          if this is local or anonimous class and it is possible to get enclosing statement - return enclosed statement, otherwise - null
 JavaTypeModel getEnclosedType()
          return enclosed class
 java.util.Map<java.lang.String,JavaEnumConstantModel> getEnumConstantModels()
          key of return values are names of enum constants.
 java.lang.String getErasedName()
           
 Term getFullNameAsTerm()
           
 java.util.List<JavaInitializerModel> getInitializerModels()
          get list of initializer models
 java.util.Map<java.lang.String,JavaMemberVariableModel> getMemberVariableModels()
          key of return values are names of member variables.
 java.util.Map<java.lang.String,java.util.List<JavaMethodModel>> getMethodModels()
          key of return values are names of methods.
 Term getModelTerm()
          TypeArgumentBoundTypeModel(ClassOrInterfaceType(originModel,list(typeModels)),placeContext)
 JavaModifiersModel getModifiersModel()
          get modifiers moder
 java.lang.String getName()
           
 java.util.Map<java.lang.String,JavaTypeModel> getNestedTypeModels()
           
 JavaTypeModel getOrigin()
           
 JavaTypeModel getReferencedType()
          Nullable
 java.util.List<JavaTypeModel> getResolvedTypeArguments()
           
 Term getShortNameAsTerm()
           
 JavaTypeArgumentsSubstitution getSubstitution()
           
 JavaTypeModel getSuperClass()
          get superclass.
 java.util.List<JavaTypeModel> getSuperInterfaces()
          get all superinterfaces.
 Term getTypeArguments()
           
 java.util.List<JavaTypeVariableAbstractModel> getTypeParameters()
          all parameters of origin types are bound.
 JavaTypeModel getWhere()
           
 boolean hasAnnotation(java.lang.String annotationName)
          return true, if this type is annotated by annotation with type annotationTypeName, otherwise false
 boolean hasASTTerm()
          return true, if type model have AST Term
 boolean hasMemberVariableModels()
           
 boolean hasMethodModels()
           
 boolean hasNestedTypeModels()
          when return true, getNestedTypeModels() returns set of nested types.
 boolean hasTypeParameters()
          if this type hase type parameters ?
 boolean isAnnotationType()
           
 boolean isAnonimous()
          true, if this is anonimous type.
 boolean isArray()
           
 boolean isClass()
           
 boolean isEnum()
           
 boolean isInterface()
           
 boolean isLocal()
          true, if this is local type
 boolean isNested()
          return true if this type is nested inside some other type.
 boolean isNull()
           
 boolean isPrimitiveType()
           
 boolean isTypeVariable()
           
 boolean isUnknown()
          return true, if this is unknown typemodel.
 boolean isWildcardBounds()
           
 JavaTypeModel resolveTypeParameter(java.lang.String name)
           
 
Methods inherited from class ua.gradsoft.javachecker.models.JavaTypeModel
findMemberVariableModel, findMethodModels, findNestedTypeModel, getAttribute, getAttributesData, getCanonicalName, getChildAttributes, getErasedFullName, getFullName, getJavaFacts, getPackageModel, getUnitModel, setAttribute, setUnitModel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JavaTypeArgumentBoundTypeModel

public JavaTypeArgumentBoundTypeModel(JavaTypeModel origin,
                                      Term typeArguments,
                                      JavaTypeModel where,
                                      java.util.List<JavaTypeVariableAbstractModel> typeVariables,
                                      JavaStatementModel statement)
                               throws TermWareException
Creates a new instance of JavaTypeArgumentBoundTypeModel

Throws:
TermWareException

JavaTypeArgumentBoundTypeModel

public JavaTypeArgumentBoundTypeModel(JavaTypeModel origin,
                                      Term typeArguments,
                                      JavaUnitModel unitModel,
                                      JavaPackageModel packageModel,
                                      java.util.List<JavaTypeVariableAbstractModel> typeVariables)
                               throws TermWareException
Creates a new instance of JavaTypeArgumentBoundTypeModel

Throws:
TermWareException

JavaTypeArgumentBoundTypeModel

public JavaTypeArgumentBoundTypeModel(JavaTypeModel origin,
                                      java.util.List<JavaTypeModel> resolvedTypeArguments,
                                      JavaTypeModel where)
                               throws TermWareException
Creates a new instance of JavaTypeArgumentBoundTypeModel

Throws:
TermWareException

JavaTypeArgumentBoundTypeModel

public JavaTypeArgumentBoundTypeModel(JavaTypeModel origin,
                                      JavaTypeArgumentsSubstitution substitution,
                                      JavaTypeModel where)
                               throws TermWareException
Throws:
TermWareException
Method Detail

getName

public java.lang.String getName()
Specified by:
getName in class JavaTypeModel

getErasedName

public java.lang.String getErasedName()
Specified by:
getErasedName in class JavaTypeModel

getShortNameAsTerm

public Term getShortNameAsTerm()
                        throws TermWareException
Specified by:
getShortNameAsTerm in class JavaTypeModel
Throws:
TermWareException

getFullNameAsTerm

public Term getFullNameAsTerm()
                       throws TermWareException
Specified by:
getFullNameAsTerm in class JavaTypeModel
Throws:
TermWareException

getModifiersModel

public JavaModifiersModel getModifiersModel()
Description copied from class: JavaTypeModel
get modifiers moder

Specified by:
getModifiersModel in class JavaTypeModel
Returns:
Modifiers model

isClass

public boolean isClass()
Specified by:
isClass in class JavaTypeModel

isInterface

public boolean isInterface()
Specified by:
isInterface in class JavaTypeModel

isEnum

public boolean isEnum()
Specified by:
isEnum in class JavaTypeModel

isAnnotationType

public boolean isAnnotationType()
Specified by:
isAnnotationType in class JavaTypeModel

isPrimitiveType

public boolean isPrimitiveType()
Specified by:
isPrimitiveType in class JavaTypeModel

isArray

public boolean isArray()
Specified by:
isArray in class JavaTypeModel

isTypeVariable

public boolean isTypeVariable()
Specified by:
isTypeVariable in class JavaTypeModel

isWildcardBounds

public boolean isWildcardBounds()
Specified by:
isWildcardBounds in class JavaTypeModel

isNull

public boolean isNull()
Specified by:
isNull in class JavaTypeModel

isUnknown

public boolean isUnknown()
Description copied from class: JavaTypeModel
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)

Specified by:
isUnknown in class JavaTypeModel

getEnclosedType

public JavaTypeModel getEnclosedType()
                              throws TermWareException
Description copied from class: JavaTypeModel
return enclosed class

Specified by:
getEnclosedType in class JavaTypeModel
Throws:
TermWareException

getReferencedType

public JavaTypeModel getReferencedType()
                                throws TermWareException
Description copied from class: JavaTypeModel
Nullable

Specified by:
getReferencedType in class JavaTypeModel
Returns:
referenced type. Works only if isArray()==true, otherwise return null.
Throws:
TermWareException

hasMethodModels

public boolean hasMethodModels()
Specified by:
hasMethodModels in class JavaTypeModel
Returns:
true if type has methods.

getMethodModels

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

Specified by:
getMethodModels in class JavaTypeModel

hasMemberVariableModels

public boolean hasMemberVariableModels()
Specified by:
hasMemberVariableModels in class JavaTypeModel

getMemberVariableModels

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

Specified by:
getMemberVariableModels in class JavaTypeModel

getConstructorModels

public java.util.List<JavaConstructorModel> getConstructorModels()
Description copied from class: JavaTypeModel
get list of constructor models.

Specified by:
getConstructorModels in class JavaTypeModel

getInitializerModels

public java.util.List<JavaInitializerModel> getInitializerModels()
Description copied from class: JavaTypeModel
get list of initializer models

Specified by:
getInitializerModels in class JavaTypeModel

getEnumConstantModels

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

Specified by:
getEnumConstantModels in class JavaTypeModel

getDefaultAnnotationInstanceModel

public JavaAnnotationInstanceModel getDefaultAnnotationInstanceModel()
                                                              throws TermWareException,
                                                                     EntityNotFoundException
if this is annotation - get DefaultAnnotationInstance, otherwise - return null In our case emulate behaviour of origin.

Specified by:
getDefaultAnnotationInstanceModel in class JavaTypeModel
Throws:
TermWareException
EntityNotFoundException

isNested

public boolean isNested()
Description copied from class: JavaTypeModel
return true if this type is nested inside some other type.

Specified by:
isNested in class JavaTypeModel

hasNestedTypeModels

public boolean hasNestedTypeModels()
Description copied from class: JavaTypeModel
when return true, getNestedTypeModels() returns set of nested types. Otherwise getNestedTypeModels throws NotSupportedException

Specified by:
hasNestedTypeModels in class JavaTypeModel

getNestedTypeModels

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

hasTypeParameters

public boolean hasTypeParameters()
Description copied from class: JavaTypeModel
if this type hase type parameters ?

Specified by:
hasTypeParameters in class JavaTypeModel

getTypeParameters

public java.util.List<JavaTypeVariableAbstractModel> getTypeParameters()
                                                                throws TermWareException
all parameters of origin types are bound.

Specified by:
getTypeParameters in class JavaTypeModel
Throws:
TermWareException

getOrigin

public JavaTypeModel getOrigin()

getTypeArguments

public Term getTypeArguments()
Returns:
type arguments, represented as term

getResolvedTypeArguments

public java.util.List<JavaTypeModel> getResolvedTypeArguments()
                                                       throws TermWareException,
                                                              EntityNotFoundException
Throws:
TermWareException
EntityNotFoundException

getSuperClass

public JavaTypeModel getSuperClass()
                            throws TermWareException,
                                   EntityNotFoundException
Description copied from class: JavaTypeModel
get superclass. does not supported for primitive types, type arguments, wildcard bounds

Specified by:
getSuperClass in class JavaTypeModel
Throws:
TermWareException
EntityNotFoundException

getSuperInterfaces

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

Specified by:
getSuperInterfaces in class JavaTypeModel
Returns:
all direct superinterfaces.
Throws:
TermWareException

isLocal

public boolean isLocal()
Description copied from class: JavaTypeModel
true, if this is local type

Specified by:
isLocal in class JavaTypeModel

isAnonimous

public boolean isAnonimous()
Description copied from class: JavaTypeModel
true, if this is anonimous type.

Specified by:
isAnonimous in class JavaTypeModel

getEnclosedStatement

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

Specified by:
getEnclosedStatement in class JavaTypeModel

hasAnnotation

public boolean hasAnnotation(java.lang.String annotationName)
                      throws TermWareException
Description copied from class: JavaTypeModel
return true, if this type is annotated by annotation with type annotationTypeName, otherwise false

Overrides:
hasAnnotation in class JavaTypeModel
Throws:
TermWareException

getAnnotation

public JavaAnnotationInstanceModel getAnnotation(java.lang.String annotationName)
                                          throws TermWareException
Description copied from class: JavaTypeModel
return annottation instance, if one exists. Otherwise - null.

Overrides:
getAnnotation in class JavaTypeModel
Throws:
TermWareException

getAnnotationsMap

public java.util.Map<java.lang.String,JavaAnnotationInstanceModel> getAnnotationsMap()
                                                                              throws TermWareException
Description copied from class: JavaTypeModel
get map of annotations, declared in source code.

Specified by:
getAnnotationsMap in class JavaTypeModel
Throws:
TermWareException

getDefaultInitializerExpression

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

resolveTypeParameter

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

createTermTypeArguments

public void createTermTypeArguments(java.util.List<JavaTypeModel> resolvedTypes)
                             throws TermWareException
Throws:
TermWareException

hasASTTerm

public boolean hasASTTerm()
Description copied from class: JavaTypeModel
return true, if type model have AST Term

Specified by:
hasASTTerm in class JavaTypeModel

getASTTerm

public Term getASTTerm()
Description copied from class: JavaTypeModel
return AST term, if exoists, otherwise - null

Specified by:
getASTTerm in class JavaTypeModel

getModelTerm

public Term getModelTerm()
                  throws TermWareException,
                         EntityNotFoundException
TypeArgumentBoundTypeModel(ClassOrInterfaceType(originModel,list(typeModels)),placeContext)

Specified by:
getModelTerm in class JavaTypeModel
Throws:
TermWareException
EntityNotFoundException

getSubstitution

public JavaTypeArgumentsSubstitution getSubstitution()
                                              throws TermWareException
Throws:
TermWareException

getWhere

public JavaTypeModel getWhere()

getAttributes

public JavaTypeModelAttributes getAttributes()
Description copied from class: JavaTypeModel
return attributes of this model

Overrides:
getAttributes in class JavaTypeModel