|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1.7.2) E13403-10 |
|||||||||
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.
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 |
start(ElementStartContext context) Visit the start tag of an xml element. |
Methods inherited from class javax.ide.extension.ElementVisitor |
---|
getClassLoader, getResourceBundle, log |
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.
|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1.7.2) E13403-10 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |