public abstract class AbstractItdTypeDetailsProvidingMetadataItem extends org.springframework.roo.metadata.AbstractMetadataItem implements ItdTypeDetailsProvidingMetadataItem
ItdTypeDetailsProvidingMetadataItem, which
assumes the subclass will require a non-null
ClassOrInterfaceTypeDetails representing the governor and wishes to
build an ITD via the ItdTypeDetailsBuilder mechanism.| Modifier and Type | Field and Description |
|---|---|
protected Map<FieldMetadata,MethodMetadataBuilder> |
accessorMethods |
protected org.springframework.roo.model.JavaType |
aspectName |
protected ItdTypeDetailsBuilder |
builder |
protected org.springframework.roo.model.JavaType |
destination |
protected PhysicalTypeMetadata |
governorPhysicalTypeMetadata |
protected ClassOrInterfaceTypeDetails |
governorTypeDetails |
protected ItdTypeDetails |
itdTypeDetails |
protected Map<FieldMetadata,MethodMetadataBuilder> |
mutatorMethods |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractItdTypeDetailsProvidingMetadataItem(String identifier,
org.springframework.roo.model.JavaType aspectName,
PhysicalTypeMetadata governorPhysicalTypeMetadata)
Validates input and constructs a superclass that implements
ItdTypeDetailsProvidingMetadataItem. |
| Modifier and Type | Method and Description |
|---|---|
protected void |
buildItd()
Generates the
ItdTypeDetails from the current contents of this
instance's ItdTypeDetailsBuilder. |
protected void |
ensureGovernorExtends(org.springframework.roo.model.JavaType javaType)
Ensures that the governor extends the given type, i.e. introduces that
type as a supertype iff it's not already one
|
protected void |
ensureGovernorHasConstructor(ConstructorMetadataBuilder constructorMetadata)
Ensures that the governor has provided constructor
|
protected void |
ensureGovernorHasField(FieldMetadataBuilder fieldMetadata)
Ensures that the governor has provided field.
|
protected void |
ensureGovernorHasField(FieldMetadataBuilder fieldMetadata,
boolean includeAccessor,
boolean includeMutator)
Ensures that the governor has provided field.
|
protected void |
ensureGovernorHasMethod(MethodMetadataBuilder methodMetadata)
Ensures that the governor has provided method
|
protected void |
ensureGovernorImplements(org.springframework.roo.model.JavaType javaType)
Ensures that the governor implements the given type.
|
protected void |
ensureGovernorIsAnnotated(AnnotationMetadataBuilder annotationMetadata)
Ensures that the governor is annotated with the given annotation
|
protected MethodMetadata |
getAccessorMethod(FieldMetadata field) |
protected MethodMetadataBuilder |
getAccessorMethod(FieldMetadata field,
InvocableMemberBodyBuilder bodyBuilder) |
protected MethodMetadataBuilder |
getAccessorMethod(org.springframework.roo.model.JavaSymbolName fieldName,
org.springframework.roo.model.JavaType fieldType) |
protected MethodMetadataBuilder |
getAccessorMethod(org.springframework.roo.model.JavaSymbolName fieldName,
org.springframework.roo.model.JavaType fieldType,
InvocableMemberBodyBuilder bodyBuilder) |
org.springframework.roo.model.JavaType |
getAspectName()
Return current aspect name
|
org.springframework.roo.model.JavaType |
getDestination() |
protected FieldMetadataBuilder |
getField(int modifier,
org.springframework.roo.model.JavaSymbolName fieldName,
org.springframework.roo.model.JavaType fieldType,
String fieldInitializer)
Convenience method for returning a simple private field based on the
field name, type, and initializer.
|
protected FieldMetadataBuilder |
getField(org.springframework.roo.model.JavaSymbolName fieldName,
org.springframework.roo.model.JavaType fieldType) |
protected MethodMetadata |
getGovernorMethod(org.springframework.roo.model.JavaSymbolName methodName,
org.springframework.roo.model.JavaType... parameterTypes)
Returns the given method of the governor.
|
protected MethodMetadata |
getGovernorMethod(org.springframework.roo.model.JavaSymbolName methodName,
List<org.springframework.roo.model.JavaType> parameterTypes)
Returns the given method of the governor.
|
ItdTypeDetails |
getMemberHoldingTypeDetails()
Obtains the
MemberHoldingTypeDetails, if available. |
protected MethodMetadataBuilder |
getMethod(int modifier,
org.springframework.roo.model.JavaSymbolName methodName,
org.springframework.roo.model.JavaType returnType,
List<org.springframework.roo.model.JavaType> parameterTypes,
List<org.springframework.roo.model.JavaSymbolName> parameterNames,
InvocableMemberBodyBuilder bodyBuilder)
Returns a public method given the method name, return type, parameter
types, parameter names, and method body.
|
protected MethodMetadata |
getMutatorMethod(FieldMetadata field) |
protected MethodMetadataBuilder |
getMutatorMethod(org.springframework.roo.model.JavaSymbolName fieldName,
org.springframework.roo.model.JavaType parameterType) |
protected MethodMetadataBuilder |
getMutatorMethod(org.springframework.roo.model.JavaSymbolName fieldName,
org.springframework.roo.model.JavaType parameterType,
InvocableMemberBodyBuilder bodyBuilder) |
protected String |
getNameOfJavaType(org.springframework.roo.model.JavaType type)
Returns String which represents type inside ITD
Delegates on
JavaType.getNameIncludingTypeParameters(boolean, org.springframework.roo.model.ImportRegistrationResolver)
(asStatic = false) |
protected String |
getNameOfJavaType(org.springframework.roo.model.JavaType type,
boolean asStatic)
Returns String which represents type inside ITD
Delegates on
JavaType.getNameIncludingTypeParameters(boolean, org.springframework.roo.model.ImportRegistrationResolver) |
protected AnnotationMetadata |
getTypeAnnotation(org.springframework.roo.model.JavaType annotationType)
Returns the metadata for an annotation of the given type if the governor
does not already have one.
|
protected boolean |
governorHasMethod(org.springframework.roo.model.JavaSymbolName methodName,
org.springframework.roo.model.JavaType... parameterTypes)
Indicates whether the governor has a method with the given signature.
|
protected boolean |
governorHasMethod(org.springframework.roo.model.JavaSymbolName methodName,
List<org.springframework.roo.model.JavaType> parameterTypes)
Indicates whether the governor has a method with the given signature.
|
protected boolean |
governorHasMethodWithSameName(org.springframework.roo.model.JavaSymbolName methodName)
Indicates whether the governor has a method with the given method name
regardless of method parameters.
|
int |
hashCode() |
protected boolean |
isImplementing(ClassOrInterfaceTypeDetails clazz,
org.springframework.roo.model.JavaType interfaceTarget)
Determines if the presented class (or any of its superclasses) implements
the target interface.
|
String |
toString() |
protected org.springframework.roo.model.JavaType aspectName
protected ItdTypeDetailsBuilder builder
protected org.springframework.roo.model.JavaType destination
protected PhysicalTypeMetadata governorPhysicalTypeMetadata
protected ClassOrInterfaceTypeDetails governorTypeDetails
protected ItdTypeDetails itdTypeDetails
protected Map<FieldMetadata,MethodMetadataBuilder> accessorMethods
protected Map<FieldMetadata,MethodMetadataBuilder> mutatorMethods
protected AbstractItdTypeDetailsProvidingMetadataItem(String identifier, org.springframework.roo.model.JavaType aspectName, PhysicalTypeMetadata governorPhysicalTypeMetadata)
ItdTypeDetailsProvidingMetadataItem.
Exposes the ClassOrInterfaceTypeDetails of the governor, if
available. If they are not available, ensures AbstractMetadataItem.isValid() returns
false.
Subclasses should generally return immediately if AbstractMetadataItem.isValid() is
false. Subclasses should also attempt to set the itdTypeDetails
to contain the output of their ITD where AbstractMetadataItem.isValid() is true.
identifier - the identifier for this item of metadata (required)aspectName - the Java type of the ITD (required)governorPhysicalTypeMetadata - the governor, which is expected to
contain a ClassOrInterfaceTypeDetails (required)protected void buildItd()
ItdTypeDetails from the current contents of this
instance's ItdTypeDetailsBuilder.protected final void ensureGovernorExtends(org.springframework.roo.model.JavaType javaType)
javaType - the type to extend (required)protected final void ensureGovernorImplements(org.springframework.roo.model.JavaType javaType)
javaType - the type to implement (required)protected final void ensureGovernorIsAnnotated(AnnotationMetadataBuilder annotationMetadata)
AnnotationMetadataBuilder - the annotation to use(required)protected final void ensureGovernorHasField(FieldMetadataBuilder fieldMetadata)
FieldMetadataBuilder - the field to include(required)protected final void ensureGovernorHasField(FieldMetadataBuilder fieldMetadata, boolean includeAccessor, boolean includeMutator)
FieldMetadataBuilder - the field to include(required)protected final void ensureGovernorHasMethod(MethodMetadataBuilder methodMetadata)
MethodMetadataBuilder - the method to include(required)protected final void ensureGovernorHasConstructor(ConstructorMetadataBuilder constructorMetadata)
ConstructorMetadataBuilder - the constructor to include(required)protected MethodMetadata getAccessorMethod(FieldMetadata field)
protected MethodMetadataBuilder getAccessorMethod(FieldMetadata field, InvocableMemberBodyBuilder bodyBuilder)
protected MethodMetadataBuilder getAccessorMethod(org.springframework.roo.model.JavaSymbolName fieldName, org.springframework.roo.model.JavaType fieldType)
protected MethodMetadataBuilder getAccessorMethod(org.springframework.roo.model.JavaSymbolName fieldName, org.springframework.roo.model.JavaType fieldType, InvocableMemberBodyBuilder bodyBuilder)
protected FieldMetadataBuilder getField(int modifier, org.springframework.roo.model.JavaSymbolName fieldName, org.springframework.roo.model.JavaType fieldType, String fieldInitializer)
fieldName - the field namefieldType - the field typefieldInitializer - the string to initialize the field withprotected FieldMetadataBuilder getField(org.springframework.roo.model.JavaSymbolName fieldName, org.springframework.roo.model.JavaType fieldType)
protected MethodMetadata getGovernorMethod(org.springframework.roo.model.JavaSymbolName methodName, org.springframework.roo.model.JavaType... parameterTypes)
methodName - the name of the method for which to searchparameterTypes - the method's parameter typesMemberFindingUtils.getDeclaredMethod(org.springframework.roo.classpath.details.MemberHoldingTypeDetails,
JavaSymbolName, List)protected MethodMetadata getGovernorMethod(org.springframework.roo.model.JavaSymbolName methodName, List<org.springframework.roo.model.JavaType> parameterTypes)
methodName - the name of the method for which to searchparameterTypes - the method's parameter typesMemberFindingUtils.getDeclaredMethod(org.springframework.roo.classpath.details.MemberHoldingTypeDetails,
JavaSymbolName, List)public final ItdTypeDetails getMemberHoldingTypeDetails()
MemberHoldingTypeDetailsMetadataItemMemberHoldingTypeDetails, if available.
An MemberHoldingTypeDetails should be returned even if no members
should be introduced. Only return null if there was a failure during
parsing or other unexpected condition.
getMemberHoldingTypeDetails in interface MemberHoldingTypeDetailsMetadataItem<ItdTypeDetails>protected MethodMetadataBuilder getMethod(int modifier, org.springframework.roo.model.JavaSymbolName methodName, org.springframework.roo.model.JavaType returnType, List<org.springframework.roo.model.JavaType> parameterTypes, List<org.springframework.roo.model.JavaSymbolName> parameterNames, InvocableMemberBodyBuilder bodyBuilder)
modifier - the method modifiermethodName - the method namereturnType - the return typeparameterTypes - a list of parameter typesparameterNames - a list of parameter namesbodyBuilder - the method bodyprotected MethodMetadata getMutatorMethod(FieldMetadata field)
protected MethodMetadataBuilder getMutatorMethod(org.springframework.roo.model.JavaSymbolName fieldName, org.springframework.roo.model.JavaType parameterType)
protected MethodMetadataBuilder getMutatorMethod(org.springframework.roo.model.JavaSymbolName fieldName, org.springframework.roo.model.JavaType parameterType, InvocableMemberBodyBuilder bodyBuilder)
protected AnnotationMetadata getTypeAnnotation(org.springframework.roo.model.JavaType annotationType)
annotationType - the type of annotation to generate (required)null if the governor already has that annotationprotected boolean governorHasMethod(org.springframework.roo.model.JavaSymbolName methodName,
org.springframework.roo.model.JavaType... parameterTypes)
methodName - the name of the method for which to searchparameterTypes - the method's parameter typesprotected boolean governorHasMethod(org.springframework.roo.model.JavaSymbolName methodName,
List<org.springframework.roo.model.JavaType> parameterTypes)
methodName - the name of the method for which to searchparameterTypes - the method's parameter typesprotected boolean governorHasMethodWithSameName(org.springframework.roo.model.JavaSymbolName methodName)
methodName - the name of the method for which to searchprotected boolean isImplementing(ClassOrInterfaceTypeDetails clazz, org.springframework.roo.model.JavaType interfaceTarget)
clazz - the cid to searchinterfaceTarget - the interface to locatepublic org.springframework.roo.model.JavaType getAspectName()
public org.springframework.roo.model.JavaType getDestination()
protected String getNameOfJavaType(org.springframework.roo.model.JavaType type)
JavaType.getNameIncludingTypeParameters(boolean, org.springframework.roo.model.ImportRegistrationResolver)
(asStatic = false)type - protected String getNameOfJavaType(org.springframework.roo.model.JavaType type, boolean asStatic)
JavaType.getNameIncludingTypeParameters(boolean, org.springframework.roo.model.ImportRegistrationResolver)type - asStatic - Copyright © 2009–2017. All rights reserved.