Klasse StringDataElement

java.lang.Object
de.esoco.lib.property.AbstractStringProperties
de.esoco.lib.property.StringProperties
de.esoco.data.element.DataElement<String>
de.esoco.data.element.StringDataElement
Alle implementierten Schnittstellen:
de.esoco.lib.property.HasProperties, de.esoco.lib.property.MutableProperties, Serializable
Bekannte direkte Unterklassen:
ProcessDescription, SelectionDataElement

public class StringDataElement extends DataElement<String>
A data element implementation that contains a string value.
Siehe auch:
  • Konstruktordetails

    • StringDataElement

      public StringDataElement(String name, String value)
      Creates a new modifiable instance without a validator.
      Parameter:
      name - The name of this element
      value - The value of this element
    • StringDataElement

      public StringDataElement(String name, String value, Validator<? super String> validator, Set<DataElement.Flag> flags)
      Creates a new instance with a constraint for the possible element values. The constraint is defined in form of a regular expression pattern against which new element values will be matched.
      Parameter:
      name - The name of this element
      value - The value of this element
      validator - The validator for the value or NULL for none
      flags - The optional flags for this data element
    • StringDataElement

      protected StringDataElement()
      Default constructor for serialization.
  • Methodendetails

    • getPhoneNumberParts

      public static List<String> getPhoneNumberParts(String number)
      Splits a phone number string into it's distinct parts and returns a list containing the parts. The list will contain 4 elements: Country code, area code, phone number, and extension. Empty parts will be returned as empty strings but will never be NULL.
      Parameter:
      number - The phone number string
      Gibt zurück:
      A list containing the 4 number parts
    • copy

      public StringDataElement copy(DataElement.CopyMode mode, de.esoco.lib.property.PropertyName<?>... copyProperties)
      Returns a copy of this data element that contains all or a subset of it's current state. Always copied are the name and flags. Never copied is the parent reference because upon copying typically a reference to a copied parent needs to be set. The further data the copy contains depends on the copy mode:

      The copy instance is created by invoking DataElement.newInstance() which has the recommendation to overwrite the return type to the concrete subtype to prevent the need for casting by the invoking code. For the same reason it is recommended that subclasses also override this method with the concrete return type and cast the result of super.copy() to that type.

      Setzt außer Kraft:
      copy in Klasse DataElement<String>
      Parameter:
      mode - The copy mode
      copyProperties - An optional list of properties to copy. If not provided all properties will be copied (unless the mode is DataElement.CopyMode.PLACEHOLDER)
      Gibt zurück:
      The copied instance
    • getValue

      public final String getValue()
      ---------------------------------------------------------------- /** Returns the value of this element. Each subclass must implement this method separately because some environments (like GWT) require serializable objects to use specific types for serializable fields. Therefore it is not possible to store a generic Object value in the base class.
      Angegeben von:
      getValue in Klasse DataElement<String>
      Gibt zurück:
      The element value
    • isValidValue

      public <T> boolean isValidValue(Validator<? super T> validator, T value)
      Overridden to allow any value if this instance has the user interface property LIST_STYLE with a value of EDITABLE.
      Setzt außer Kraft:
      isValidValue in Klasse DataElement<String>
      Parameter:
      validator - The validator to check the value with or NULL for none
      value - The value to check
      Gibt zurück:
      TRUE if the value is valid for this data element
      Siehe auch:
    • setStringValue

      public void setStringValue(String value)
      Sets a string value. This method must be overridden by subclasses that want to support the setting of string values in parallel to their native datatype. The default implementation always throws a runtime exception.
      Setzt außer Kraft:
      setStringValue in Klasse DataElement<String>
      Parameter:
      value - The new string value
    • newInstance

      protected StringDataElement newInstance()
      Returns a new instance of the respective data element sub-type on which it is invoked. This is needed for GWT which doesn't support reflection. Used by DataElement.copy(CopyMode, PropertyName...) for cloning an instance. Implementations should overwrite the return type with their concrete type to prevent the need for casting by the invoking code.
      Angegeben von:
      newInstance in Klasse DataElement<String>
      Gibt zurück:
      The new instance
    • updateValue

      protected final void updateValue(String newValue)
      Updates the element value. Will be invoked by DataElement.setValue(Object) to store a new value after validation. If a subclass wants to reject certain values it should do so in the DataElement.isValidValue(Validator, Object) method. Subclasses that are always immutable should implement an assertion because if the element has been initialized correctly (validator = NULL) this method should then be reached.
      Angegeben von:
      updateValue in Klasse DataElement<String>
      Parameter:
      newValue - The new value for this element