Class Property

java.lang.Object
com.swiftmq.mgmt.Property
All Implemented Interfaces:
Dumpable

public class Property extends 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.
  • Constructor Details

    • Property

      public Property(String name)
      Creates a new Property.
      Parameters:
      name - property name.
  • Method Details

    • convertToType

      public static Object convertToType(Class type, 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(DataOutput out) throws 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:
      IOException - if an error occurs
    • readContent

      public void readContent(DataInput in) throws 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:
      IOException - if an error occurs
    • getName

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

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

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

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

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

      public Object getValue()
      Returns the value.
      Returns:
      value.
    • setValue

      Set the value. This value must correspond to the type, specified for this Property.
      Parameters:
      value - the value.
      Throws:
      InvalidValueException - if the value doesn't match min/max/possibles.
      InvalidTypeException - if the value doesn't match the property type.
      PropertyChangeException - thrown by a PropertyChangeListener.
    • getType

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

      public void setType(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 Comparable getMinValue()
      Returns the minimum value.
      Returns:
      min value.
    • setMinValue

      public void setMinValue(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 Comparable getMaxValue()
      Returns the maximum value.
      Returns:
      max value.
    • setMaxValue

      public void setMaxValue(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 List getPossibleValues()
      Returns the list of possible values.
      Returns:
      list of possible values.
    • setPossibleValues

      public void setPossibleValues(List 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 List getPossibleValueDescriptions()
      Currently not used.
      Returns:
      list of descriptions.
    • setPossibleValueDescriptions

      public void setPossibleValueDescriptions(List 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 Object getDefaultValue()
      Returns the default value.
      Returns:
      default value.
    • setDefaultValue

      public void setDefaultValue(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 String toJson()
    • toString

      public String toString()
      Overrides:
      toString in class Object