Class Property

  • All Implemented Interfaces:
    Dumpable

    public class Property
    extends java.lang.Object
    implements Dumpable
    A Property object is part of an Entity. It consists of a name and a value and further meta data like min/max etc.
    Author:
    IIT GmbH, Bremen/Germany, Copyright (c) 2000-2002, All Rights Reserved
    • Constructor Detail

      • Property

        public Property​(java.lang.String name)
        Creates a new Property.
        Parameters:
        name - property name.
    • Method Detail

      • convertToType

        public static java.lang.Object convertToType​(java.lang.Class type,
                                                     java.lang.String v)
                                              throws InvalidTypeException
        Converts a String into the given type.
        Parameters:
        type - the type.
        v - the string value.
        Returns:
        the converted object.
        Throws:
        InvalidTypeException - on invalid type.
      • getDumpId

        public int getDumpId()
        Description copied from interface: Dumpable
        Returns a unique dump id for this object.
        Specified by:
        getDumpId in interface Dumpable
        Returns:
        unique dump id
      • writeContent

        public void writeContent​(java.io.DataOutput out)
                          throws java.io.IOException
        Description copied from interface: Dumpable
        Write the content of this object to the stream.
        Specified by:
        writeContent in interface Dumpable
        Parameters:
        out - output stream
        Throws:
        java.io.IOException - if an error occurs
      • readContent

        public void readContent​(java.io.DataInput in)
                         throws java.io.IOException
        Description copied from interface: Dumpable
        Read the content of this object from the stream.
        Specified by:
        readContent in interface Dumpable
        Parameters:
        in - input stream
        Throws:
        java.io.IOException - if an error occurs
      • getName

        public java.lang.String getName()
        Returns the name.
        Returns:
        name.
      • getDisplayName

        public java.lang.String getDisplayName()
        Returns the display name.
        Returns:
        display name.
      • setDisplayName

        public void setDisplayName​(java.lang.String displayName)
        Set the display name (displayed in SwiftMQ Explorer).
        Parameters:
        displayName - display name.
      • getDescription

        public java.lang.String getDescription()
        Returns the description.
        Returns:
        description.
      • setDescription

        public void setDescription​(java.lang.String description)
        Sets the description (displayed as tool tip in SwiftMQ Explorer).
        Parameters:
        description - description.
      • getValue

        public java.lang.Object getValue()
        Returns the value.
        Returns:
        value.
      • getType

        public java.lang.Class getType()
        Returns the type.
        Returns:
        type.
      • setType

        public void setType​(java.lang.Class type)
                     throws InvalidTypeException
        Set the type of this Property. Must be in Boolean, Double, Integer, Long, String, Float.
        Parameters:
        type - the type.
        Throws:
        InvalidTypeException - if not Boolean, Double, Integer, Long, String, Float.
      • isReadOnly

        public boolean isReadOnly()
        Returns whether this Property is read-only.
        Returns:
        true/false.
      • setReadOnly

        public void setReadOnly​(boolean readOnly)
        Set this Property read-only or not. It cannot be changed through SwiftMQ Explorer/CLI when set to read-only.
        Parameters:
        readOnly - true/false.
      • isStorable

        public boolean isStorable()
        Internal use only.
      • setStorable

        public void setStorable​(boolean storable)
        Internal use only.
      • isRebootRequired

        public boolean isRebootRequired()
        Returns whether a change of this Property requires a reboot of the router.
        Returns:
        true/false.
      • setRebootRequired

        public void setRebootRequired​(boolean rebootRequired)
        Set whether a change of this Property requires a reboot of the router. If true, SwiftMQ Explorer/CLI display a resp. message and a PropertyChangeListener isn't required.
        Parameters:
        rebootRequired - true/false.
      • isMandatory

        public boolean isMandatory()
        Returns whether a value of this Property is mandatory.
        Returns:
        true/false.
      • setMandatory

        public void setMandatory​(boolean mandatory)
        Specified whether a value of this Property is mandatory. In case of true and when creating a new Entity with SwiftMQ Explorer/CLI, these tools will check whether a value is set and display an error if the value isn't specified by the user.
        Parameters:
        mandatory - true/false.
      • getMinValue

        public java.lang.Comparable getMinValue()
        Returns the minimum value.
        Returns:
        min value.
      • setMinValue

        public void setMinValue​(java.lang.Comparable minValue)
                         throws InvalidTypeException
        Set a minimum value for this Property. If set, setValue() will always verify the input against this value.
        Parameters:
        minValue - min value.
        Throws:
        InvalidTypeException - if a type is not set.
      • getMaxValue

        public java.lang.Comparable getMaxValue()
        Returns the maximum value.
        Returns:
        max value.
      • setMaxValue

        public void setMaxValue​(java.lang.Comparable maxValue)
                         throws InvalidTypeException
        Set a maximum value for this Property. If set, setValue() will always verify the input against this value.
        Parameters:
        maxValue - max value.
        Throws:
        InvalidTypeException - if a type is not set.
      • getPossibleValues

        public java.util.ArrayList getPossibleValues()
        Returns the list of possible values.
        Returns:
        list of possible values.
      • setPossibleValues

        public void setPossibleValues​(java.util.ArrayList possibleValues)
                               throws InvalidTypeException
        Sets a list of possible value for String types. If set, setValue() will always verify the input against this value.
        Parameters:
        possibleValues - list of possible values.
        Throws:
        InvalidTypeException - if a type is not set or a type in the list doesn't match the Property type.
      • getPossibleValueDescriptions

        public java.util.ArrayList getPossibleValueDescriptions()
        Currently not used.
        Returns:
        list of descriptions.
      • setPossibleValueDescriptions

        public void setPossibleValueDescriptions​(java.util.ArrayList possibleValueDescriptions)
        Currently not used. Intended to use for SwiftMQ Explorer to display these descriptions instead of the values itself.
        Parameters:
        possibleValueDescriptions - list of descriptions.
      • getDefaultValue

        public java.lang.Object getDefaultValue()
        Returns the default value.
        Returns:
        default value.
      • setDefaultValue

        public void setDefaultValue​(java.lang.Object defaultValue)
        Set the default value for this Property.
        Parameters:
        defaultValue - default value.
      • setDefaultProp

        public void setDefaultProp​(Property defaultProp)
        Set a default Property. Internal use only.
        Parameters:
        defaultProp - default Property.
      • getPropertyChangeListener

        public PropertyChangeListener getPropertyChangeListener()
        Returns the PropertyChangeListener.
        Returns:
        the listener.
      • setPropertyChangeListener

        public void setPropertyChangeListener​(PropertyChangeListener propertyChangeListener)
        Set a PropertyChangeListener. There can only be one of this listeners which is the owner of this Property.
        Parameters:
        propertyChangeListener - the listener.
      • addPropertyWatchListener

        public void addPropertyWatchListener​(PropertyWatchListener l)
        Add a PropertyWatchListener. There can be multiple of this listeners which are informed if the value changes.
        Parameters:
        l - the listener.
      • removePropertyWatchListener

        public void removePropertyWatchListener​(PropertyWatchListener l)
        Removes a PropertyWatchListener.
        Parameters:
        l - the listener.
      • getParent

        public Entity getParent()
        Returns the parent Entity.
        Returns:
        parent Entity.
      • setParent

        protected void setParent​(Entity parent)
      • createCopy

        public Property createCopy()
        Creates a deep copy of this Property.
        Returns:
        copy.
      • toJson

        public java.lang.String toJson()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object