com.bea.content
Class ContextKey

java.lang.Object
  extended by com.bea.content.ContextKey
All Implemented Interfaces
Serializable

public class ContextKey
extends Object
implements Serializable

Context keys are used to store and retrieve context values in the class ContentContext. Context keys may have an associated type defined. If the type is specified, then when the key/value pair is stored, the value will be validated against the specified context key type. Context keys may be marked as mutable, which means that the context value can be changed and removed. They can also be immutable, in which case setting or removing a context value is not allowed. Context keys may be public, which means that the key appears when retrieving the list of context keys. They can also be private, in which case they do not appear in the list of keys. This class defines both the ContextKey type and some ContextKey key objects. Other context keys (of type ContextKey) can also be created (elsewhere) and used. all context key objects need not be created here.

See Also
Serialized Form

Constructor Summary
ContextKey(String keyName, Class<?> expectedType, boolean isPublic, boolean isMutable)
          Create a context key
 
Method Summary
 boolean equals(Object o)
          Tests this ContextKey to that passed in for equality.
 Class<?> getExpectedType()
          Return the expected type.
 String getKeyName()
          Return the key name.
 int hashCode()
          Generates a hash code for this ContextKey.
 boolean isMutable()
          Return true if the key is mutable.
 boolean isPublic()
          Return true if the key is public.
 String toString()
          Returns a string representation of the object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ContextKey

public ContextKey(String keyName,
                  Class<?> expectedType,
                  boolean isPublic,
                  boolean isMutable)
Create a context key

Parameters
keyName - the anem of the key
expectedType - the expected type of key value (optional - can be null)
isPublic - if the key should be listed when retrieving the set of keys
isMutable - if the value can be changed or removed once it is set
Method Detail

getKeyName

public String getKeyName()
Return the key name.

Returns
the key name.

getExpectedType

public Class<?> getExpectedType()
Return the expected type.

Returns
the expected type.

isPublic

public boolean isPublic()
Return true if the key is public.

Returns
true if the key is public.

isMutable

public boolean isMutable()
Return true if the key is mutable.

Returns
true if the key is mutable.

equals

public boolean equals(Object o)
Tests this ContextKey to that passed in for equality.

Overrides:
equals in class Object
Parameters
o - the ContextKey to test for equality.
Returns
true if the given ContextKey is equal to this ContextKey.

hashCode

public int hashCode()
Generates a hash code for this ContextKey.

Overrides:
hashCode in class Object
Returns
the hash code for this ContextKey.

toString

public String toString()
Returns a string representation of the object.

Overrides:
toString in class Object
Returns
a string representation of the object.


Copyright © 2000, 2009, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates.
Other names may be trademarks of their respective owners.