|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK 11g Release 2 (11.1.2.2.0) E17493-03 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
javax.ide.extension.ElementVisitor
oracle.ide.extension.HashStructureElementVisitor
public final class HashStructureElementVisitor
A generic ElementVisitor
for unmarshalling extension manifest (extension.xml) elements into a HashStructure
. In order for the automatic unmarshalling to occur without errors, the XML must follow a particular format. Consider the following example, where the <my-hook> element is unmarshalled by HashStructureElementVisitor:
<my-hook version="2.0"> <feature name="O__KILLER_APP_" id="killer_app_id"> <display description="${KILLER_APP_DESCRIPTION}" icon="res:${KILLER_APP_ICON}" welcome-page="uri:oracle.killerapp/welcome.html"> Text within the display element. </display> </feature> <thing name="one">1</thing> <thing name="two">2</thing> </my-hook>
If the unmarshalled HashStructure for <my-hook>
were assigned to a variable named myhook
, the properties within my-hook
could be obtained using the following code:
String version = myhook.getString( "version" ); // "2.0" String name = myhook.getString( "feature/name" ); // dereferenced value of ${KILLER_APP} String id = myhook.getString( "feature/id" ); // "killer.app.id" String description = myhook.getString( "feature/display/description" ); URL icon = myhook.getURL( "feature/display/icon" ); URL welcomePage = myhook.getURL( "feature/display/welcome-page" ); String text = myhook.getString( "feature/display/#text" ); // Whitespace is trimmed List things = myhook.getAsList( "thing" ); // Each item will be a HashStructure
In greater detail, the unmarshalling occurs according to the following rules:
HashStructure.getAsList(java.lang.String)
method to get a List
every time.The macro-like expressions such as ${KILLER_APP}
are resolved and expanded according to the following rules:
After macros have been expanded, there are two special syntaxes recognized:
getResource()
on it to resolve the path to a URL. This form is most often used when referencing icons, images, or configuration files that can be found on the classpath.This class is currently final because it has no behavior that can be overridden in a subclass. To provide customized behavior based on this class, use the decorator design pattern instead.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.ide.extension.ElementVisitor |
---|
ElementVisitor.ResourceBundleProvider |
Field Summary |
---|
Fields inherited from class javax.ide.extension.ElementVisitor |
---|
KEY_LOCATOR |
Constructor Summary | |
---|---|
HashStructureElementVisitor() Creates a new HashStructureElementVisitor which will store unmarshalled properties into a new HashStructure instance. |
|
HashStructureElementVisitor(HashStructure root) Creates a new HashStructureElementVisitor which will store unmarshalled properties into the specified HashStructure instance. |
Method Summary | |
---|---|
void |
end(ElementEndContext context) Visit the end tag of an xml element. |
HashStructure |
getHashStructure() Returns the HashStructure where this HashStructureElementVisitor unmarshalled its properties. |
void |
merge(HashStructureElementVisitor separateElementVisitor) Copies the data from the given HashStructureElementVisitor instance into this HashStructureElementVisitor's HashStructure. |
void |
start(ElementStartContext context) Visit the start tag of an xml element. |
void |
turnElementCounterOn() Turns element counting so that their order can be reconstructed later from the hash structure content. |
Methods inherited from class javax.ide.extension.ElementVisitor |
---|
getAttributeHelper, getClassLoader, getMetaClassLoader, getResourceBundle, getResourceBundleProvider, getTextHelper, log, log, setResourceBundleProvider |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public HashStructureElementVisitor()
public HashStructureElementVisitor(HashStructure root)
root
- The HashStructure where properties unmarshalled from the extension manifest will be stored.Method Detail |
---|
public final HashStructure getHashStructure()
public final void start(ElementStartContext context)
ElementVisitor
This implementation does nothing.
start
in class ElementVisitor
context
- information about the xml start tag.public final void end(ElementEndContext context)
ElementVisitor
This implementation does nothing.
end
in class ElementVisitor
context
- information about the xml end tag.public void merge(HashStructureElementVisitor separateElementVisitor)
separateElementVisitor
-public void turnElementCounterOn()
|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK 11g Release 2 (11.1.2.2.0) E17493-03 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |