com.atlassian.jira.util.map
Class CacheObject<T>

java.lang.Object
  extended by com.atlassian.jira.util.map.CacheObject<T>
All Implemented Interfaces:
Serializable

public class CacheObject<T>
extends Object
implements Serializable

Used for keys or values in Maps that do not support null keys, or in caches where it is needed to differentiate between a cached 'null' value and an object not being in the cache. Although this class is marked as being Serializable, instances will only truly be thus if the value they wrap is itself Serializable (or null). Copyright (c) 2002-2004 All rights reserved.

See Also:
Serialized Form

Field Summary
static CacheObject NULL_INSTANCE
          A CacheObject<T> whose value is null.
 
Constructor Summary
CacheObject(T value)
           
 
Method Summary
 boolean equals(Object o)
           
 T getValue()
           
 int hashCode()
           
 boolean hasValue()
           
 boolean isNull()
           
static
<T> CacheObject<T>
NULL()
          Returns a CacheObject<T> whose value is null.
 String toString()
           
static
<T> CacheObject<T>
wrap(T object)
          Wraps the given value in a CacheObject.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NULL_INSTANCE

public static final CacheObject NULL_INSTANCE
A CacheObject<T> whose value is null. Prefer NULL() to avoid generic-related warnings.

Constructor Detail

CacheObject

public CacheObject(T value)
Method Detail

NULL

public static <T> CacheObject<T> NULL()
Returns a CacheObject<T> whose value is null.

Returns:
a CacheObject<T> whose value is null

wrap

public static <T> CacheObject<T> wrap(T object)
Wraps the given value in a CacheObject.

Parameters:
object - a <T>
Returns:
a CacheObject that wraps the given value

getValue

public T getValue()

hasValue

public boolean hasValue()

isNull

public boolean isNull()

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2002-2014 Atlassian. All Rights Reserved.