Package com.swiftmq.mgmt
Class Property
java.lang.Object
com.swiftmq.mgmt.Property
- All Implemented Interfaces:
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a PropertyWatchListener.static Object
convertToType
(Class type, String v) Converts a String into the given type.Creates a deep copy of this Property.Returns the default value.Returns the description.Returns the display name.int
Returns a unique dump id for this object.Returns the maximum value.Returns the minimum value.getName()
Returns the name.Returns the parent Entity.Currently not used.Returns the list of possible values.Returns the PropertyChangeListener.getType()
Returns the type.getValue()
Returns the value.boolean
Returns whether a value of this Property is mandatory.boolean
Returns whether this Property is read-only.boolean
Returns whether a change of this Property requires a reboot of the router.boolean
Internal use only.void
readContent
(DataInput in) Read the content of this object from the stream.void
Removes a PropertyWatchListener.void
setDefaultProp
(Property defaultProp) Set a default Property.void
setDefaultValue
(Object defaultValue) Set the default value for this Property.void
setDescription
(String description) Sets the description (displayed as tool tip in SwiftMQ Explorer).void
setDisplayName
(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
(Comparable maxValue) Set a maximum value for this Property.void
setMinValue
(Comparable minValue) Set a minimum value for this Property.protected void
void
setPossibleValueDescriptions
(List possibleValueDescriptions) Currently not used.void
setPossibleValues
(List 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
Set the type of this Property.void
Set the value.toJson()
toString()
void
writeContent
(DataOutput out) Write the content of this object to the stream.
-
Constructor Details
-
Property
Creates a new Property.- Parameters:
name
- property name.
-
-
Method Details
-
convertToType
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
Description copied from interface:Dumpable
Write the content of this object to the stream.- Specified by:
writeContent
in interfaceDumpable
- Parameters:
out
- output stream- Throws:
IOException
- if an error occurs
-
readContent
Description copied from interface:Dumpable
Read the content of this object from the stream.- Specified by:
readContent
in interfaceDumpable
- Parameters:
in
- input stream- Throws:
IOException
- if an error occurs
-
getName
Returns the name.- Returns:
- name.
-
getDisplayName
Returns the display name.- Returns:
- display name.
-
setDisplayName
Set the display name (displayed in SwiftMQ Explorer).- Parameters:
displayName
- display name.
-
getDescription
Returns the description.- Returns:
- description.
-
setDescription
Sets the description (displayed as tool tip in SwiftMQ Explorer).- Parameters:
description
- description.
-
getValue
Returns the value.- Returns:
- value.
-
setValue
public void setValue(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
Returns the type.- Returns:
- type.
-
setType
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
Returns the minimum value.- Returns:
- min value.
-
setMinValue
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
Returns the maximum value.- Returns:
- max value.
-
setMaxValue
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
Returns the list of possible values.- Returns:
- list of possible values.
-
setPossibleValues
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
Currently not used.- Returns:
- list of descriptions.
-
setPossibleValueDescriptions
Currently not used. Intended to use for SwiftMQ Explorer to display these descriptions instead of the values itself.- Parameters:
possibleValueDescriptions
- list of descriptions.
-
getDefaultValue
Returns the default value.- Returns:
- default value.
-
setDefaultValue
Set the default value for this Property.- Parameters:
defaultValue
- default value.
-
setDefaultProp
Set a default Property. Internal use only.- Parameters:
defaultProp
- default Property.
-
getPropertyChangeListener
Returns the PropertyChangeListener.- Returns:
- the listener.
-
setPropertyChangeListener
Set a PropertyChangeListener. There can only be one of this listeners which is the owner of this Property.- Parameters:
propertyChangeListener
- the listener.
-
addPropertyWatchListener
Add a PropertyWatchListener. There can be multiple of this listeners which are informed if the value changes.- Parameters:
l
- the listener.
-
removePropertyWatchListener
Removes a PropertyWatchListener.- Parameters:
l
- the listener.
-
getParent
Returns the parent Entity.- Returns:
- parent Entity.
-
setParent
-
createCopy
Creates a deep copy of this Property.- Returns:
- copy.
-
toJson
-
toString
-