Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

java.awt
Class AttributeValue  view AttributeValue download AttributeValue.java

java.lang.Object
  extended byjava.awt.AttributeValue
Direct Known Subclasses:
BufferCapabilities.FlipContents, JobAttributes.DefaultSelectionType, JobAttributes.DestinationType, JobAttributes.DialogType, JobAttributes.MultipleDocumentHandlingType, JobAttributes.SidesType, PageAttributes.ColorType, PageAttributes.MediaType, PageAttributes.OrientationRequestedType, PageAttributes.OriginType, PageAttributes.PrintQualityType

class AttributeValue
extends java.lang.Object

This class is undocumented by Sun, but it is the parent of several other classes, all of which are type-safe enumerations. This takes care of equals, toString, and hashCode, so that you don't have to (although hashCode is commonly overridden).


Field Summary
private  java.lang.String[] names
          The list of enumeration names for the given subclass.
(package private)  int value
          The value of the enumeration.
 
Constructor Summary
(package private) AttributeValue(int value, java.lang.String[] names)
          Construct a type-safe enumeration element.
 
Method Summary
 int hashCode()
          Returns the hashcode of this element.
 java.lang.String toString()
          Returns the name of this enumeration element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

value

final int value
The value of the enumeration. Package visible for speed.


names

private final java.lang.String[] names
The list of enumeration names for the given subclass.

Constructor Detail

AttributeValue

AttributeValue(int value,
               java.lang.String[] names)
Construct a type-safe enumeration element. For example,
 class Foo extends AttributeValue
 {
   private static final String[] names = { "one", "two" }
   public static final Foo ONE = new Foo(0);
   public static final Foo TWO = new Foo(1);
   private Foo(int value) { super(value, names); }
 }
 

Method Detail

hashCode

public int hashCode()
Returns the hashcode of this element. This is the index of the element in the enumeration. Note that equals defaults to the == relation.


toString

public java.lang.String toString()
Returns the name of this enumeration element.