Class FieldModel
- java.lang.Object
-
- io.smallrye.graphql.client.model.helper.FieldModel
-
- All Implemented Interfaces:
NamedElement
public class FieldModel extends Object implements NamedElement
Represents a model for a Java (jandex) class field, providing information about the field's characteristics and associated directives.- Author:
- mskacelik
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Optional<String>getAlias()If the field is renamed with aNameannotation, the real field name is used as an alias.StringgetDirectiveLocation()Gets the location of directives associated with this NamedElement.List<DirectiveInstance>getDirectives()Gets the list of directive instances associated with the field.StringgetName()Gets the name of the NamedElement, considering anyNameannotation if present.StringgetRawName()Gets the raw (original) name of the NamedElement.TypeModelgetType()Gets the type model associated with the field.booleanhasAnnotation(org.jboss.jandex.DotName annotation)Checks if the field has a specific annotation.booleanhasDirectives()Checks if the field has any associated directives.booleanisStatic()Checks if the field is static.booleanisSynthetic()Checks if the field is synthetic.booleanisTransient()Checks if the field is transient.static FieldModelof(org.jboss.jandex.FieldInfo field)Creates and returns a newFieldModelinstance based on the provided field information and raw type.
-
-
-
Method Detail
-
of
public static FieldModel of(org.jboss.jandex.FieldInfo field)
Creates and returns a newFieldModelinstance based on the provided field information and raw type.- Parameters:
field- TheFieldInfoobject representing the field.- Returns:
- A new
FieldModelinstance.
-
getAlias
public Optional<String> getAlias()
If the field is renamed with aNameannotation, the real field name is used as an alias.- Returns:
- An
Optionalcontaining the alias if explicitly stated, otherwise empty.
-
getName
public String getName()
Description copied from interface:NamedElementGets the name of the NamedElement, considering anyNameannotation if present.- Specified by:
getNamein interfaceNamedElement- Returns:
- The field name.
-
getRawName
public String getRawName()
Description copied from interface:NamedElementGets the raw (original) name of the NamedElement.- Specified by:
getRawNamein interfaceNamedElement- Returns:
- The raw field name.
-
getDirectiveLocation
public String getDirectiveLocation()
Description copied from interface:NamedElementGets the location of directives associated with this NamedElement.- Specified by:
getDirectiveLocationin interfaceNamedElement- Returns:
- The directive location
-
hasAnnotation
public boolean hasAnnotation(org.jboss.jandex.DotName annotation)
Checks if the field has a specific annotation.- Parameters:
annotation- The annotation to check.- Returns:
trueif the field has the specified annotation, otherwisefalse.
-
isStatic
public boolean isStatic()
Checks if the field is static.- Returns:
trueif the field is static, otherwisefalse.
-
isTransient
public boolean isTransient()
Checks if the field is transient.- Returns:
trueif the field is transient, otherwisefalse.
-
isSynthetic
public boolean isSynthetic()
Checks if the field is synthetic.- Returns:
trueif the field is synthetic, otherwisefalse.
-
getType
public TypeModel getType()
Gets the type model associated with the field.- Returns:
- The
TypeModelrepresenting the type of the field.
-
hasDirectives
public boolean hasDirectives()
Checks if the field has any associated directives.- Specified by:
hasDirectivesin interfaceNamedElement- Returns:
trueif the field has directives, otherwisefalse.
-
getDirectives
public List<DirectiveInstance> getDirectives()
Gets the list of directive instances associated with the field.- Specified by:
getDirectivesin interfaceNamedElement- Returns:
- The list of
DirectiveInstanceobjects.
-
-