Package com.orchestranetworks.schema.dynamic

# Interface BeanElement

public interface BeanElement
This interface allows setting properties of a data model element.

Since:
  5.8.0
See Also:
  - `BeanDefinition`
  - Developer Guide for constraints

- ## Method Summary

  Modifier and Type
  Method
  Description
  `BeanFacet`
  `addFacetConstraint(Class<? extends Constraint<?>> aConstraintClass)`
  Adds a programmatic constraint to this element.
  `BeanFacetDatasetSet`
  `addFacetDatasetSet(AdaptationHome aDataspace)`
  Adds a dataset constraint to this element.
  `BeanFacetDatasetSet`
  `addFacetDatasetSet(Path aPath)`
  Adds a dataset constraint to this element.
  `BeanFacetDataspaceSet`
  `addFacetDataspaceSet()`
  Adds a dataspace constraint to this element.
  `BeanFacet`
  `addFacetEnumeration(Nomenclature<?> aNomenclature)`
  Sets a nomenclature for this element.
  `BeanFacet`
  `addFacetEnumeration(List<?> anEnumeration)`
  Sets a list of possible values for this element.
  `BeanFacet`
  `addFacetFractionDigits(int aValue)`
  Sets the number of fraction digits for decimal types.
  `BeanFacet`
  `addFacetLength(int aValue)`
  Sets the exact number of characters required for this element.
  `BeanFacet`
  `addFacetMax(Object aBoundaryValue, boolean isBoundaryExcluded)`
  Sets the maximum value for an element.
  `BeanFacet`
  `addFacetMaxLength(int aValue)`
  Sets the maximum number of characters required for this element.
  `BeanFacet`
  `addFacetMin(Object aBoundaryValue, boolean isBoundaryExcluded)`
  Sets the minimum value for an element.
  `BeanFacet`
  `addFacetMinLength(int aValue)`
  Sets the minimum number of characters required for this element.
  `BeanFacet`
  `addFacetPattern(String aPattern)`
  Sets a pattern that the value of the field must match.
  `BeanFacetTableRef`
  `addFacetTableRef(AdaptationTable aTable)`
  Adds a table reference constraint to this element.
  `BeanFacet`
  `addFacetTotalDigits(int aValue)`
  Sets the maximum number of digits for integer or decimal types.
  `void`
  `setDefaultCollapseMode(boolean isCollapsed)`
  Sets the default collapsed mode.
  `void`
  `setDefaultValue(Object aDefaultValue)`
  Sets the default value.
  `void`
  `setDefaultViewMode(DefaultViewMode aDefaultViewMode)`
  Sets the default view mode.
  `void`
  `setDescription(UserMessage aDescription)`
  Sets the localized description for this element.
  `void`
  `setDescription(String aDescription)`
  Sets the description for this element.
  `void`
  `setDisableTrimAtUserInput(boolean disableTrim)`
  Specifies if leading and trailing whitespaces must be preserved upon user input.
  `void`
  `setLabel(UserMessage aLabel)`
  Sets the localized label for this element.
  `void`
  `setLabel(String aLabel)`
  Sets the label for this element.
  `void`
  `setMaxOccurs(int maxOccurs)`
  Sets the maximum number of occurrences for this element.
  `void`
  `setMaxOccursAsUnbounded()`
  Removes the maximum number of occurrences for this element.
  `void`
  `setMinOccurs(int minOccurs)`
  Sets the minimum number of occurrences for this element.
  `void`
  `setMinOccursErrorMessage(UserMessage anErrorMessage)`
  Sets the localized error message to display when the minimum number of occurrences check failed.
  `void`
  `setMinOccursErrorMessage(String anErrorMessage)`
  Sets the error message to display when the minimum number of occurrences check failed.
  `void`
  `setUIBean(Class<? extends UIBeanEditor> aUIBeanClass)`
  Deprecated.
  `void`
  `setWidget(Class<? extends UIWidgetFactory<?>> aWidgetFactoryClass)`
  Sets the widget for this element.

- ## Method Details

  - ### setDefaultValue

    void setDefaultValue(Object aDefaultValue)
    Sets the default value.
    Parameters:
      `aDefaultValue` - the default value. It must be compatible with the element's type.

  - ### setLabel

    void setLabel(String aLabel)
    Sets the label for this element.
    Parameters:
      `aLabel` - the label for this element.

  - ### setLabel

    void setLabel(UserMessage aLabel)
    Sets the localized label for this element.
    Parameters:
      `aLabel` - the label for this element.

  - ### setDescription

    void setDescription(String aDescription)
    Sets the description for this element.
    Parameters:
      `aDescription` - the description for this element.

  - ### setDescription

    void setDescription(UserMessage aDescription)
    Sets the localized description for this element.
    Parameters:
      `aDescription` - the description for this element.

  - ### setMinOccurs

    void setMinOccurs(int minOccurs)
    Sets the minimum number of occurrences for this element. Default is `0`.
    Parameters:
      `minOccurs` - the minimum number of occurrences for this element.

  - ### setMinOccursErrorMessage

    void setMinOccursErrorMessage(String anErrorMessage)
    Sets the error message to display when the minimum number of occurrences check failed. If none is set, a default message will be displayed.
    Parameters:
      `anErrorMessage` - the error message.

  - ### setMinOccursErrorMessage

    void setMinOccursErrorMessage(UserMessage anErrorMessage)
    Sets the localized error message to display when the minimum number of occurrences check failed. If none is set, a default message will be displayed.
    Parameters:
      `anErrorMessage` - the error message.

  - ### setMaxOccurs

    void setMaxOccurs(int maxOccurs)
    Sets the maximum number of occurrences for this element. Default is `1`.
    Parameters:
      `maxOccurs` - the maximum number of occurrences for this element.

  - ### setMaxOccursAsUnbounded

    void setMaxOccursAsUnbounded()
    Removes the maximum number of occurrences for this element.

  - ### addFacetLength

    BeanFacet addFacetLength(int aValue)
    Sets the exact number of characters required for this element. This facet is supported only for some element types.
    Parameters:
      `aValue` - the exact number of characters for this element.
    Returns:
      the new facet.

  - ### addFacetMinLength

    BeanFacet addFacetMinLength(int aValue)
    Sets the minimum number of characters required for this element. This facet is supported only for some element types.
    Parameters:
      `aValue` - the minimum number of characters for this element.
    Returns:
      the new facet.

  - ### addFacetMaxLength

    BeanFacet addFacetMaxLength(int aValue)
    Sets the maximum number of characters required for this element. This facet is supported only for some element types.
    Parameters:
      `aValue` - the maximum number of characters for this element.
    Returns:
      the new facet.

  - ### addFacetMin

    BeanFacet addFacetMin(Object aBoundaryValue, boolean isBoundaryExcluded)
    Sets the minimum value for an element. This facet is supported only for some element types.
    Parameters:
      `aBoundaryValue` - the maximum value. It must be compatible with the element's type.
      `isBoundaryExcluded` - must be `true` if `@aBoundaryValue` if not a valid value.
    Returns:
      the new facet.

  - ### addFacetMax

    BeanFacet addFacetMax(Object aBoundaryValue, boolean isBoundaryExcluded)
    Sets the maximum value for an element. This facet is supported only for some element types.
    Parameters:
      `aBoundaryValue` - the maximum value. It must be compatible with the element's type.
      `isBoundaryExcluded` - must be `true` if `@aBoundaryValue` if not a valid value.
    Returns:
      the new facet.

  - ### addFacetTotalDigits

    BeanFacet addFacetTotalDigits(int aValue)
    Sets the maximum number of digits for integer or decimal types.
    Parameters:
      `aValue` - the maximum number of digits.
    Returns:
      the new facet.

  - ### addFacetFractionDigits

    BeanFacet addFacetFractionDigits(int aValue)
    Sets the number of fraction digits for decimal types.
    Parameters:
      `aValue` - the maximum number of digits.
    Returns:
      the new facet.

  - ### addFacetPattern

    BeanFacet addFacetPattern(String aPattern)
    Sets a pattern that the value of the field must match.
    Parameters:
      `aPattern` - the regular expression pattern.
    Returns:
      the new facet.

  - ### addFacetConstraint

    BeanFacet addFacetConstraint(Class<? extends Constraint<?>> aConstraintClass)
    Adds a programmatic constraint to this element.
    Parameters:
      `aConstraintClass` - the constraint class to add to this element. The class must extend Constraint or ConstraintEnumeration.
    Returns:
      the new facet.
    See Also:
      - Programmatic Facets

  - ### addFacetTableRef

    BeanFacetTableRef addFacetTableRef(AdaptationTable aTable)
    Adds a table reference constraint to this element.
    Parameters:
      `aTable` - table that is referenced by this element.
    Returns:
      the new facet.

  - ### addFacetEnumeration

    BeanFacet addFacetEnumeration(Nomenclature<?> aNomenclature)
    Sets a nomenclature for this element.

    One may consider using instead a enumeration constraint.

    Parameters:
      `aNomenclature` - A collection of possible values.
    Returns:
      the new facet.
    See Also:
      - `ConstraintEnumeration`
      - `addFacetConstraint(Class)`

  - ### addFacetEnumeration

    BeanFacet addFacetEnumeration(List<?> anEnumeration)
    Sets a list of possible values for this element.

    One may consider using instead a enumeration constraint.

    Parameters:
      `anEnumeration` - A collection of possible values.
    Returns:
      the new facet.
    Since:
      6.1.1
    See Also:
      - `ConstraintEnumeration`
      - `addFacetConstraint(Class)`

  - ### addFacetDataspaceSet

    BeanFacetDataspaceSet addFacetDataspaceSet()
    Adds a dataspace constraint to this element.
    Returns:
      the new facet.

  - ### addFacetDatasetSet

    BeanFacetDatasetSet addFacetDatasetSet(AdaptationHome aDataspace)
    Adds a dataset constraint to this element.
    Parameters:
      `aDataspace` - a dataspace. Can be a branch or a snapshot.
    Returns:
      the new facet.

  - ### addFacetDatasetSet

    BeanFacetDatasetSet addFacetDatasetSet(Path aPath)
    Adds a dataset constraint to this element.
    Parameters:
      `aPath` - a path to the value that holds the dataspace key. The path must be relative and is resolved against the current node.
    Returns:
      the new facet.

  - ### setDefaultCollapseMode

    void setDefaultCollapseMode(boolean isCollapsed)
    Sets the default collapsed mode. Should be used only for a complex element. Default is `false`.
    Parameters:
      `isCollapsed` - if `true`, the group will be collapsed by default. If `false`, the group will be expanded by default.

  - ### setDefaultViewMode

    void setDefaultViewMode(DefaultViewMode aDefaultViewMode)
    Sets the default view mode. Should be used only for a complex element or an association. Default is `DefaultViewMode.DEFAULT`.
    Since:
      6.1.0

  - ### setDisableTrimAtUserInput

    void setDisableTrimAtUserInput(boolean disableTrim)
    Specifies if leading and trailing whitespaces must be preserved upon user input. Whitespaces are by default always trimmed upon user input.
    Since:
      6.1.0

  - ### setUIBean

    @Deprecated void setUIBean(Class<? extends UIBeanEditor> aUIBeanClass)
    Deprecated.
    Sets the UI bean for this element.

    This method allows to reuse existing UI beans but is deprecated because one should consider the porting of UI beans to the new custom widget API.

    Parameters:
      `aUIBeanClass` - the JavaBean class for the UI bean. This class must extend the class UIBeanEditor.

  - ### setWidget

    void setWidget(Class<? extends UIWidgetFactory<?>> aWidgetFactoryClass)
    Sets the widget for this element.
    Parameters:
      `aWidgetFactoryClass` - the Java bean class for the widget. This class must implement the interface UIWidgetFactory.