Interface IFieldDefinition

All Superinterfaces:
IAttributable, IContainer, IDefaultable, IDefinition, IDescribable, IFeatureValueConstrained, IField, IJsonNamed, IModelDefinition, IModelElement, IModelElementVisitable, INamed, INamedModelElement, IValueConstrained, IValuedDefinition
All Known Subinterfaces:
IBoundDefinitionModelField<ITEM>, IBoundDefinitionModelFieldComplex, IBoundInstanceModelFieldScalar
All Known Implementing Classes:
AbstractGlobalFieldDefinition, AbstractInlineFieldDefinition

public interface IFieldDefinition extends IModelDefinition, IValuedDefinition, IField
Represents a field definition in a Metaschema module.

A field is a structured data object that may have flags (attributes) and a simple typed value. Field definitions specify the allowed flags, value type, and JSON serialization behavior for field instances.

  • Method Details

    • isInline

      default boolean isInline()
      Description copied from interface: IDefinition
      Determine if the definition is defined inline, meaning the definition is declared where it is used.

      If this method returns false, then IDefinition.getInlineInstance() must return null.

      Specified by:
      isInline in interface IDefinition
      Returns:
      true if the definition is declared inline or false if the definition is able to be globally referenced
      See Also:
    • getInlineInstance

      default IFieldInstance getInlineInstance()
      Description copied from interface: IDefinition
      If IDefinition.isInline() is true, return the instance the definition is inlined for.

      If this method returns null, then IDefinition.getInlineInstance() must return false.

      Specified by:
      getInlineInstance in interface IDefinition
      Returns:
      the instance or null otherwise
      See Also:
    • getJsonValueKey

      @Nullable default Object getJsonValueKey()
      Retrieves the key to use as the field name for this field's value in JSON.
      Returns:
      a string or a FlagInstance value
    • hasJsonValueKeyFlagInstance

      default boolean hasJsonValueKeyFlagInstance()
      Check if a JSON value key flag is configured.
      Returns:
      true if a JSON value key flag is configured, or false otherwise
    • getJsonValueKeyFlagInstance

      @Nullable IFlagInstance getJsonValueKeyFlagInstance()
      Retrieves the flag instance whose value will be used as the "value key".
      Returns:
      the configured flag instance, or null if a flag is not configured as the "value key"
    • getJsonValueKeyName

      @Nullable String getJsonValueKeyName()
      Retrieves the configured static label to use as the value key, or the type specific name if a label is not configured.
      Returns:
      the value key label
    • getEffectiveJsonValueKeyName

      @NonNull default String getEffectiveJsonValueKeyName()
      Retrieves the configured static label to use as the value key, or the type specific name if a label is not configured.
      Returns:
      the value key label
    • getFieldValue

      default Object getFieldValue(@NonNull Object item)
      Get the value of the field's value from the field item object.
      Parameters:
      item - the field item
      Returns:
      the field's value or null if it has no value
    • accept

      default <CONTEXT, RESULT> RESULT accept(@NonNull IModelElementVisitor<CONTEXT,RESULT> visitor, CONTEXT context)
      A visitor callback.
      Specified by:
      accept in interface IModelElementVisitable
      Type Parameters:
      CONTEXT - the type of the context parameter
      RESULT - the type of the visitor result
      Parameters:
      visitor - the calling visitor
      context - a parameter used to pass contextual information between visitors
      Returns:
      the visitor result