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

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

public class EnumAttribute
extends Attribute
implements Comparable, Cloneable

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

Author:
Ilkka Priha
See Also:
Serialized Form

Constructor Summary
EnumAttribute(String[] array, Object value)
          Constructs a new array attribute.
EnumAttribute(String name, Object value)
          Constructs a new attribute.
 
Method Summary
 Object clone()
           
 Object clone(Object value)
          Clones the attribute with a new value.
 Object clone(String name)
          Clones the attribute with a new name.
 Object clone(String[] array)
          Clones the attribute with a new name array.
 int compareTo(Object other)
           
 boolean equals(Object object)
           
 String getBaseName()
          Gets the base name of this attribute for localization, if any.
 String getName()
           
 Object getValue()
           
 int hashCode()
           
 int length()
          Returns the number of name elements 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 java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EnumAttribute

public EnumAttribute(String name,
                     Object value)
Constructs a new attribute.

Parameters:
name - the attribute name.
value - the attribute value.

EnumAttribute

public EnumAttribute(String[] array,
                     Object value)
Constructs a new array attribute.

Parameters:
array - the attribute name array.
value - the attribute value.
Method Detail

equals

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

hashCode

public int hashCode()
Overrides:
hashCode in class Object

clone

public Object clone()
Overrides:
clone in class Object

clone

public Object clone(String name)
Clones the attribute with a new name.

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

clone

public Object clone(String[] array)
Clones the attribute with a new name array.

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

clone

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

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

compareTo

public int compareTo(Object other)
Specified by:
compareTo in interface Comparable

getName

public String getName()
Overrides:
getName in class Attribute

getValue

public Object getValue()
Overrides:
getValue in class Attribute

length

public int length()
Returns the number of name elements in this attribute.

Returns:
the number of name elements.

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.

toString

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

Overrides:
toString in class Object
Returns:
the localized or explicit string.

toStrings

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

Returns:
the localized or explicit 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.