org.norther.tammi.core.rt.util
Class EnumeratedAttribute

java.lang.Object
  extended by javax.management.Attribute
      extended by org.norther.tammi.core.rt.util.EnumeratedAttribute
All Implemented Interfaces:
Serializable, Cloneable, Comparable<Attribute>
Direct Known Subclasses:
EnumeratedIdentity

public class EnumeratedAttribute
extends Attribute
implements Comparable<Attribute>, Cloneable

An enumerated attribute value. EnumeratedAttribute contains the allowed attribute value and its public name as a string or an array of strings. Sorting is based on its name(s).

Version:
$Id: EnumeratedAttribute.java,v 1.12 2009/09/28 15:08:44 cvsimp Exp $
Author:
Ilkka Priha
See Also:
Serialized Form

Constructor Summary
EnumeratedAttribute()
          Constructs an empty attribute.
EnumeratedAttribute(String[] names, Object value, boolean... cloneable)
          Constructs a new array attribute.
EnumeratedAttribute(String name, Object value, boolean... cloneable)
          Constructs a new attribute.
 
Method Summary
 Object clone()
           
 EnumeratedAttribute clone(Object value)
          Clones the attribute with a new value.
 EnumeratedAttribute clone(String... name)
          Clones the attribute with new names.
 int compareTo(Attribute other)
           
 EnumerationEntry[] entries()
          Returns the enumeration entries of this attribute.
 boolean equals(Object object)
           
 String getBaseName()
          Gets the base name of this attribute for localization, if any.
 Object getValue()
           
 int hashCode()
           
 int length()
          Returns the number of enumeration entries in this attribute.
 boolean matches(Object other)
          Matches this enumerated attribute against an enumerated object for equality.
 String toString()
          Returns the string representation of this attribute.
 String[] toStrings()
          Returns the string array representation of this attribute.
 
Methods inherited from class javax.management.Attribute
getName
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EnumeratedAttribute

public EnumeratedAttribute()
Constructs an empty attribute.


EnumeratedAttribute

public EnumeratedAttribute(String name,
                           Object value,
                           boolean... cloneable)
Constructs a new attribute.

Parameters:
name - the attribute name.
value - the attribute value.
cloneable - true if the value is cloneable.

EnumeratedAttribute

public EnumeratedAttribute(String[] names,
                           Object value,
                           boolean... cloneable)
Constructs a new array attribute.

Parameters:
names - the attribute names.
value - the attribute value.
cloneable - true if the value is cloneable.
Method Detail

equals

public boolean equals(Object object)
Overrides:
equals in class Attribute

hashCode

public int hashCode()
Overrides:
hashCode in class Attribute

clone

public Object clone()
Overrides:
clone in class Object

clone

public EnumeratedAttribute clone(String... name)
Clones the attribute with new names.

Parameters:
name - the attribute names.
Returns:
the cloned attribute.

clone

public EnumeratedAttribute clone(Object value)
Clones the attribute with a new value.

Parameters:
value - the attribute value.
Returns:
the cloned attribute.

compareTo

public int compareTo(Attribute other)
Specified by:
compareTo in interface Comparable<Attribute>

getValue

public Object getValue()
Overrides:
getValue in class Attribute

length

public int length()
Returns the number of enumeration entries in this attribute.

Returns:
the number of enumeration entries.

matches

public boolean matches(Object other)
Matches this enumerated attribute against an enumerated object for equality.

Parameters:
other - the enumerated object.
Returns:
true is equal, false otherwise.

entries

public EnumerationEntry[] entries()
Returns the enumeration entries of this attribute.

Returns:
an array of enumeration entries.

toString

public String toString()
Returns the string representation of this attribute.

Overrides:
toString in class Attribute
Returns:
the localized or original string.

toStrings

public String[] toStrings()
Returns the string array representation of this attribute.

Returns:
the localized or original strings.

getBaseName

public String getBaseName()
Gets the base name of this attribute for localization, if any.

Returns:
the base name or null.


Copyright © 2004 The Norther Organization. All rights reserved.