Documentation of 'com.jstatcom.model.JSCString' Java class
JSCString
com.jstatcom.model

Class JSCString

  • All Implemented Interfaces:
    JSCData


    public final class JSCString
    extends AbstractJSCData
    A string wrapper that conforms to the JSCData interface.

    Whenever the value of this data object changes, registered JSCDataListeners are notified via a JSCDataEvent. If not otherwise stated, the event objects always contain the values before the change and after the change.

    This class is thread-safe. All access to mutable data is synchronized. All events are fired outside the synchronized blocks.

    • Field Detail

      • JSCString_XML

        public static final XmlFormat<JSCString> JSCString_XML
        XML format field for (de)serialization.
    • Constructor Detail

      • JSCString

        public JSCString(java.lang.String name)
        Creates an empty JSCString.
        Parameters:
        name - the identifier of that object
        Throws:
        java.lang.IllegalArgumentException - if name is not valid or if (name == null)
        See Also:
        JSCConstants.isValidName(java.lang.String)
      • JSCString

        public JSCString(java.lang.String name,
                         java.lang.String value)
        Creates a JSCString from value.
        Parameters:
        name - the identifier of that object
        value - the String to be used as value
        Throws:
        java.lang.IllegalArgumentException - if name is not valid or if (name == null)
        See Also:
        JSCConstants.isValidName(java.lang.String)
    • Method Detail

      • clear

        public void clear()
        Clears this data object. Fires:
        • JSCDataEventTypes.EMPTY_STATE event
        • JSCDataEventTypes.VALUE_CHANGED event
        if it was not empty before. After calling this method isEmpty returns true.
      • copy

        public JSCString copy()
        Description copied from interface: JSCData
        Gets a copy of the current object. Implementations of this method must fulfil the two conditions:
        • a.isEqual(a.copy())- compares values
        • a.getName().equals(a.copy().getName())- compares name
        JSCDataListeners attached to the original object should not be copied.
        Returns:
        a clonelike copy of the original object
        See Also:
        JSCData
      • isEmpty

        public boolean isEmpty()
        Gets whether this is empty. This method returns true, if value returns null. It does not check whether the value string has a length > 0.
        Returns:
        true if empty
      • isEqual

        public boolean isEqual(JSCData o)
        Description copied from interface: JSCData
        Gets whether the values of this data object and other are logically equal.
        Returns:
        true if considered equal according to the logic of the representation
        See Also:
        JSCData
      • name

        public java.lang.String name()
        Description copied from interface: JSCData
        Gets the name of the data object. It must fulfil the requirements for variable names defined in JSCConstants.
        Returns:
        the name
        See Also:
        JSCData
      • setVal

        public void setVal(java.lang.String newValue)
        Sets the value of this to newValue. Fires a JSCDataEvent of type:
        • JSCDataEventTypes.VALUE_CHANGED if !newValue.equals(getString())
        • JSCDataEventTypes.EMPTY_STATE if newValue != null and this was empty before
        • JSCDataEventTypes.EMPTY_STATE if newValue == null and this was not empty before
        Parameters:
        newValue - the new value
      • string

        public java.lang.String string()
        Gets the stored string value.
        Returns:
        a String or null if empty
      • type

        public JSCTypes type()
        Gets the type of this JSCData object.
        Returns:
        JSCTypes.STRING
        See Also:
        JSCTypes
      • value

        public java.lang.Object value()
        Gets the underlying value, which is stored as a String.
        Returns:
        the value object or null if this is empty

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.