Class 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 Detail

      • of

        public static FieldModel of​(org.jboss.jandex.FieldInfo field)
        Creates and returns a new FieldModel instance based on the provided field information and raw type.
        Parameters:
        field - The FieldInfo object representing the field.
        Returns:
        A new FieldModel instance.
      • getAlias

        public Optional<String> getAlias()
        If the field is renamed with a Name annotation, the real field name is used as an alias.
        Returns:
        An Optional containing the alias if explicitly stated, otherwise empty.
      • getName

        public String getName()
        Description copied from interface: NamedElement
        Gets the name of the NamedElement, considering any Name annotation if present.
        Specified by:
        getName in interface NamedElement
        Returns:
        The field name.
      • getRawName

        public String getRawName()
        Description copied from interface: NamedElement
        Gets the raw (original) name of the NamedElement.
        Specified by:
        getRawName in interface NamedElement
        Returns:
        The raw field name.
      • getDirectiveLocation

        public String getDirectiveLocation()
        Description copied from interface: NamedElement
        Gets the location of directives associated with this NamedElement.
        Specified by:
        getDirectiveLocation in interface NamedElement
        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:
        true if the field has the specified annotation, otherwise false.
      • isStatic

        public boolean isStatic()
        Checks if the field is static.
        Returns:
        true if the field is static, otherwise false.
      • isTransient

        public boolean isTransient()
        Checks if the field is transient.
        Returns:
        true if the field is transient, otherwise false.
      • isSynthetic

        public boolean isSynthetic()
        Checks if the field is synthetic.
        Returns:
        true if the field is synthetic, otherwise false.
      • getType

        public TypeModel getType()
        Gets the type model associated with the field.
        Returns:
        The TypeModel representing the type of the field.
      • hasDirectives

        public boolean hasDirectives()
        Checks if the field has any associated directives.
        Specified by:
        hasDirectives in interface NamedElement
        Returns:
        true if the field has directives, otherwise false.