Skip navigation links
javax.ide.extension
Class DynamicHook
java.lang.Object
javax.ide.extension.ElementVisitor
javax.ide.extension.ExtensionHook
javax.ide.extension.DynamicHook
-
public class DynamicHook
- extends ExtensionHook
An implementation of ExtensionHook that automatically populates model objects using reflection.
This class now strongly encourages delayed classloading through the definition of MetaClass
handling set/add methods on model classes. In future, DynamicHook will be moved over to a strict classloading policy requiring that any application objects whose classes are not accessible to the classloader of the hook handler implementation must be set on the model through new MetaClass signature methods.
Currently, the Boolean system property DynamicHook.strict is provided to allow implementors to ensure that their handlers and models operate correctly under strict classloading. Note that this policy will soon become the default behavior, and later the only supported behavior of DynamicHook. The use of this option is recommended in the interests of determining future compliance. In strict mode, any failures will be reported to the Logger
of the ElementContext
.
Method Summary |
protected void |
attachClass(java.lang.Object parent, MetaClass metaClass, ElementEndContext context)
|
protected void |
attachData(java.lang.Object parent, java.lang.String data, ElementEndContext context)
|
protected void |
attachObject(java.lang.Object parent, java.lang.Object child, ElementEndContext context)
|
protected ElementVisitorFactory |
createVisitorFactory()
If the hook implementation and its associated model use delayed classloading (as recommended), any ElementVisitorFactory being attached to a handled context must created by this method. |
void |
end(ElementEndContext context)
Visit the end tag of an xml element. |
protected java.lang.reflect.Method |
findMethod(ElementContext context, java.lang.Object o, java.lang.String elementName, java.lang.Class[] paramTypes)
|
protected java.lang.Object |
getApplicationObject(java.lang.Class runtimeType, ElementStartContext context)
Deprecated. replaced by getApplicationObject(MetaClass,ElementStartContext) |
protected
|
getApplicationObject(MetaClass<T> runtimeMetaType, ElementStartContext context)
|
protected java.lang.String |
getHookNamespaceURI()
|
protected java.lang.String |
getMethodName(java.lang.String prefix, java.lang.String elementName)
|
protected
|
getRuntimeMetaType(ElementStartContext context)
|
protected java.lang.Class |
getRuntimeType(ElementStartContext context)
Deprecated. replaced by getRuntimeMetaType(ElementStartContext) |
protected void |
handleComplexElementEnd(ElementEndContext context)
|
protected void |
handleComplexElementStart(java.lang.Object applicationObject, ElementStartContext context)
|
protected void |
handleSimpleElementEnd(ElementEndContext context)
|
protected void |
handleSimpleElementStart(ElementStartContext context)
|
protected void |
invokePostInitialize(java.lang.Object target)
|
protected void |
invokePreInitialize(java.lang.Object parent, java.lang.Object target)
|
void |
registerElementTypeResolver(DynamicHook.ElementTypeResolver resolver)
|
void |
start(ElementStartContext context)
Visit the start tag of an xml element. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
sApplicationObjectKey
public final java.lang.String sApplicationObjectKey
DynamicHook
public DynamicHook(java.lang.Object rootObject)
DynamicHook
public DynamicHook(java.lang.Object rootObject,
java.lang.ClassLoader classLoader)
DynamicHook
public DynamicHook(java.lang.Object rootObject,
java.lang.ClassLoader classLoader,
DynamicHook.ElementTypeResolver resolver)
registerElementTypeResolver
public void registerElementTypeResolver(DynamicHook.ElementTypeResolver resolver)
createVisitorFactory
protected ElementVisitorFactory createVisitorFactory()
- If the hook implementation and its associated model use delayed classloading (as recommended), any
ElementVisitorFactory
being attached to a handled context must created by this method. That means either; overriding this method to return the visitor factory instance, or; enabling this method to create a default visitor factory by overriding getHookNamespaceURI()
to return a non-null namespace value that applies to all handled elements.
-
- Returns:
- the to attach to the context.
getHookNamespaceURI
protected java.lang.String getHookNamespaceURI()
start
public void start(ElementStartContext context)
- Description copied from class:
ElementVisitor
- Visit the start tag of an xml element.
This implementation does nothing.
-
- Overrides:
start
in class ElementVisitor
-
- Parameters:
context
- information about the xml start tag.
end
public void end(ElementEndContext context)
- Description copied from class:
ElementVisitor
- Visit the end tag of an xml element.
This implementation does nothing.
-
- Overrides:
end
in class ElementVisitor
-
- Parameters:
context
- information about the xml end tag.
handleComplexElementStart
protected void handleComplexElementStart(java.lang.Object applicationObject,
ElementStartContext context)
handleComplexElementEnd
protected void handleComplexElementEnd(ElementEndContext context)
handleSimpleElementStart
protected void handleSimpleElementStart(ElementStartContext context)
handleSimpleElementEnd
protected void handleSimpleElementEnd(ElementEndContext context)
getRuntimeMetaType
protected <T> MetaClass<T> getRuntimeMetaType(ElementStartContext context)
getRuntimeType
@Deprecated
protected java.lang.Class getRuntimeType(ElementStartContext context)
- Deprecated. replaced by
getRuntimeMetaType(ElementStartContext)
getApplicationObject
protected <T> T getApplicationObject(MetaClass<T> runtimeMetaType,
ElementStartContext context)
throws java.lang.InstantiationException,
java.lang.IllegalAccessException,
java.lang.ClassNotFoundException
-
- Throws:
java.lang.InstantiationException
java.lang.IllegalAccessException
java.lang.ClassNotFoundException
getApplicationObject
@Deprecated
protected java.lang.Object getApplicationObject(java.lang.Class runtimeType,
ElementStartContext context)
- Deprecated. replaced by
getApplicationObject(MetaClass,ElementStartContext)
attachClass
protected void attachClass(java.lang.Object parent,
MetaClass metaClass,
ElementEndContext context)
attachObject
protected void attachObject(java.lang.Object parent,
java.lang.Object child,
ElementEndContext context)
attachData
protected void attachData(java.lang.Object parent,
java.lang.String data,
ElementEndContext context)
invokePreInitialize
protected void invokePreInitialize(java.lang.Object parent,
java.lang.Object target)
invokePostInitialize
protected void invokePostInitialize(java.lang.Object target)
findMethod
protected java.lang.reflect.Method findMethod(ElementContext context,
java.lang.Object o,
java.lang.String elementName,
java.lang.Class[] paramTypes)
getMethodName
protected java.lang.String getMethodName(java.lang.String prefix,
java.lang.String elementName)
Skip navigation links
Copyright © 1997, 2012, Oracle. All rights reserved.