|
Search this API | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objecty.io.graphml.input.GraphMLParser
public class GraphMLParser
Core parser class for GraphML.
This class allows for low-level customization of the parsing process. Usually, it is used by one of GraphMLHandler's
read methods which calls one the various parse method overloads. It should rarely be necessary to use this class directly.
GraphMLHandler
| Constructor Summary | |
|---|---|
GraphMLParser()
|
|
| Method Summary | |
|---|---|
void |
addDeserializationHandler(DeserializationHandler listener)
Register an event listener that can be used to handle DeserializationEvents. |
void |
addInputHandlerProvider(InputHandlerProvider provider)
Register an event listener that can be used to handle QueryInputHandlersEvents. |
protected void |
configureDefaultDeserializationHandlers()
Register default event handlers for the fireDeserializationEvent(DeserializationEvent) event. |
protected void |
configureDefaultInputHandlers()
Register default event handlers for the QueryInputHandlersEvent event. |
protected GraphMLParseContext |
createParseContext(Graph graph)
Create the initial GraphMLParseContext instance. |
Object |
deserialize(GraphMLParseContext context,
Node element,
Class targetType)
Deserialize the content of element. |
protected void |
fireDeserializationEvent(DeserializationEvent event)
Notifies all registered DeserializationHandler instances of event. |
protected void |
fireQueryInputHandlersEvent(QueryInputHandlersEvent event)
Notifies all registered InputHandlerProvider instances of event. |
Object |
getDeserializationProperty(Object key)
Retrieve a deserialization property that has been set by setDeserializationProperty(Object,Object). |
Collection |
getInputHandlers(GraphMLParseContext context,
Element keyDefinition)
Dynamically retrieve all InputHandler instances that can process a GraphML attribute with
key definition keyDefinition. |
ParseEventHandler |
getParseEventHandler()
Return a ParseEventHandler that can be used to subscribe to
various events in the parse process. |
protected Object |
lookup(Class type)
Dynamically retrieve an instance of type. |
void |
parse(Document document,
Graph graph,
GraphElementFactory elementFactory)
Parse the XML document document into an graph instance,
to create the elements. |
void |
parse(InputStream stream,
Graph graph,
GraphElementFactory elementFactory)
Parse the input stream into an graph instance,
to create the elements. |
void |
removeDeserializationHandler(DeserializationHandler listener)
Unregister an event listener that has been registered with addDeserializationHandler(DeserializationHandler). |
void |
removeDeserializationProperty(Object key)
Remove a deserialization property that has been set by setDeserializationProperty(Object,Object). |
void |
removeInputHandlerProvider(InputHandlerProvider provider)
Unregister an event listener that has been registered with addInputHandlerProvider(InputHandlerProvider). |
void |
removeLookup(Class t)
Remove an implementation of t that has been set with setLookup(Class,Object). |
void |
setDeserializationProperty(Object key,
Object value)
Set an initial deserialization property that allows to fine tune the parse process. |
void |
setLookup(Class t,
Object instance)
Register an initial implementation of t for use with Lookup. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public GraphMLParser()
| Method Detail |
|---|
public void addInputHandlerProvider(InputHandlerProvider provider)
QueryInputHandlersEvents.
Registering a listener allows to use InputHandlers dynamically, depending on the
actual input. For each key definition, a QueryInputHandlersEvent is fired and
propagated to all registered event listeners.
Usually, this method should not be used directly, register event listeners
with GraphMLHandler.addInputHandlerProvider(InputHandlerProvider)
on an GraphMLHandler instance instead.
provider - Event listener for the QueryInputHandlersEventfireQueryInputHandlersEvent(QueryInputHandlersEvent),
removeInputHandlerProvider(InputHandlerProvider),
GraphMLHandler.addInputHandlerProvider(InputHandlerProvider)public void removeInputHandlerProvider(InputHandlerProvider provider)
addInputHandlerProvider(InputHandlerProvider).
provider - Event listener for the QueryInputHandlersEventfireQueryInputHandlersEvent(QueryInputHandlersEvent),
addInputHandlerProvider(InputHandlerProvider),
GraphMLHandler.removeInputHandlerProvider(InputHandlerProvider)
protected void fireQueryInputHandlersEvent(QueryInputHandlersEvent event)
throws GraphMLParseException
InputHandlerProvider instances of event.
For each graphml key definition, a QueryInputHandlersEvent is fired and
propagated to all registered event listeners.
GraphMLParseExceptionevent - The event that has been raised.InputHandler,
InputHandlerProvider,
addInputHandlerProvider(InputHandlerProvider),
GraphMLHandler.fireQueryInputHandlersProviders(QueryInputHandlersEvent)public void addDeserializationHandler(DeserializationHandler listener)
DeserializationEvents.
Registering a listener allows to use custom deserialization code.
Usually, this method should not be used directly, register event listeners
with GraphMLHandler.addDeserializationHandler(DeserializationHandler)
on an GraphMLHandler instance instead.
listener - Event listener for the DeserializationEventfireDeserializationEvent(DeserializationEvent),
removeDeserializationHandler(DeserializationHandler),
GraphMLHandler.addDeserializationHandler(DeserializationHandler)public void removeDeserializationHandler(DeserializationHandler listener)
addDeserializationHandler(DeserializationHandler).
listener - Event listener for the DeserializationEventfireDeserializationEvent(DeserializationEvent),
addDeserializationHandler(DeserializationHandler),
GraphMLHandler.removeDeserializationHandler(DeserializationHandler)
protected void fireDeserializationEvent(DeserializationEvent event)
throws GraphMLParseException
DeserializationHandler instances of event.
Usually, this method is called indirectly through calls to GraphMLParseContext.deserialize(GraphMLParseContext,org.w3c.dom.Node,Class)
to parse Xml content to an object.
GraphMLParseExceptionevent - The event that has been raised.DeserializationHandler,
addDeserializationHandler(DeserializationHandler),
GraphMLParseContext.deserialize(GraphMLParseContext,org.w3c.dom.Node,Class),
GraphMLHandler.fireDeserializationEvent(DeserializationEvent)protected void configureDefaultDeserializationHandlers()
fireDeserializationEvent(DeserializationEvent) event.
This implementation does not register any default event handlers
GraphMLHandler.configureDeserializationHandlers(y.base.Graph,GraphMLParser)protected void configureDefaultInputHandlers()
QueryInputHandlersEvent event.
This implementation does not register any default event handlers
GraphMLHandler.configureInputHandlers(y.base.Graph, GraphMLParser)
public Object deserialize(GraphMLParseContext context,
Node element,
Class targetType)
throws GraphMLParseException
element.
Typically, this method is called only indirectly by calls to GraphMLParseContext.deserialize(GraphMLParseContext, org.w3c.dom.Node, Class)}.
This implementation calls fireDeserializationEvent(DeserializationEvent).
GraphMLParseExceptioncontext - The current parse context.element - The XML content that should be deserialized.targetType - the target type of the result.
targetType that is represented by element.GraphMLParseContext.deserialize(GraphMLParseContext, org.w3c.dom.Node, Class)
public Collection getInputHandlers(GraphMLParseContext context,
Element keyDefinition)
throws GraphMLParseException
InputHandler instances that can process a GraphML attribute with
key definition keyDefinition.
Typically, this method is called only indirectly by the parse process.
This implementation calls fireQueryInputHandlersEvent(QueryInputHandlersEvent).
GraphMLParseExceptioncontext - The current parse context.keyDefinition - The key definition element of the GraphML attribute.
InputHandlers that claim to be responsible for handling
the given GraphML attribute.
public void parse(Document document,
Graph graph,
GraphElementFactory elementFactory)
throws GraphMLParseException
document into an graph instance,
to create the elements.
Typically, this method is called indirectly from parse(java.io.InputStream,y.base.Graph,GraphElementFactory) or
GraphMLHandler.read(y.base.Graph,org.w3c.dom.Document).
GraphMLParseExceptiondocument - The XML document instance to parse.graph - The graph instance that is populated.elementFactory - The GraphElementFactory instance that is used to create the elements.GraphMLHandler.read(Graph,Document)
public void parse(InputStream stream,
Graph graph,
GraphElementFactory elementFactory)
throws GraphMLParseException
stream into an graph instance,
to create the elements.
Typically, this method is called indirectly from
GraphMLHandler.read(Graph,InputStream).
GraphMLParseExceptionstream - The input stream to parse.graph - The graph instance that is populated.elementFactory - The GraphElementFactory instance that is used to create the elements.GraphMLHandler.read(Graph,InputStream)protected GraphMLParseContext createParseContext(Graph graph)
GraphMLParseContext instance.
graph - The graph that is parsed.
GraphMLParseContext instance that is suitable for graph.
public void setDeserializationProperty(Object key,
Object value)
To dynamically set or change property values during the parse process, create a new ChildParseContext
and set the property with the corresponding property handling methods.
key - The key for the property.value - The property value.getDeserializationProperty(Object),
GraphMLParseContext.getDeserializationProperty(Object)public void removeDeserializationProperty(Object key)
setDeserializationProperty(Object,Object).
key - The key for the property.GraphMLParseContext.getDeserializationProperty(Object),
setDeserializationProperty(Object,Object)public Object getDeserializationProperty(Object key)
setDeserializationProperty(Object,Object).
key - The key for the property.GraphMLParseContext.getDeserializationProperty(Object),
setDeserializationProperty(Object,Object)
public void setLookup(Class t,
Object instance)
t for use with Lookup.
To dynamically modify lookup behaviour during the parse process, create a new ChildParseContext
and use the corresponding lookup handling methods.
t - The type for which an implementation should be registeredinstance - The implementation of t for lookup retrieval.lookup,
Lookup.lookup(Class)public void removeLookup(Class t)
t that has been set with setLookup(Class,Object).
To dynamically modify lookup behaviour during the parse process, create a new ChildParseContext
and use the corresponding lookup handling methods.
t - The type for which an implementation should be removedsetLookup(Class, Object),
lookup,
Lookup.lookup(Class)protected Object lookup(Class type)
type.
type - The type for which an implementation is needed.
type, or null.Lookup.lookup(Class),
setLookup(Class,Object)public ParseEventHandler getParseEventHandler()
ParseEventHandler that can be used to subscribe to
various events in the parse process.
ParseEventHandler implementation.
|
© Copyright 2000-2013, yWorks GmbH. All rights reserved. |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||