org.eclipse.jet
Class AbstractContextExtender

java.lang.Object
  extended by org.eclipse.jet.AbstractContextExtender
Direct Known Subclasses:
TransformContextExtender, WorkspaceContextExtender, XPathContextExtender

public abstract class AbstractContextExtender
extends java.lang.Object

Base class for extending JET2Context. The JET execution context, JET2Context, is capable of storing private data for various extensions. Subclass this class to create such a private data extension. Steps to create an context extension.

  1. Subclass this class
  2. Implement createExtendedData(JET2Context) to return a object representing the private data of the context extension. This method is only called the first time an extender is constructed for a particular context. The method getExtendedData() returns the data to the current context instance.
  3. Implement additional methods that make use of this private context data.
  4. Create a constructor that accepts a JET2Context and passes it to the super constructor. It is recommended that this constructor be private.
  5. (Recommended) Implement a public static YourExtender getInstance(JET2Context) method that returns an instance the AbstractContextExtender subclass.


Constructor Summary
protected AbstractContextExtender(JET2Context context)
           
 
Method Summary
protected abstract  java.lang.Object createExtendedData(JET2Context context)
          Called by the AbstractContextExtender constructor if the extender's data has not yet been created in the context.
 JET2Context getContext()
          Return the JET2Context that this extender instance is extending.
protected  java.lang.Object getExtendedData()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractContextExtender

protected AbstractContextExtender(JET2Context context)
Method Detail

createExtendedData

protected abstract java.lang.Object createExtendedData(JET2Context context)
Called by the AbstractContextExtender constructor if the extender's data has not yet been created in the context.

Parameters:
context - the context in which the data will be created.
Returns:
the extension data object.

getExtendedData

protected java.lang.Object getExtendedData()

getContext

public final JET2Context getContext()
Return the JET2Context that this extender instance is extending.

Returns:
the hosting context.

Copyright 2006 IBM Corporation and others.
All Rights Reserved.