Interface IGroupable

All Superinterfaces:
IDefaultable, IInstance, IModelElement, IModelElementVisitable
All Known Subinterfaces:
IAssemblyInstance, IAssemblyInstanceAbsolute, IAssemblyInstanceGrouped, IBindingInstanceModel, IBoundInstanceModel<ITEM>, IBoundInstanceModelAssembly, IBoundInstanceModelChoiceGroup, IBoundInstanceModelField<ITEM>, IBoundInstanceModelFieldComplex, IBoundInstanceModelFieldScalar, IBoundInstanceModelGroupedAssembly, IBoundInstanceModelGroupedField, IBoundInstanceModelGroupedNamed, IBoundInstanceModelNamed<ITEM>, IChoiceGroupInstance, IChoiceInstance, IFieldInstance, IFieldInstanceAbsolute, IFieldInstanceGrouped, IModelInstance, IModelInstanceAbsolute, INamedModelInstance, INamedModelInstanceAbsolute, INamedModelInstanceGrouped
All Known Implementing Classes:
AbstractAssemblyInstance, AbstractChoiceGroupInstance, AbstractChoiceInstance, AbstractFieldInstance, AbstractInlineAssemblyDefinition, AbstractInlineFieldDefinition, AbstractNamedModelInstance

public interface IGroupable extends IInstance
This behavioral interface represents an instance that supports grouped values.
  • Field Details

    • DEFAULT_GROUP_AS_MIN_OCCURS

      static final int DEFAULT_GROUP_AS_MIN_OCCURS
      The default Metaschema grouping minimum occurrence.
      See Also:
    • DEFAULT_GROUP_AS_MAX_OCCURS

      static final int DEFAULT_GROUP_AS_MAX_OCCURS
      The default Metaschema grouping maximum occurrence.
      See Also:
    • DEFAULT_JSON_GROUP_AS_BEHAVIOR

      @NonNull static final JsonGroupAsBehavior DEFAULT_JSON_GROUP_AS_BEHAVIOR
      The default Metaschema grouping behavior for JSON data.
    • DEFAULT_XML_GROUP_AS_BEHAVIOR

      @NonNull static final XmlGroupAsBehavior DEFAULT_XML_GROUP_AS_BEHAVIOR
      The default Metaschema grouping behavior for XML data.
  • Method Details

    • getMinOccurs

      int getMinOccurs()
      Get the minimum cardinality for this associated instance. This value must be less than or equal to the maximum cardinality returned by getMaxOccurs().
      Returns:
      0 or a positive integer value
      See Also:
    • getMaxOccurs

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

      @Nullable default String getGroupAsName()
      Get the name provided for grouping. An instance in Metaschema must have a group name if the instance has a cardinality greater than 1.
      Returns:
      the group-as name or null if no name is configured, such as when getMaxOccurs() = 1
    • getEffectiveXmlGroupAsQName

      @Nullable default IEnhancedQName getEffectiveXmlGroupAsQName()
      Get the name used for the associated element wrapping a collection of elements in XML. This value is required when getXmlGroupAsBehavior() = XmlGroupAsBehavior.GROUPED. This name will be the element name wrapping a collection of elements.

      If this instance doesn't have a namespace defined, then the module's XML namespace will be used.

      Returns:
      the groupAs QName or null if no name is configured, such as when getMaxOccurs() = 1.
    • getJsonGroupAsBehavior

      @NonNull default JsonGroupAsBehavior getJsonGroupAsBehavior()
      Gets the configured JSON group-as strategy. A JSON group-as strategy is only required when getMaxOccurs() > 1.

      The default for this method is JsonGroupAsBehavior.NONE, since the default behavior is to have no grouping. If getMaxOccurs() is greater than 1, then the default behavior is #DEFAULT_JSON_GROUP_AS_BEHAVIOR.

      Returns:
      the JSON group-as strategy, or JsonGroupAsBehavior#NONE if getMaxOccurs() = 1
      See Also:
    • getXmlGroupAsBehavior

      @NonNull default XmlGroupAsBehavior getXmlGroupAsBehavior()
      Gets the configured XML group-as strategy. A XML group-as strategy is only required when getMaxOccurs() > 1.
      Returns:
      the JSON group-as strategy, or XmlGroupAsBehavior#UNGROUPED if getMaxOccurs() = 1
      See Also:
    • getItemValues

      @NonNull default Collection<?> getItemValues(@NonNull Object instanceValue)
      Get the item values for the provided instanceValue. An instance may be singular or many valued.
      Parameters:
      instanceValue - the instance
      Returns:
      the item values or an empty collection if no item values exist