org.apache.commons.jelly.impl
Class WeakReferenceWrapperScript

java.lang.Object
  |
  +--org.apache.commons.jelly.impl.WeakReferenceWrapperScript
All Implemented Interfaces:
Script

public class WeakReferenceWrapperScript
extends java.lang.Object
implements Script

Wraps another Script instance in a WeakReference. Used to prevent a Tag class from holding a hard reference to its body script.

If the underlying Script has been GC'd and is no longer available, an exception is thrown on any attempt to use this Script.

WARNING: This class is not a permanent part of the API and will be removed or replaced in a future release. Don't extend it or use it unless you absolutely must.

Author:
Hans Gilde

Constructor Summary
WeakReferenceWrapperScript(Script script)
           
 
Method Summary
 Script compile()
          Called by the parser to allow a more efficient representation of the script to be used.
 boolean containsScriptType(java.lang.Class clazz)
          Determines if this script (the one in the WeakReference) or a child reference contains a Script that's of a particular class.
 void run(JellyContext context, XMLOutput output)
          Evaluates the body of a tag
 Script script()
          Use this method to access the script.
 void trimWhitespace()
          Trims the white space from the script and its children.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WeakReferenceWrapperScript

public WeakReferenceWrapperScript(Script script)
Method Detail

compile

public Script compile()
               throws JellyException
Description copied from interface: Script
Called by the parser to allow a more efficient representation of the script to be used.
Specified by:
compile in interface Script

script

public Script script()
              throws JellyTagException
Use this method to access the script.
Throws:
JellyException - If the script has been GC'd.

run

public void run(JellyContext context,
                XMLOutput output)
         throws JellyTagException
Description copied from interface: Script
Evaluates the body of a tag
Specified by:
run in interface Script

trimWhitespace

public void trimWhitespace()
                    throws JellyTagException
Trims the white space from the script and its children. TODO this code should be refactored into a formal part of the Script interface. It has currently been cut and pasted from TagSupport.

containsScriptType

public boolean containsScriptType(java.lang.Class clazz)
                           throws JellyTagException
Determines if this script (the one in the WeakReference) or a child reference contains a Script that's of a particular class.

This method is in place to support specific features in the XML tag library and shouldn't be used by anyone at all. This method will be removed in a near-future verison of jelly.

This method will be removed in a near-future verison of jelly. XXX this is totally bogus and temporary, we should not need to check the type of scripts.

Parameters:
clazz - Find a script that's an instance of this classs.
Throws:
JellyTagException -  


Copyright © 2002-2004 Apache Software Foundation. All Rights Reserved.