Package spoon.reflect.factory
Class FieldFactory
java.lang.Object
spoon.reflect.factory.SubFactory
spoon.reflect.factory.FieldFactory
The
CtField
sub-factory.-
Field Summary
Fields inherited from class spoon.reflect.factory.SubFactory
factory
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription<T> CtField<T>
create(CtType<?> target, Set<ModifierKind> modifiers, CtTypeReference<T> type, String name)
Creates a field.<T> CtField<T>
create(CtType<?> target, Set<ModifierKind> modifiers, CtTypeReference<T> type, String name, CtExpression<T> defaultExpression)
Creates a field.<T> CtField<T>
Creates a field by copying an existing field.<T> CtFieldReference<T>
createReference(Field field)
Creates a field reference from ajava.lang.reflect
field.<T> CtFieldReference<T>
createReference(String signature)
Creates a field reference from its signature, as defined by the field reference's toString.<T> CtFieldReference<T>
createReference(CtField<T> field)
Creates a field reference from an existing field.<T> CtFieldReference<T>
createReference(CtTypeReference<?> declaringType, CtTypeReference<T> type, String fieldName)
Creates a field reference.
-
Constructor Details
-
FieldFactory
Creates a new field sub-factory.- Parameters:
factory
- the parent factory
-
-
Method Details
-
create
public <T> CtField<T> create(CtType<?> target, Set<ModifierKind> modifiers, CtTypeReference<T> type, String name)Creates a field.- Parameters:
target
- the target type to which the field is addedmodifiers
- the modifierstype
- the field's typename
- the field's name
-
create
public <T> CtField<T> create(CtType<?> target, Set<ModifierKind> modifiers, CtTypeReference<T> type, String name, CtExpression<T> defaultExpression)Creates a field.- Parameters:
target
- the target type to which the field is addedmodifiers
- the modifierstype
- the field's typename
- the field's namedefaultExpression
- the initializing expression
-
create
Creates a field by copying an existing field.- Type Parameters:
T
- the type of the field- Parameters:
target
- the target type where the new field has to be inserted tosource
- the source field to be copied- Returns:
- the newly created field
-
createReference
Creates a field reference from an existing field. -
createReference
public <T> CtFieldReference<T> createReference(CtTypeReference<?> declaringType, CtTypeReference<T> type, String fieldName)Creates a field reference. -
createReference
Creates a field reference from ajava.lang.reflect
field. -
createReference
Creates a field reference from its signature, as defined by the field reference's toString.
-