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 voidaddPropertyWatchListener(PropertyWatchListener l)Add a PropertyWatchListener.static java.lang.ObjectconvertToType(java.lang.Class type, java.lang.String v)Converts a String into the given type.PropertycreateCopy()Creates a deep copy of this Property.java.lang.ObjectgetDefaultValue()Returns the default value.java.lang.StringgetDescription()Returns the description.java.lang.StringgetDisplayName()Returns the display name.intgetDumpId()Returns a unique dump id for this object.java.lang.ComparablegetMaxValue()Returns the maximum value.java.lang.ComparablegetMinValue()Returns the minimum value.java.lang.StringgetName()Returns the name.EntitygetParent()Returns the parent Entity.java.util.ListgetPossibleValueDescriptions()Currently not used.java.util.ListgetPossibleValues()Returns the list of possible values.PropertyChangeListenergetPropertyChangeListener()Returns the PropertyChangeListener.java.lang.ClassgetType()Returns the type.java.lang.ObjectgetValue()Returns the value.booleanisMandatory()Returns whether a value of this Property is mandatory.booleanisReadOnly()Returns whether this Property is read-only.booleanisRebootRequired()Returns whether a change of this Property requires a reboot of the router.booleanisStorable()Internal use only.voidreadContent(java.io.DataInput in)Read the content of this object from the stream.voidremovePropertyWatchListener(PropertyWatchListener l)Removes a PropertyWatchListener.voidsetDefaultProp(Property defaultProp)Set a default Property.voidsetDefaultValue(java.lang.Object defaultValue)Set the default value for this Property.voidsetDescription(java.lang.String description)Sets the description (displayed as tool tip in SwiftMQ Explorer).voidsetDisplayName(java.lang.String displayName)Set the display name (displayed in SwiftMQ Explorer).voidsetMandatory(boolean mandatory)Specified whether a value of this Property is mandatory.voidsetMaxValue(java.lang.Comparable maxValue)Set a maximum value for this Property.voidsetMinValue(java.lang.Comparable minValue)Set a minimum value for this Property.protected voidsetParent(Entity parent)voidsetPossibleValueDescriptions(java.util.List possibleValueDescriptions)Currently not used.voidsetPossibleValues(java.util.List possibleValues)Sets a list of possible value for String types.voidsetPropertyChangeListener(PropertyChangeListener propertyChangeListener)Set a PropertyChangeListener.voidsetReadOnly(boolean readOnly)Set this Property read-only or not.voidsetRebootRequired(boolean rebootRequired)Set whether a change of this Property requires a reboot of the router.voidsetStorable(boolean storable)Internal use only.voidsetType(java.lang.Class type)Set the type of this Property.voidsetValue(java.lang.Object value)Set the value.java.lang.StringtoJson()java.lang.StringtoString()voidwriteContent(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 InvalidTypeExceptionConverts 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:DumpableReturns a unique dump id for this object.
-
writeContent
public void writeContent(java.io.DataOutput out) throws java.io.IOExceptionDescription copied from interface:DumpableWrite the content of this object to the stream.- Specified by:
writeContentin interfaceDumpable- Parameters:
out- output stream- Throws:
java.io.IOException- if an error occurs
-
readContent
public void readContent(java.io.DataInput in) throws java.io.IOExceptionDescription copied from interface:DumpableRead the content of this object from the stream.- Specified by:
readContentin 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, PropertyChangeExceptionSet 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 InvalidTypeExceptionSet 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 InvalidTypeExceptionSet 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 InvalidTypeExceptionSet 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.List getPossibleValues()
Returns the list of possible values.- Returns:
- list of possible values.
-
setPossibleValues
public void setPossibleValues(java.util.List possibleValues) throws InvalidTypeExceptionSets 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.List getPossibleValueDescriptions()
Currently not used.- Returns:
- list of descriptions.
-
setPossibleValueDescriptions
public void setPossibleValueDescriptions(java.util.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 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:
toStringin classjava.lang.Object
-
-