站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss 4.0.1 sp1 common API Documentation 英文版文档

SoftObject (JBoss/Common API) - JBoss 4.0.1 sp1 common API Documentation 英文版文档


org.jboss.util
Class SoftObject

java.lang.Object
  extended byjava.lang.ref.Reference
      extended byjava.lang.ref.SoftReference
          extended byorg.jboss.util.SoftObject

public final class SoftObject
extends SoftReference

Convenience class to wrap an Object into a SoftReference.

Modified from java.util.WeakHashMap.WeakKey.

Version:
$Revision: 1.1 $
Author:
Jason Dillon

Field Summary
protected  int hashCode
          The hash code of the nested object
 
Constructor Summary
SoftObject(Object obj)
          Construct a SoftObject.
SoftObject(Object obj, ReferenceQueue queue)
          Construct a SoftObject.
 
Method Summary
static SoftObject create(Object obj)
          Create a SoftObject for the given object.
static SoftObject create(Object obj, ReferenceQueue queue)
          Create a SoftObject for the given object.
 boolean equals(Object obj)
          Check the equality of an object with this.
 int hashCode()
          Return the hash code of the nested object.
 
Methods inherited from class java.lang.ref.SoftReference
get
 
Methods inherited from class java.lang.ref.Reference
clear, enqueue, isEnqueued
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

hashCode

protected final int hashCode
The hash code of the nested object

Constructor Detail

SoftObject

public SoftObject(Object obj)
Construct a SoftObject.

Parameters:
obj - Object to reference.

SoftObject

public SoftObject(Object obj,
                  ReferenceQueue queue)
Construct a SoftObject.

Parameters:
obj - Object to reference.
queue - Reference queue.
Method Detail

equals

public boolean equals(Object obj)
Check the equality of an object with this.

Parameters:
obj - Object to test equality with.
Returns:
True if object is equal.

hashCode

public int hashCode()
Return the hash code of the nested object.

Returns:
The hash code of the nested object.

create

public static SoftObject create(Object obj)
Create a SoftObject for the given object.

Parameters:
obj - Object to reference.
Returns:
SoftObject or null if object is null.

create

public static SoftObject create(Object obj,
                                ReferenceQueue queue)
Create a SoftObject for the given object.

Parameters:
obj - Object to reference.
queue - Reference queue.
Returns:
SoftObject or null if object is null.


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.