Package com.swiftmq.mgmt
Class Property
- java.lang.Object
-
- com.swiftmq.mgmt.Property
-
-
Constructor Summary
Constructors Constructor Description Property(java.lang.String name)
Creates a new Property.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addPropertyWatchListener(PropertyWatchListener l)
Add a PropertyWatchListener.static java.lang.Object
convertToType(java.lang.Class type, java.lang.String v)
Converts a String into the given type.Property
createCopy()
Creates a deep copy of this Property.java.lang.Object
getDefaultValue()
Returns the default value.java.lang.String
getDescription()
Returns the description.java.lang.String
getDisplayName()
Returns the display name.int
getDumpId()
Returns a unique dump id for this object.java.lang.Comparable
getMaxValue()
Returns the maximum value.java.lang.Comparable
getMinValue()
Returns the minimum value.java.lang.String
getName()
Returns the name.Entity
getParent()
Returns the parent Entity.java.util.ArrayList
getPossibleValueDescriptions()
Currently not used.java.util.ArrayList
getPossibleValues()
Returns the list of possible values.PropertyChangeListener
getPropertyChangeListener()
Returns the PropertyChangeListener.java.lang.Class
getType()
Returns the type.java.lang.Object
getValue()
Returns the value.boolean
isMandatory()
Returns whether a value of this Property is mandatory.boolean
isReadOnly()
Returns whether this Property is read-only.boolean
isRebootRequired()
Returns whether a change of this Property requires a reboot of the router.boolean
isStorable()
Internal use only.void
readContent(java.io.DataInput in)
Read the content of this object from the stream.void
removePropertyWatchListener(PropertyWatchListener l)
Removes a PropertyWatchListener.void
setDefaultProp(Property defaultProp)
Set a default Property.void
setDefaultValue(java.lang.Object defaultValue)
Set the default value for this Property.void
setDescription(java.lang.String description)
Sets the description (displayed as tool tip in SwiftMQ Explorer).void
setDisplayName(java.lang.String displayName)
Set the display name (displayed in SwiftMQ Explorer).void
setMandatory(boolean mandatory)
Specified whether a value of this Property is mandatory.void
setMaxValue(java.lang.Comparable maxValue)
Set a maximum value for this Property.void
setMinValue(java.lang.Comparable minValue)
Set a minimum value for this Property.protected void
setParent(Entity parent)
void
setPossibleValueDescriptions(java.util.ArrayList possibleValueDescriptions)
Currently not used.void
setPossibleValues(java.util.ArrayList possibleValues)
Sets a list of possible value for String types.void
setPropertyChangeListener(PropertyChangeListener propertyChangeListener)
Set a PropertyChangeListener.void
setReadOnly(boolean readOnly)
Set this Property read-only or not.void
setRebootRequired(boolean rebootRequired)
Set whether a change of this Property requires a reboot of the router.void
setStorable(boolean storable)
Internal use only.void
setType(java.lang.Class type)
Set the type of this Property.void
setValue(java.lang.Object value)
Set the value.java.lang.String
toJson()
java.lang.String
toString()
void
writeContent(java.io.DataOutput out)
Write the content of this object to the stream.
-
-
-
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.
-
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 interfaceDumpable
- 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 interfaceDumpable
- 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.
-
setValue
public void setValue(java.lang.Object value) throws InvalidValueException, InvalidTypeException, PropertyChangeException
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 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 classjava.lang.Object
-
-