org.norther.tammi.core.rt
Class VariableAttributeInfo

java.lang.Object
  extended by javax.management.MBeanFeatureInfo
      extended by javax.management.MBeanAttributeInfo
          extended by org.norther.tammi.core.rt.VariableAttributeInfo
All Implemented Interfaces:
Serializable, Cloneable, DescriptorRead

public class VariableAttributeInfo
extends MBeanAttributeInfo

A meta-data description of a variable attribute.

Note that attribute names are capitalized according to JMX naming rules.

Version:
$Id: VariableAttributeInfo.java,v 1.102 2009/09/28 15:08:45 cvsimp Exp $
Author:
Ilkka Priha
See Also:
Serialized Form

Nested Class Summary
static class VariableAttributeInfo.Trait
          Attribute traits.
 
Field Summary
static String ATTRIBUTE_PACKAGE
          The default attribute package.
static String COMPARATOR_FIELD
          The comparator field.
static String DESCRIPTION_SUFFIX
          The description suffix.
static String DETAIL_FIELD
          The detail field.
static String DETAIL_SUFFIX
          The detail suffix.
static String ENUM_SUFFIX
          The enum suffix.
static String ENUMERATION_FIELD
          The enumeration field.
static String GROUP_FIELD
          The group field.
static String GROUP_SUFFIX
          The group suffix.
static String MAX_SIZE_FIELD
          The max size field.
static String MAX_VALUE_FIELD
          The max value field.
static String MIN_SIZE_FIELD
          The min size field.
static String MIN_VALUE_FIELD
          The min value field.
static String PATTERN_FIELD
          The pattern field.
static String QUALIFIER_FIELD
          The qualifier field.
static String SHADOW_FIELD
          The shadow field.
static String TRAITS_FIELD
          The traits field.
 
Fields inherited from class javax.management.MBeanFeatureInfo
description, name
 
Constructor Summary
VariableAttributeInfo(Object value, MBeanAttributeInfo info, MBeanReference<?> owner)
          Constructs an attribute description from MBeanAttributeInfo for the specified MBean.
VariableAttributeInfo(Object value, MBeanConstructorInfo info, MBeanReference<?> owner)
          Constructs an attribute description from MBeanConstructorInfo for the specified MBean.
VariableAttributeInfo(Object value, MBeanFeatureInfo info, MBeanReference<?> owner)
          Constructs an attribute description from MBeanFeatureInfo for the specified MBean.
VariableAttributeInfo(Object value, MBeanOperationInfo info, MBeanReference<?> owner)
          Constructs an attribute description from MBeanOperationInfo for the specified MBean.
VariableAttributeInfo(Object value, MBeanParameterInfo info, MBeanReference<?> owner)
          Constructs an attribute description from MBeanParameterInfo for the specified MBean.
VariableAttributeInfo(Object value, String attr, String type, String descr, String grp, String spec, boolean readable, boolean writable, boolean mandatory, boolean localized)
          Constructs an attribute description.
VariableAttributeInfo(Object value, String attr, String type, String descr, String grp, String spec, boolean readable, boolean writable, boolean mandatory, boolean localized, List<?> list)
          Constructs an attribute description with a limited set of allowed values.
VariableAttributeInfo(Object value, String attr, String type, String descr, String grp, String spec, boolean readable, boolean writable, boolean mandatory, boolean localized, String pattern)
          Constructs an attribute description with a pattern.
VariableAttributeInfo(Object value, String attr, String type, String descr, String grp, String spec, boolean readable, boolean writable, boolean mandatory, boolean localized, String pattern, List<?> list)
          Constructs an attribute description with a limited set of allowed values and a conversion pattern.
VariableAttributeInfo(String attr, String type, String descr)
          Constructs a non-initialized attribute description.
VariableAttributeInfo(String attr, String type, String descr, Descriptor dtor)
          Constructs a non-initialized attribute description with a descriptor.
VariableAttributeInfo(String attr, String type, String descr, Descriptor dtor, MBeanReference<?> owner)
          Constructs a non-initialized attribute description for the specified MBean with a descriptor.
VariableAttributeInfo(String attr, String type, String descr, MBeanReference<?> owner)
          Constructs a non-initialized attribute description for the specified MBean.
 
Method Summary
 void clearLocalizedEnumerations()
          Clears all localized enumerations of allowed attribute values.
 Object clone()
          Clones this object.
 Object convertValue(Object value, Object... localization)
          Converts an attribute value from an external type to the internal one by applying applicable attribute traits.
 boolean equals(Object obj)
          Checks equality of this object.
<T> Comparator<T>
getComparator()
          Gets the comparator of this attribute.
 Class<?> getComponentClass()
          Gets the component object class of this attribute.
<E extends Enum<?>>
E
getConstant(Class<E> clazz)
          Gets the specified constant.
 Object getDefaultValue()
          Gets the default attribute value.
 Descriptor getDescriptor()
          Gets the descriptor of this attribute.
 String getDetail()
          Gets the detail of this attribute.
 EnumeratedList getEnumeration()
          Gets the enumeration of allowed attribute values.
 String getGroup()
          Gets the group of this attribute.
<L extends EventListener>
L[]
getListeners(Class<L> clazz)
          Gets the specified listeners.
 EnumeratedList getLocalizedEnumeration(Locale locale)
          Gets a localized enumeration of allowed attribute values.
 int getMaxSize()
          Gets the maximum size of this attribute.
 Object getMaxValue()
          Gets the maximum value of this attribute.
 int getMinSize()
          Gets the minimum size of this attribute.
 Object getMinValue()
          Gets the minimum value of this attribute.
 ObjectName getOwnerName()
          Gets the name of the owner of this attribute.
 String getPattern()
          Gets the value pattern of this attribute.
 String getQualifier()
          Gets the qualifier of this attribute.
 String getShadow()
          Gets the shadow pattern of this attribute.
 int getTraits()
          Gets permanent traits of this attribute.
 int hashCode()
           
 boolean isArray()
          Checks whether this attribute is of array type.
 boolean isBoolean()
          Checks whether this attribute is of boolean type.
 boolean isCloneable()
          Gets the cloneable flag of this attribute.
 boolean isDefined()
          Checks whether this attribute is defined.
 boolean isElement()
          Checks whether this attribute is of element type.
 boolean isEnum()
          Checks whether this attribute is of enum type.
 boolean isEnumerated()
          Checks whether this attribute is enumerated.
 boolean isImmutable()
          Checks whether this attribute is immutable.
 boolean isInteractive()
          Gets the interactive flag of this attribute.
 boolean isMandatory()
          Gets the mandatory flag of this attribute.
 boolean isNumeric()
          Checks whether this attribute is of numeric type.
 boolean isObjectName()
          Checks whether this attribute is of object name type.
 boolean isPrimitive()
          Checks whether this attribute is of primitive type.
 boolean isReadable()
          Gets the readable flag of this attribute.
 boolean isSerialized()
          Gets the serialized flag of this attribute.
 boolean isTrait(VariableAttributeInfo.Trait trait)
          Gets the specified trait of this attribute.
 boolean isTransient()
          Gets the transient flag of this attribute.
 boolean isValidValue(Object value, Object... localization)
          Checks whether an attribute value is valid.
 boolean isWritable()
          Gets the writable flag of this attribute.
 void resetCloneAccess()
          Resets all temporary masks to their original values.
 void resetReadAccess()
          Resets readable and serializable masks to their original values.
 void resetWriteAccess()
          Resets writable, mandatory and transient masks to their original values.
 void setCloneable(boolean flag)
          Sets the cloneable flag of this attribute.
<T> void
setComparator(Comparator<T> comparator)
          Sets the comparator of this attribute.
<E extends Enum<?>>
void
setConstant(Class<E> clazz, E constant)
          Sets the specified constant.
 void setDefaultValue(Object value)
          Sets the default attribute value after validation.
 void setDescription(String descr)
          Sets the description of this attribute.
 void setDetail(String detail)
          Sets the detail of this attribute.
 void setEnumeration(List<?> list)
          Sets the enumeration of allowed attribute values.
 void setGroup(String group)
          Sets the group of this attribute.
 void setImmutable(boolean flag)
          Sets whether this attribute is immutable.
 void setInteractive(boolean flag)
          Sets the interactive flag of this attribute.
<L extends EventListener>
void
setListeners(Class<L> clazz, L[] listeners)
          Sets the specified listeners.
 void setLocalizedEnumeration(Locale locale, EnumeratedList enums)
          Sets the localized enumeration of allowed attribute values.
 void setMandatory(boolean flag)
          Sets the mandatory flag of this attribute.
 void setMaxSize(int max)
          Sets the maximum size of this attribute.
 void setMaxValue(Object max)
          Sets the maximum value of this attribute.
 void setMinSize(int min)
          Sets the minimum size of this attribute.
 void setMinValue(Object min)
          Sets the minimum value of this attribute.
 void setPattern(String pattern)
          Sets the value pattern of this attribute.
 void setQualifier(String qualifier)
          Sets the qualifier of this attribute.
 void setReadable(boolean flag)
          Sets the readable flag of this attribute.
 void setSerialized(boolean flag)
          Sets the serialized flag of this attribute.
 void setShadow(String pattern)
          Sets the shadow pattern of this attribute.
 void setTrait(VariableAttributeInfo.Trait trait, boolean flag)
          Sets the specified trait of this attribute.
 void setTraits(int traits)
          Sets permanent traits of this attribute.
 void setTransient(boolean flag)
          Sets the transient flag of this attribute.
 void setWritable(boolean flag)
          Sets the writable flag of this attribute.
static String toLocalizedDescription(String type, String name)
          Generates a localized description key.
static String toLocalizedDetail(String type, String name)
          Generates a localized detail key.
static String toLocalizedGroup(String type, String name)
          Generates a localized group key.
 String toSerializable(Object value, Object... localization)
          Converts the specified attribute value to a serializable string.
 String[] toSerializables(Object values, Object... localization)
          Converts the specified attribute values to a serializable string array.
 String toShadow()
          Converts this attribute to a shadow.
 String[] toShadows()
          Converts the this attribute to a shadows.
 String toString(Object value, Object... localization)
          Converts the specified attribute value to a string.
 String[] toStrings(Object value, Object... localization)
          Converts the specified attribute value to a string array.
 Object validateValue(Object value, Object... localization)
          Validates an attribute value.
 
Methods inherited from class javax.management.MBeanAttributeInfo
getType, isIs, toString
 
Methods inherited from class javax.management.MBeanFeatureInfo
getDescription, getName
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ATTRIBUTE_PACKAGE

public static final String ATTRIBUTE_PACKAGE
The default attribute package.


TRAITS_FIELD

public static final String TRAITS_FIELD
The traits field.


GROUP_FIELD

public static final String GROUP_FIELD
The group field.


DETAIL_FIELD

public static final String DETAIL_FIELD
The detail field.


QUALIFIER_FIELD

public static final String QUALIFIER_FIELD
The qualifier field.


MIN_VALUE_FIELD

public static final String MIN_VALUE_FIELD
The min value field.


MAX_VALUE_FIELD

public static final String MAX_VALUE_FIELD
The max value field.


MIN_SIZE_FIELD

public static final String MIN_SIZE_FIELD
The min size field.


MAX_SIZE_FIELD

public static final String MAX_SIZE_FIELD
The max size field.


PATTERN_FIELD

public static final String PATTERN_FIELD
The pattern field.


SHADOW_FIELD

public static final String SHADOW_FIELD
The shadow field.


COMPARATOR_FIELD

public static final String COMPARATOR_FIELD
The comparator field.


ENUMERATION_FIELD

public static final String ENUMERATION_FIELD
The enumeration field.


DESCRIPTION_SUFFIX

public static final String DESCRIPTION_SUFFIX
The description suffix.

See Also:
Constant Field Values

DETAIL_SUFFIX

public static final String DETAIL_SUFFIX
The detail suffix.

See Also:
Constant Field Values

GROUP_SUFFIX

public static final String GROUP_SUFFIX
The group suffix.

See Also:
Constant Field Values

ENUM_SUFFIX

public static final String ENUM_SUFFIX
The enum suffix.

See Also:
Constant Field Values
Constructor Detail

VariableAttributeInfo

public VariableAttributeInfo(String attr,
                             String type,
                             String descr)
Constructs a non-initialized attribute description.

Parameters:
attr - the name of the attribute.
type - the type or class name of the attribute.
descr - a human readable description of the attribute.

VariableAttributeInfo

public VariableAttributeInfo(String attr,
                             String type,
                             String descr,
                             MBeanReference<?> owner)
Constructs a non-initialized attribute description for the specified MBean.

Parameters:
attr - the name of the attribute.
type - the type or class name of the attribute.
descr - a human readable description of the attribute.
owner - the optional owner of the attribute.

VariableAttributeInfo

public VariableAttributeInfo(String attr,
                             String type,
                             String descr,
                             Descriptor dtor)
Constructs a non-initialized attribute description with a descriptor.

Parameters:
attr - the name of the attribute.
type - the type or class name of the attribute.
descr - a human readable description of the attribute.
dtor - the attribute descriptor.

VariableAttributeInfo

public VariableAttributeInfo(String attr,
                             String type,
                             String descr,
                             Descriptor dtor,
                             MBeanReference<?> owner)
Constructs a non-initialized attribute description for the specified MBean with a descriptor.

Parameters:
attr - the name of the attribute.
type - the type or class name of the attribute.
descr - a human readable description of the attribute.
dtor - the attribute descriptor.
owner - the optional owner of the attribute.

VariableAttributeInfo

public VariableAttributeInfo(Object value,
                             String attr,
                             String type,
                             String descr,
                             String grp,
                             String spec,
                             boolean readable,
                             boolean writable,
                             boolean mandatory,
                             boolean localized)
Constructs an attribute description.

Parameters:
value - the initial value of the attribute as an object.
attr - the name of the attribute.
type - the type or class name of the attribute.
descr - a human readable description of the attribute.
grp - an optional group of the attribute.
spec - an optional detail of the attribute.
readable - true if the attribute has a getter method, false otherwise.
writable - true if the attribute has a setter method, false otherwise.
mandatory - true if the attribute is mandatory, false otherwise.
localized - true if the attribute value can be localized, false otherwise.

VariableAttributeInfo

public VariableAttributeInfo(Object value,
                             String attr,
                             String type,
                             String descr,
                             String grp,
                             String spec,
                             boolean readable,
                             boolean writable,
                             boolean mandatory,
                             boolean localized,
                             String pattern)
Constructs an attribute description with a pattern.

Parameters:
value - the initial value of the attribute.
attr - the name of the attribute.
type - the type or class name of the attribute.
descr - a human readable description of the attribute.
grp - an optional group of the attribute.
spec - an optional detail of the attribute.
readable - true if the attribute has a getter method, false otherwise.
writable - true if the attribute has a setter method, false otherwise.
mandatory - true if the attribute is mandatory, false otherwise.
localized - true if the attribute value can be localized, false otherwise.
pattern - an optional conversion pattern.

VariableAttributeInfo

public VariableAttributeInfo(Object value,
                             String attr,
                             String type,
                             String descr,
                             String grp,
                             String spec,
                             boolean readable,
                             boolean writable,
                             boolean mandatory,
                             boolean localized,
                             List<?> list)
Constructs an attribute description with a limited set of allowed values.

Parameters:
value - the initial value of the attribute.
attr - the name of the attribute.
type - the type or class name of the attribute.
descr - a human readable description of the attribute.
grp - an optional group of the attribute.
spec - an optional detail of the attribute.
readable - true if the attribute has a getter method, false otherwise.
writable - true if the attribute has a setter method, false otherwise.
mandatory - true if this attribute is mandatory, false otherwise.
localized - true if the attribute value can be localized, false otherwise.
list - a list of allowed values of the attribute.

VariableAttributeInfo

public VariableAttributeInfo(Object value,
                             String attr,
                             String type,
                             String descr,
                             String grp,
                             String spec,
                             boolean readable,
                             boolean writable,
                             boolean mandatory,
                             boolean localized,
                             String pattern,
                             List<?> list)
Constructs an attribute description with a limited set of allowed values and a conversion pattern.

Parameters:
value - the initial value of the attribute.
attr - the name of the attribute.
type - the type or class name of the attribute.
descr - a human readable description of the attribute.
grp - an optional group of the attribute.
spec - an optional detail of the attribute.
readable - true if the attribute has a getter method, false otherwise.
writable - true if the attribute has a setter method, false otherwise.
mandatory - true if this attribute is mandatory, false otherwise.
localized - true if the attribute value can be localized, false otherwise.
pattern - an optional conversion pattern.
list - a list of allowed values of the attribute.

VariableAttributeInfo

public VariableAttributeInfo(Object value,
                             MBeanAttributeInfo info,
                             MBeanReference<?> owner)
Constructs an attribute description from MBeanAttributeInfo for the specified MBean.

Parameters:
value - the initial value of the attribute.
info - the feature info to apply.
owner - the optional owner of the attribute.

VariableAttributeInfo

public VariableAttributeInfo(Object value,
                             MBeanOperationInfo info,
                             MBeanReference<?> owner)
Constructs an attribute description from MBeanOperationInfo for the specified MBean.

Parameters:
value - the initial value of the attribute.
info - the feature info to apply.
owner - the optional owner of the attribute.
Throws:
NullPointerException - for missing arguments.

VariableAttributeInfo

public VariableAttributeInfo(Object value,
                             MBeanConstructorInfo info,
                             MBeanReference<?> owner)
Constructs an attribute description from MBeanConstructorInfo for the specified MBean.

Parameters:
value - the initial value of the attribute.
info - the feature info to apply.
owner - the optional owner of the attribute.
Throws:
NullPointerException - for missing arguments.

VariableAttributeInfo

public VariableAttributeInfo(Object value,
                             MBeanParameterInfo info,
                             MBeanReference<?> owner)
Constructs an attribute description from MBeanParameterInfo for the specified MBean.

Parameters:
value - the initial value of the attribute.
info - the feature info to apply.
owner - the optional owner of the attribute.
Throws:
NullPointerException - for missing arguments.

VariableAttributeInfo

public VariableAttributeInfo(Object value,
                             MBeanFeatureInfo info,
                             MBeanReference<?> owner)
Constructs an attribute description from MBeanFeatureInfo for the specified MBean.

Parameters:
value - the initial value of the attribute.
info - the feature info to apply.
owner - the optional owner of the attribute.
Throws:
NullPointerException - for missing arguments.
Method Detail

toLocalizedDescription

public static String toLocalizedDescription(String type,
                                            String name)
Generates a localized description key.

Parameters:
type - the variable type.
name - the attribute name.
Returns:
the localized description.

toLocalizedDetail

public static String toLocalizedDetail(String type,
                                       String name)
Generates a localized detail key.

Parameters:
type - the variable type.
name - the attribute name.
Returns:
the localized detail.

toLocalizedGroup

public static String toLocalizedGroup(String type,
                                      String name)
Generates a localized group key.

Parameters:
type - the variable type.
name - the attribute name.
Returns:
the localized group.

clone

public Object clone()
Clones this object.

Overrides:
clone in class MBeanAttributeInfo
Returns:
the cloned object.

equals

public boolean equals(Object obj)
Checks equality of this object. Note that the attribute owner is not included in the comparison.

Overrides:
equals in class MBeanAttributeInfo
Parameters:
obj - the object with which to compare.
Returns:
true for the same object, otherwise false.

hashCode

public int hashCode()
Overrides:
hashCode in class MBeanAttributeInfo

getComponentClass

public Class<?> getComponentClass()
Gets the component object class of this attribute.

Returns:
the component class or null.

isImmutable

public boolean isImmutable()
Checks whether this attribute is immutable.

Returns:
true if immutable, false otherwise.

setImmutable

public void setImmutable(boolean flag)
Sets whether this attribute is immutable. Once set to true, the attribute remains defined and immutable until cloned.

Parameters:
flag - true if immutable, false otherwise.

isDefined

public boolean isDefined()
Checks whether this attribute is defined. Defined only traits of a defined attribute cannot be modified even after cloning.

Returns:
true if defined, false otherwise.

getTraits

public int getTraits()
Gets permanent traits of this attribute.

Returns:
the permanent trait mask.

setTraits

public void setTraits(int traits)
Sets permanent traits of this attribute.

Parameters:
traits - the permanent trait mask.

isTrait

public boolean isTrait(VariableAttributeInfo.Trait trait)
Gets the specified trait of this attribute.

Parameters:
trait - the trait to get.
Returns:
true for a set trait, false for cleared.

setTrait

public void setTrait(VariableAttributeInfo.Trait trait,
                     boolean flag)
Sets the specified trait of this attribute.

Parameters:
trait - the trait to set.
flag - true to set a trait, false to clear.

isArray

public boolean isArray()
Checks whether this attribute is of array type.

Returns:
true for an array attribute, otherwise false.

isPrimitive

public boolean isPrimitive()
Checks whether this attribute is of primitive type.

Primitive attributes may not accept null values.

Returns:
true for a primitive attribute, otherwise false.

isNumeric

public boolean isNumeric()
Checks whether this attribute is of numeric type.

Returns:
true for a numeric attribute, otherwise false.

isBoolean

public boolean isBoolean()
Checks whether this attribute is of boolean type.

Returns:
true for a boolean attribute, otherwise false.

isEnum

public boolean isEnum()
Checks whether this attribute is of enum type.

Enum attributes are automatically enumerated.

Returns:
true for an enum attribute, otherwise false.

isElement

public boolean isElement()
Checks whether this attribute is of element type.

Element attributes represent references to array elements.

Returns:
true for an element attribute, otherwise false.

isObjectName

public boolean isObjectName()
Checks whether this attribute is of object name type.

Object name attributes may have customized enumerations.

Returns:
true for an object name attribute, otherwise false.

isReadable

public boolean isReadable()
Gets the readable flag of this attribute.

Overrides:
isReadable in class MBeanAttributeInfo
Returns:
true for a readable attribute, otherwise false.

setReadable

public void setReadable(boolean flag)
Sets the readable flag of this attribute. Once set to false, the true flag is valid only until the next read operation.

Parameters:
flag - true for a readable attribute, otherwise false.

isWritable

public boolean isWritable()
Gets the writable flag of this attribute.

Overrides:
isWritable in class MBeanAttributeInfo
Returns:
true for a writable attribute, otherwise false.

setWritable

public void setWritable(boolean flag)
Sets the writable flag of this attribute. Once set to false, the true flag is valid only until the next write operation.

Parameters:
flag - true for a writable attribute, otherwise false.

isCloneable

public boolean isCloneable()
Gets the cloneable flag of this attribute.

Returns:
true for a blank nulled attribute.

setCloneable

public void setCloneable(boolean flag)
Sets the cloneable flag of this attribute. Once set to false, the true flag is valid only until the next clone operation.

Parameters:
flag - true for a cloneable attribute, otherwise false.

isMandatory

public boolean isMandatory()
Gets the mandatory flag of this attribute.

Returns:
true if the attribute is mandatory, otherwise false.

setMandatory

public void setMandatory(boolean flag)
Sets the mandatory flag of this attribute. Once set to true, the false flag is valid only until the next write operation.

Parameters:
flag - true for a mandatory attribute, otherwise false.

isTransient

public boolean isTransient()
Gets the transient flag of this attribute.

Returns:
true if the attribute is transient, otherwise false.

setTransient

public void setTransient(boolean flag)
Sets the transient flag of this attribute. Once set to true, the false flag is valid only until the next write operation.

Changes to values of transient attributes should not be saved by the applied persistence mechanisms.

Parameters:
flag - true for a transient attribute, otherwise false.

isSerialized

public boolean isSerialized()
Gets the serialized flag of this attribute.

Returns:
true if the attribute is serialized, otherwise false.

setSerialized

public void setSerialized(boolean flag)
Sets the serialized flag of this attribute. Once set to true, the false flag is valid only until the next read operation.

Values of serialized attributes should be saved as strings by the applied persistence mechanisms.

Parameters:
flag - true for a serialized attribute, otherwise false.

isInteractive

public boolean isInteractive()
Gets the interactive flag of this attribute.

Returns:
true for an interactive attribute, otherwise false.

setInteractive

public void setInteractive(boolean flag)
Sets the interactive flag of this attribute. Once set to true, the false flag is valid only until the next write operation.

Changes to values of interactive attributes should redisplay any interactive views related to the attribute.

Parameters:
flag - true for an interactive attribute, otherwise false.

resetCloneAccess

public void resetCloneAccess()
Resets all temporary masks to their original values.


resetReadAccess

public void resetReadAccess()
Resets readable and serializable masks to their original values.


resetWriteAccess

public void resetWriteAccess()
Resets writable, mandatory and transient masks to their original values.


getDefaultValue

public Object getDefaultValue()
Gets the default attribute value.

Note that the value is cloned unless the cloneable flag is set to false.

Returns:
the default attribute value.

setDefaultValue

public void setDefaultValue(Object value)
Sets the default attribute value after validation.

Parameters:
value - the default attribute value.
Throws:
RuntimeConversionException - if the conversion fails.
NumberFormatException - if the value is an invalid number.
ClassCastException - if the value is of incorrect type.
UnsupportedOperationException - if the value cannot be converted.
IllegalArgumentException - if the value is invalid.
IndexOutOfBoundsException - if array indices are exceeded.
NullPointerException - if the conversion detects nulls.

setDescription

public void setDescription(String descr)
Sets the description of this attribute.

Parameters:
descr - the attribute description.

getGroup

public String getGroup()
Gets the group of this attribute.

Returns:
the attribute group.

setGroup

public void setGroup(String group)
Sets the group of this attribute. The group may be applied to collect related attributes into groups.

Parameters:
group - the attribute group.

getDetail

public String getDetail()
Gets the detail of this attribute.

Returns:
the attribute detail.

setDetail

public void setDetail(String detail)
Sets the detail of this attribute. The detail may be applied to specify the attribute in more detail than with the description.

Parameters:
detail - the attribute detail.

getQualifier

public String getQualifier()
Gets the qualifier of this attribute.

Returns:
the attribute qualifier.

setQualifier

public void setQualifier(String qualifier)
Sets the qualifier of this attribute. The qualifier may be applied to specify the attribute more abstractly than with the description.

Parameters:
qualifier - the attribute qualifier.

getMinValue

public Object getMinValue()
Gets the minimum value of this attribute.

Returns:
the minimum or null if not defined.

setMinValue

public void setMinValue(Object min)
Sets the minimum value of this attribute.

Parameters:
min - the minimum or null if not defined.
Throws:
NumberFormatException - if any value is an invalid number.
ClassCastException - if the value is of incorrect type.
UnsupportedOperationException - if the value cannot be converted.
IllegalArgumentException - if the value is out of bounds.

getMaxValue

public Object getMaxValue()
Gets the maximum value of this attribute.

Returns:
the maximum or null if not defined.

setMaxValue

public void setMaxValue(Object max)
Sets the maximum value of this attribute.

Parameters:
max - the maximum or null if not defined.
Throws:
NumberFormatException - if any value is an invalid number.
ClassCastException - if the value is of incorrect type.
UnsupportedOperationException - if the value cannot be converted.
IllegalArgumentException - if the value is out of bounds.

getMinSize

public int getMinSize()
Gets the minimum size of this attribute.

Returns:
the minimum size or 0 if not defined.

setMinSize

public void setMinSize(int min)
Sets the minimum size of this attribute.

Parameters:
min - the minimum size.

getMaxSize

public int getMaxSize()
Gets the maximum size of this attribute.

Returns:
the maximum size or -1 if unlimited.

setMaxSize

public void setMaxSize(int max)
Sets the maximum size of this attribute.

Parameters:
max - the maximum size.

getPattern

public String getPattern()
Gets the value pattern of this attribute.

Returns:
the pattern or null if not defined.

setPattern

public void setPattern(String pattern)
Sets the value pattern of this attribute.

Parameters:
pattern - the pattern or null if not defined.

getShadow

public String getShadow()
Gets the shadow pattern of this attribute.

Returns:
the pattern or null if not defined.

setShadow

public void setShadow(String pattern)
Sets the shadow pattern of this attribute.

Parameters:
pattern - the pattern or null if not defined.

getComparator

public <T> Comparator<T> getComparator()
Gets the comparator of this attribute.

Type Parameters:
T - the comparator type.
Returns:
the comparator or null.

setComparator

public <T> void setComparator(Comparator<T> comparator)
Sets the comparator of this attribute.

Type Parameters:
T - the comparator type.
Parameters:
comparator - the comparator.

getListeners

public <L extends EventListener> L[] getListeners(Class<L> clazz)
Gets the specified listeners.

Type Parameters:
L - the listener type.
Parameters:
clazz - the listener class.
Returns:
the listener instances or null.

setListeners

public <L extends EventListener> void setListeners(Class<L> clazz,
                                                   L[] listeners)
Sets the specified listeners.

Type Parameters:
L - the listener type.
Parameters:
clazz - the listener class.
listeners - the listener instances.

getConstant

public <E extends Enum<?>> E getConstant(Class<E> clazz)
Gets the specified constant.

Type Parameters:
E - the constant type.
Parameters:
clazz - the constant class.
Returns:
the constant instance or null.

setConstant

public <E extends Enum<?>> void setConstant(Class<E> clazz,
                                            E constant)
Sets the specified constant.

Type Parameters:
E - the constant type.
Parameters:
clazz - the constant class.
constant - the constant instance.

isEnumerated

public boolean isEnumerated()
Checks whether this attribute is enumerated.

Returns:
true if this attribute is enumerated, otherwise false.

getEnumeration

public EnumeratedList getEnumeration()
Gets the enumeration of allowed attribute values. The enumeration is returned as a list of EnumAttribute instances.

Returns:
the enumeration as a list or null if not an enumerated attribute.

setEnumeration

public void setEnumeration(List<?> list)
Sets the enumeration of allowed attribute values. Values can be public string representations, internal object values or explicit EnumAttribute instances.

Parameters:
list - the enumeration as a list.
Throws:
NumberFormatException - if any value is an invalid number.
ClassCastException - if the value is of incorrect type.
UnsupportedOperationException - if an immutable atribute.
IllegalArgumentException - if the value is out of bounds.

getLocalizedEnumeration

public EnumeratedList getLocalizedEnumeration(Locale locale)
Gets a localized enumeration of allowed attribute values. The enumeration is returned as a list of EnumAttribute instances.

Parameters:
locale - the locale of the enumeration.
Returns:
the enumeration as a list or null if not available.

setLocalizedEnumeration

public void setLocalizedEnumeration(Locale locale,
                                    EnumeratedList enums)
Sets the localized enumeration of allowed attribute values.

Parameters:
locale - the locale of the enumeration.
enums - the enumeration as a list.
Throws:
IllegalStateException - if not an enumerated attribute.

clearLocalizedEnumerations

public void clearLocalizedEnumerations()
Clears all localized enumerations of allowed attribute values.


getDescriptor

public Descriptor getDescriptor()
Gets the descriptor of this attribute. The descriptor is either immutable or modifiable depending on the attribute state. Changes to a modifiable descriptor directly affects the attribute.

Specified by:
getDescriptor in interface DescriptorRead
Overrides:
getDescriptor in class MBeanFeatureInfo
Returns:
the attribute descriptor.

isValidValue

public boolean isValidValue(Object value,
                            Object... localization)
Checks whether an attribute value is valid.

Note that validation does *NOT* check access restrictions, like writable and mandatory, but only the validity of the value itself.

Parameters:
value - the value to validate.
localization - optional base name, resource bundle and locale.
Returns:
true for a valid value, false otherwise.

validateValue

public Object validateValue(Object value,
                            Object... localization)
Validates an attribute value.

Note that validation does *NOT* check access restrictions, like writable and mandatory, but only the validity of the value itself.

Parameters:
value - the value to validate.
localization - optional base name, resource bundle and locale.
Returns:
the validated attribute value.
Throws:
RuntimeConversionException - if the conversion fails.
NumberFormatException - if the value is an invalid number.
ClassCastException - if the value is of incorrect type.
UnsupportedOperationException - if the value cannot be converted.
IllegalArgumentException - if the value is invalid.
IndexOutOfBoundsException - if array indices are exceeded.
ValueOutOfBoundsException - if value limits are exceeded.
NullPointerException - if the conversion detects nulls.

convertValue

public Object convertValue(Object value,
                           Object... localization)
Converts an attribute value from an external type to the internal one by applying applicable attribute traits.

Parameters:
value - the value to convert.
localization - optional base name, resource bundle and locale.
Returns:
the converted attribute value.
Throws:
RuntimeConversionException - if the conversion fails.
NumberFormatException - if the value is an invalid number.
ClassCastException - if the value is of incorrect type.
UnsupportedOperationException - if the value cannot be converted.
IllegalArgumentException - if the value is invalid.
IndexOutOfBoundsException - if array indices are exceeded.
NullPointerException - if the conversion detects nulls.

toSerializable

public String toSerializable(Object value,
                             Object... localization)
Converts the specified attribute value to a serializable string.

Parameters:
value - the value to convert.
localization - optional base name, resource bundle and locale.
Returns:
the value as a serializable string or null.

toSerializables

public String[] toSerializables(Object values,
                                Object... localization)
Converts the specified attribute values to a serializable string array.

Parameters:
values - the values to convert.
localization - optional base name, resource bundle and locale.
Returns:
the values as a serializable string array or null.

toString

public String toString(Object value,
                       Object... localization)
Converts the specified attribute value to a string.

Note that a non-readable value is presented as a shadow.

Parameters:
value - the value to convert.
localization - optional base name, resource bundle and locale.
Returns:
the value as a string.

toStrings

public String[] toStrings(Object value,
                          Object... localization)
Converts the specified attribute value to a string array.

Note that a non-readable values are presented as shadows.

Parameters:
value - the value to convert.
localization - optional base name, resource bundle and locale.
Returns:
the value as a string array.

toShadow

public String toShadow()
Converts this attribute to a shadow.

Returns:
the shadow string.

toShadows

public String[] toShadows()
Converts the this attribute to a shadows.

Returns:
the shadow string array.

getOwnerName

public ObjectName getOwnerName()
Gets the name of the owner of this attribute.

Returns:
the name of the owner or null.


Copyright © 2004 The Norther Organization. All rights reserved.