com.miginfocom.util
Class PropertyKey

java.lang.Object
  extended by com.miginfocom.util.PropertyKey
All Implemented Interfaces:
java.io.Serializable

public final class PropertyKey
extends java.lang.Object
implements java.io.Serializable

A key used for indexing attributes for an AShape. This is used from v5.5 instead if a String to increase speed (indentity comparison rather than slower string comparison) and type safety.

Note that care has to be taken to never have two keys denoting the same attribute loaded in memory at the same time. The XML delegate takes care of this through the getKey(String) method. If you want to create custom keys

See Also:
Serialized Form

Field Summary
static int TRACE_IF_MORE_THAN
          There will be an error log in System.err if more keys that this.
 
Method Summary
 void checkTypeOfValue(java.lang.Object value)
           
 boolean equals(java.lang.Object o)
           
static PropertyKey getKey(java.lang.String name)
          Creates an uniqe key for name.
static PropertyKey getKey(java.lang.String name, java.lang.Class valueClass)
          Creates an uniqe key for name.
 java.lang.String getName()
          Returns the name for this key.
 java.lang.Class getValueClass()
          Returns the class that the value that this property key is associated with should be or be a sub class of.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TRACE_IF_MORE_THAN

public static int TRACE_IF_MORE_THAN
There will be an error log in System.err if more keys that this. Probably because key name is dynamic in some way, which it shouldn't be. Can be changed to a higer value if > 1000 keys are expected.

Method Detail

getKey

public static final PropertyKey getKey(java.lang.String name)
Creates an uniqe key for name. If a key for the exact name has already been created that key will be returned.

Same as calling getKey(name, null).

Parameters:
name - The name of the key. If null it will be exchanged with the string "null".
Returns:
The key.

getKey

public static final PropertyKey getKey(java.lang.String name,
                                       java.lang.Class valueClass)
Creates an uniqe key for name. If a key for the exact name has already been created that key will be returned.

Parameters:
name - The name of the key. If null it will be exchanged with the string "null".
valueClass - If != null the class will be stored in this PropertyKey when it is first created. The meaning is normally that the value that is associated with this key is to be a class, or subclass, of this class.

Note that if a key is already created for name this argument will not be used.

The handler of this PropertyKey may make use of this property, it is in now way enforced by this class.

Returns:
The key.

getValueClass

public final java.lang.Class getValueClass()
Returns the class that the value that this property key is associated with should be or be a sub class of.

It can be null which should be interpreted as any class.

If values can be null if this class is specified is up to the implementation to define.

Returns:
The class that the value that this property key is associated with should be or be a sub class of.

getName

public final java.lang.String getName()
Returns the name for this key.

Returns:
The name for this key. Never null.

toString

public final java.lang.String toString()
Overrides:
toString in class java.lang.Object

equals

public final boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

checkTypeOfValue

public final void checkTypeOfValue(java.lang.Object value)
                            throws java.lang.ClassCastException
Throws:
java.lang.ClassCastException


Copyright © 2009 MiG InfoCom AB. All Rights Reserved.