Interface IChoiceGroupInstance

All Superinterfaces:
IContainer, IContainerModel, IContainerModelGrouped, IDefaultable, IGroupable, IInstance, IInstanceAbsolute, IJsonInstance, IModelElement, IModelElementVisitable, IModelInstance, IModelInstanceAbsolute, IValued
All Known Subinterfaces:
IBoundInstanceModelChoiceGroup
All Known Implementing Classes:
AbstractChoiceGroupInstance

public interface IChoiceGroupInstance extends IModelInstanceAbsolute, IContainerModelGrouped, IJsonInstance
An Metaschema model instance representing a grouped set of objects consisting of heterogeneous object types.
  • Field Details

    • DEFAULT_CHOICE_GROUP_GROUP_AS_MAX_OCCURS

      static final int DEFAULT_CHOICE_GROUP_GROUP_AS_MAX_OCCURS
      The default max-occurs value for a choice group. -1 represents an unbounded occurance.
      See Also:
    • DEFAULT_JSON_DISCRIMINATOR_PROPERTY_NAME

      @NonNull static final String DEFAULT_JSON_DISCRIMINATOR_PROPERTY_NAME
      The default JSON property value used to identify the specific type of the object.
      See Also:
  • Method Details

    • getMaxOccurs

      default int getMaxOccurs()
      Get the maximum cardinality for this associated instance. This value must be greater than or equal to the minimum cardinality returned by IGroupable.getMinOccurs(), or -1 if unbounded.
      Specified by:
      getMaxOccurs in interface IGroupable
      Returns:
      a positive integer value or -1 if unbounded
      See Also:
    • getModelType

      default ModelType getModelType()
      Provides the Metaschema model type of "CHOICE".
      Specified by:
      getModelType in interface IModelElement
      Returns:
      the model type
    • getJsonName

      default String getJsonName()
      Description copied from interface: IJsonInstance
      Get the name used for the instance in JSON/YAML serialization.
      Specified by:
      getJsonName in interface IJsonInstance
      Returns:
      the JSON property name
    • getJsonDiscriminatorProperty

      @NonNull String getJsonDiscriminatorProperty()
      Get the JSON property to use to discriminate between JSON objects.
      Returns:
      the discriminator property
      See Also:
    • isEffectiveValueWrappedInXml

      default boolean isEffectiveValueWrappedInXml()
      Description copied from interface: IModelInstance
      Indicate if the instance allows values without an XML element wrapper.
      Specified by:
      isEffectiveValueWrappedInXml in interface IModelInstance
      Returns:
      true if the underlying data type is allowed to be unwrapped, or false otherwise
    • getJsonKeyFlagInstanceName

      @Nullable String getJsonKeyFlagInstanceName()
      Get the effective name of the JSON key flag, if a JSON key is configured.

      This name is expected to be in the same namespace as the containing model element (i.e. choice group, assembly, field).

      Returns:
      the name of the JSON key flag if configured, or null otherwise
    • getItemInstance

      @NonNull default INamedModelInstanceGrouped getItemInstance(@NonNull Object item)
      Get the named model instance for the provided choice group item.
      Parameters:
      item - the item to get the instance for
      Returns:
      the named model instance for the provided choice group item
    • getRemarks

      default MarkupMultiline getRemarks()
      Description copied from interface: IModelElement
      Retrieve the remarks associated with this information element, if any.
      Specified by:
      getRemarks in interface IModelElement
      Returns:
      the remarks or null if no remarks are defined
    • toCoordinates

      default String toCoordinates()
      Description copied from interface: IInstance
      Generates a "coordinate" string for the provided information element instance. A coordinate consists of the element's:
      • containing Metaschema module's short name
      • model type
      • name
      • hash code
      • the hash code of the definition
      Specified by:
      toCoordinates in interface IInstance
      Specified by:
      toCoordinates in interface IModelElement
      Returns:
      the coordinate
    • 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