Interface ElementFactory<E, C extends E, M extends E, F extends E>
- Type Parameters:
E- The type that represents the super type of all elements in the ASTC- The type that represents a class in the ASTM- The type that represents a method in the ASTF- The type that represents a field in the AST
- All Known Implementing Classes:
GroovyElementFactory, JavaElementFactory
public interface ElementFactory<E, C extends E, M extends E, F extends E>
A factory for creating elements.
- Since:
- 2.3.0
- Author:
- graemerocher
-
Method Summary
Modifier and TypeMethodDescriptionnewClassElement(C type, ElementAnnotationMetadataFactory annotationMetadataFactory) Builds a new class element for the given type.default ClassElementnewClassElement(C type, ElementAnnotationMetadataFactory annotationMetadataFactory, Map<String, ClassElement> typeArguments) Deprecated.no longer usednewConstructorElement(ClassElement owningClass, M constructor, ElementAnnotationMetadataFactory elementAnnotationMetadataFactory) Builds a new constructor element for the given type.newEnumConstantElement(ClassElement owningClass, F enumConstant, ElementAnnotationMetadataFactory elementAnnotationMetadataFactory) Builds a new enum constant element for the given type.newFieldElement(ClassElement owningClass, F field, ElementAnnotationMetadataFactory elementAnnotationMetadataFactory) Builds a new field element for the given type.newMethodElement(ClassElement owningClass, M method, ElementAnnotationMetadataFactory elementAnnotationMetadataFactory) Builds a new method element for the given type.newSourceClassElement(C type, ElementAnnotationMetadataFactory elementAnnotationMetadataFactory) Builds a new source class element for the given type.newSourceMethodElement(ClassElement owningClass, M method, ElementAnnotationMetadataFactory elementAnnotationMetadataFactory) Builds a new source method element for the given method.
-
Method Details
-
newClassElement
Builds a new class element for the given type.- Parameters:
type- The typeannotationMetadataFactory- The element annotation metadata factory- Returns:
- The class element
- Since:
- 4.0.0
-
newClassElement
@Deprecated default ClassElement newClassElement(C type, ElementAnnotationMetadataFactory annotationMetadataFactory, Map<String, ClassElement> typeArguments) Deprecated.no longer usedBuilds a new class element for the given type.- Parameters:
type- The typeannotationMetadataFactory- The element annotation metadata factorytypeArguments- The resolved generics- Returns:
- The class element
- Since:
- 4.0.0
-
newSourceClassElement
ClassElement newSourceClassElement(C type, ElementAnnotationMetadataFactory elementAnnotationMetadataFactory) Builds a new source class element for the given type. This method differs fromnewClassElement(Object, ElementAnnotationMetadataFactory)in that it should only be called from elements that are known to originate from source code.- Parameters:
type- The typeelementAnnotationMetadataFactory- The element annotation metadata factory- Returns:
- The class element
- Since:
- 4.0.0
-
newSourceMethodElement
MethodElement newSourceMethodElement(ClassElement owningClass, M method, ElementAnnotationMetadataFactory elementAnnotationMetadataFactory) Builds a new source method element for the given method. This method differs fromnewMethodElement(ClassElement, Object, ElementAnnotationMetadataFactory)in that it should only be called from elements that are known to originate from source code.- Parameters:
owningClass- The owning classmethod- The methodelementAnnotationMetadataFactory- The element annotation metadata factory- Returns:
- The class element
- Since:
- 4.0.0
-
newMethodElement
MethodElement newMethodElement(ClassElement owningClass, M method, ElementAnnotationMetadataFactory elementAnnotationMetadataFactory) Builds a new method element for the given type.- Parameters:
owningClass- The owning classmethod- The methodelementAnnotationMetadataFactory- The element annotation metadata factory- Returns:
- The method element
- Since:
- 4.0.0
-
newConstructorElement
ConstructorElement newConstructorElement(ClassElement owningClass, M constructor, ElementAnnotationMetadataFactory elementAnnotationMetadataFactory) Builds a new constructor element for the given type.- Parameters:
owningClass- The owning classconstructor- The constructorelementAnnotationMetadataFactory- The element annotation metadata factory- Returns:
- The constructor element
- Since:
- 4.0.0
-
newEnumConstantElement
EnumConstantElement newEnumConstantElement(ClassElement owningClass, F enumConstant, ElementAnnotationMetadataFactory elementAnnotationMetadataFactory) Builds a new enum constant element for the given type.- Parameters:
owningClass- The owning classenumConstant- The enum constantelementAnnotationMetadataFactory- The element annotation metadata factory- Returns:
- The enum constant element
- Since:
- 4.0.0
-
newFieldElement
FieldElement newFieldElement(ClassElement owningClass, F field, ElementAnnotationMetadataFactory elementAnnotationMetadataFactory) Builds a new field element for the given type.- Parameters:
owningClass- The owning classfield- The fieldelementAnnotationMetadataFactory- The element annotation metadata factory- Returns:
- The field element
- Since:
- 4.0.0
-