FileDocCategorySizeDatePackage
WeakishReference.javaAPI DocApache Ant 1.702913Wed Dec 13 06:16:20 GMT 2006org.apache.tools.ant.util

WeakishReference

public class WeakishReference extends Object
These classes are part of some code to reduce memory leaks by only retaining weak references to things on Java1.2+, and yet still work (with leaky hard references) on Java1.1. Now that Ant is 1.2+ only, life is simpler and none of the classes are needed any more. They are only retained in case a third-party task uses them
since
ant1.6
see
org.apache.tools.ant.util.optional.WeakishReference12
deprecated
deprecated 1.7; will be removed in Ant1.8 Just use {@link java.lang.ref.WeakReference} directly.

Fields Summary
private WeakReference
weakref
Constructors Summary
WeakishReference(Object reference)
create a new soft reference, which is bound to a Weak reference inside

param
reference
see
java.lang.ref.WeakReference

        this.weakref = new WeakReference(reference);
    
Methods Summary
public static org.apache.tools.ant.util.WeakishReferencecreateReference(java.lang.Object object)
create the appropriate type of reference for the java version

param
object the object that the reference will refer to.
return
reference to the Object.

            return new WeakishReference(object);
    
public java.lang.Objectget()
Returns this reference object's referent. If this reference object has been cleared, then this method returns null.

return
The object to which this reference refers, or null if this reference object has been cleared.

        return weakref.get();