org.springframework.roo.classpath.details
Class DefaultClassOrInterfaceTypeDetails

java.lang.Object
  extended by org.springframework.roo.model.AbstractCustomDataAccessorProvider
      extended by org.springframework.roo.classpath.details.AbstractIdentifiableJavaStructureProvider
          extended by org.springframework.roo.classpath.details.AbstractIdentifiableAnnotatedJavaStructureProvider
              extended by org.springframework.roo.classpath.details.AbstractMemberHoldingTypeDetails
                  extended by org.springframework.roo.classpath.details.DefaultClassOrInterfaceTypeDetails
All Implemented Interfaces:
ClassOrInterfaceTypeDetails, IdentifiableAnnotatedJavaStructure, IdentifiableJavaStructure, MemberHoldingTypeDetails, PhysicalTypeDetails, org.springframework.roo.model.CustomDataAccessor

public class DefaultClassOrInterfaceTypeDetails
extends AbstractMemberHoldingTypeDetails
implements ClassOrInterfaceTypeDetails

Default representation of a ClassOrInterfaceTypeDetails.

Since:
1.0
Author:
Ben Alex

Method Summary
 boolean declaresField(org.springframework.roo.model.JavaSymbolName fieldName)
          Indicates whether this class or interface declares a field with the given name
 boolean extendsType(org.springframework.roo.model.JavaType type)
          Indicates whether this type extends the given type.
 List<? extends ConstructorMetadata> getDeclaredConstructors()
           
 List<? extends FieldMetadata> getDeclaredFields()
           
 List<InitializerMetadata> getDeclaredInitializers()
           
 List<ClassOrInterfaceTypeDetails> getDeclaredInnerTypes()
           
 List<? extends MethodMetadata> getDeclaredMethods()
           
 List<String> getDynamicFinderNames()
          Returns the names of any dynamic finders
 List<org.springframework.roo.model.JavaSymbolName> getEnumConstants()
          Lists the enum constants this type provides.
 List<org.springframework.roo.model.JavaType> getExtendsTypes()
          Lists the classes this type extends.
 List<org.springframework.roo.model.JavaType> getImplementsTypes()
          Lists the classes this type implements.
 org.springframework.roo.model.JavaType getName()
           
 PhysicalTypeCategory getPhysicalTypeCategory()
           
 Set<ImportMetadata> getRegisteredImports()
           
 ClassOrInterfaceTypeDetails getSuperclass()
          Obtains the superclass if this is a class and it is available.
 org.springframework.roo.model.JavaType getType()
          Returns the JavaType provided by this physical type.
 boolean implementsAny(org.springframework.roo.model.JavaType... types)
          Indicates whether this type implements the given types.
 boolean isAbstract()
          Indicates whether this class, interface, or enum is abstract
 String toString()
           
 
Methods inherited from class org.springframework.roo.classpath.details.AbstractMemberHoldingTypeDetails
getDeclaredConstructor, getDeclaredField, getDeclaredInnerType, getField, getFieldsWithAnnotation, getLayerEntities, getMethod, getMethod, getMethods, getUniqueFieldName, implementsType
 
Methods inherited from class org.springframework.roo.classpath.details.AbstractIdentifiableAnnotatedJavaStructureProvider
getAnnotation, getAnnotations, getTypeAnnotation
 
Methods inherited from class org.springframework.roo.classpath.details.AbstractIdentifiableJavaStructureProvider
getDeclaredByMetadataId, getModifier
 
Methods inherited from class org.springframework.roo.model.AbstractCustomDataAccessorProvider
getCustomData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.springframework.roo.classpath.details.MemberHoldingTypeDetails
getDeclaredConstructor, getDeclaredField, getDeclaredInnerType, getField, getFieldsWithAnnotation, getLayerEntities, getMethod, getMethod, getMethods, getUniqueFieldName, implementsType
 
Methods inherited from interface org.springframework.roo.classpath.details.IdentifiableAnnotatedJavaStructure
getAnnotation, getAnnotations, getTypeAnnotation
 
Methods inherited from interface org.springframework.roo.classpath.details.IdentifiableJavaStructure
getDeclaredByMetadataId, getModifier
 
Methods inherited from interface org.springframework.roo.model.CustomDataAccessor
getCustomData
 

Method Detail

declaresField

public boolean declaresField(org.springframework.roo.model.JavaSymbolName fieldName)
Description copied from interface: ClassOrInterfaceTypeDetails
Indicates whether this class or interface declares a field with the given name

Specified by:
declaresField in interface ClassOrInterfaceTypeDetails
Parameters:
fieldName - the field name to check for (can be null)
Returns:
false if a null field name is given

extendsType

public boolean extendsType(org.springframework.roo.model.JavaType type)
Description copied from interface: MemberHoldingTypeDetails
Indicates whether this type extends the given type. Equivalent to calling MemberHoldingTypeDetails.getExtendsTypes() and checking whether the given type is in the returned list.

Specified by:
extendsType in interface MemberHoldingTypeDetails
Parameters:
type - the supertype being checked for (required)
Returns:
see above

getDeclaredConstructors

public List<? extends ConstructorMetadata> getDeclaredConstructors()
Specified by:
getDeclaredConstructors in interface MemberHoldingTypeDetails

getDeclaredFields

public List<? extends FieldMetadata> getDeclaredFields()
Specified by:
getDeclaredFields in interface MemberHoldingTypeDetails

getDeclaredInitializers

public List<InitializerMetadata> getDeclaredInitializers()
Specified by:
getDeclaredInitializers in interface MemberHoldingTypeDetails

getDeclaredInnerTypes

public List<ClassOrInterfaceTypeDetails> getDeclaredInnerTypes()
Specified by:
getDeclaredInnerTypes in interface MemberHoldingTypeDetails

getDeclaredMethods

public List<? extends MethodMetadata> getDeclaredMethods()
Specified by:
getDeclaredMethods in interface MemberHoldingTypeDetails

getDynamicFinderNames

public List<String> getDynamicFinderNames()
Description copied from interface: MemberHoldingTypeDetails
Returns the names of any dynamic finders

Specified by:
getDynamicFinderNames in interface MemberHoldingTypeDetails
Returns:
a non-null list

getEnumConstants

public List<org.springframework.roo.model.JavaSymbolName> getEnumConstants()
Description copied from interface: ClassOrInterfaceTypeDetails
Lists the enum constants this type provides. Always empty except if an enum type.

Specified by:
getEnumConstants in interface ClassOrInterfaceTypeDetails
Returns:
the constants (may be empty, but never null)

getExtendsTypes

public List<org.springframework.roo.model.JavaType> getExtendsTypes()
Description copied from interface: MemberHoldingTypeDetails
Lists the classes this type extends. This may be empty. Always empty in the case of an enum.

While a List is used, normally in Java a class will only extend a single other class. A List is used to support interfaces, as well as support the special "declare parents: DestinationType extends SuperclassType" feature of ITDs which permits effectively multiple inheritance.

Specified by:
getExtendsTypes in interface MemberHoldingTypeDetails
Returns:
an unmodifiable representation of classes this type extends (may be empty, but never null)

getImplementsTypes

public List<org.springframework.roo.model.JavaType> getImplementsTypes()
Description copied from interface: MemberHoldingTypeDetails
Lists the classes this type implements. Always empty in the case of an interface.

A List is used to support interfaces, as well as support the special "declare parents: DestinationType implements SomeInterfaceType" feature of ITDs.

Specified by:
getImplementsTypes in interface MemberHoldingTypeDetails
Returns:
an unmodifiable representation of classes this type implements (may be empty, but never null)

getName

public org.springframework.roo.model.JavaType getName()
Specified by:
getName in interface PhysicalTypeDetails
See Also:
#getType(), which returns the same thing but is better named

getPhysicalTypeCategory

public PhysicalTypeCategory getPhysicalTypeCategory()
Specified by:
getPhysicalTypeCategory in interface PhysicalTypeDetails
Returns:
the category of Java type being provided by this PhysicalTypeDetails instance (never null)

getRegisteredImports

public Set<ImportMetadata> getRegisteredImports()
Specified by:
getRegisteredImports in interface ClassOrInterfaceTypeDetails
Returns:
the explicitly-registered imports this user wishes to have defined in the type (cannot be null, but may be empty)

getSuperclass

public ClassOrInterfaceTypeDetails getSuperclass()
Description copied from interface: ClassOrInterfaceTypeDetails
Obtains the superclass if this is a class and it is available.

Specified by:
getSuperclass in interface ClassOrInterfaceTypeDetails
Returns:
the superclass, if available (null will be returned for interfaces, or if the class isn't available)

getType

public org.springframework.roo.model.JavaType getType()
Description copied from interface: PhysicalTypeDetails
Returns the JavaType provided by this physical type. If possible, indicates any type parameters.

Specified by:
getType in interface PhysicalTypeDetails
Returns:
the full name of the type that members will eventually be available from when compiled, including any available type parameters (may be null if unable to parse)

implementsAny

public boolean implementsAny(org.springframework.roo.model.JavaType... types)
Description copied from interface: MemberHoldingTypeDetails
Indicates whether this type implements the given types. Equivalent to calling MemberHoldingTypeDetails.getImplementsTypes() and checking whether the given types are in the returned list.

Specified by:
implementsAny in interface MemberHoldingTypeDetails
Parameters:
types - the interfaces being checked for (required)
Returns:
see above

isAbstract

public boolean isAbstract()
Description copied from interface: ClassOrInterfaceTypeDetails
Indicates whether this class, interface, or enum is abstract

Specified by:
isAbstract in interface ClassOrInterfaceTypeDetails
Returns:
see above

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2009–2015. All rights reserved.