|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.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 DeserializationEvent s. |
void |
addInputHandlerProvider(InputHandlerProvider provider)
Register an event listener that can be used to handle QueryInputHandlersEvent s. |
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. |
java.lang.Object |
deserialize(GraphMLParseContext context,
org.w3c.dom.Node element,
java.lang.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 . |
java.lang.Object |
getDeserializationProperty(java.lang.Object key)
Retrieve a deserialization property that has been set by setDeserializationProperty(Object,Object) . |
java.util.Collection |
getInputHandlers(GraphMLParseContext context,
org.w3c.dom.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 java.lang.Object |
lookup(java.lang.Class type)
Dynamically retrieve an instance of type . |
void |
parse(org.w3c.dom.Document document,
Graph graph,
GraphElementFactory elementFactory)
Parse the XML document document into an graph instance,
to create the elements. |
void |
parse(java.io.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(java.lang.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(java.lang.Class t)
Remove an implementation of t that has been set with setLookup(Class,Object) . |
void |
setDeserializationProperty(java.lang.Object key,
java.lang.Object value)
Set an initial deserialization property that allows to fine tune the parse process. |
void |
setLookup(java.lang.Class t,
java.lang.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)
QueryInputHandlersEvent
s.
Registering a listener allows to use InputHandler
s 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 QueryInputHandlersEvent
fireQueryInputHandlersEvent(QueryInputHandlersEvent)
,
removeInputHandlerProvider(InputHandlerProvider)
,
GraphMLHandler.addInputHandlerProvider(InputHandlerProvider)
public void removeInputHandlerProvider(InputHandlerProvider provider)
addInputHandlerProvider(InputHandlerProvider)
.
provider
- Event listener for the QueryInputHandlersEvent
fireQueryInputHandlersEvent(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.
event
- The event that has been raised.
GraphMLParseException
InputHandler
,
InputHandlerProvider
,
addInputHandlerProvider(InputHandlerProvider)
,
GraphMLHandler.fireQueryInputHandlersProviders(QueryInputHandlersEvent)
public void addDeserializationHandler(DeserializationHandler listener)
DeserializationEvent
s.
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 DeserializationEvent
fireDeserializationEvent(DeserializationEvent)
,
removeDeserializationHandler(DeserializationHandler)
,
GraphMLHandler.addDeserializationHandler(DeserializationHandler)
public void removeDeserializationHandler(DeserializationHandler listener)
addDeserializationHandler(DeserializationHandler)
.
listener
- Event listener for the DeserializationEvent
fireDeserializationEvent(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.
event
- The event that has been raised.
GraphMLParseException
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 java.lang.Object deserialize(GraphMLParseContext context, org.w3c.dom.Node element, java.lang.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)
.
context
- 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
.
GraphMLParseException
GraphMLParseContext.deserialize(GraphMLParseContext, org.w3c.dom.Node, Class)
public java.util.Collection getInputHandlers(GraphMLParseContext context, org.w3c.dom.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)
.
context
- The current parse context.keyDefinition
- The key definition element of the GraphML attribute.
InputHandler
s that claim to be responsible for handling
the given GraphML attribute.
GraphMLParseException
public void parse(org.w3c.dom.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)
.
document
- The XML document instance to parse.graph
- The graph instance that is populated.elementFactory
- The GraphElementFactory
instance that is used to create the elements.
GraphMLParseException
GraphMLHandler.read(Graph,Document)
public void parse(java.io.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)
.
stream
- The input stream to parse.graph
- The graph instance that is populated.elementFactory
- The GraphElementFactory
instance that is used to create the elements.
GraphMLParseException
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(java.lang.Object key, java.lang.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(java.lang.Object key)
setDeserializationProperty(Object,Object)
.
key
- The key for the property.GraphMLParseContext.getDeserializationProperty(Object)
,
setDeserializationProperty(Object,Object)
public java.lang.Object getDeserializationProperty(java.lang.Object key)
setDeserializationProperty(Object,Object)
.
key
- The key for the property.GraphMLParseContext.getDeserializationProperty(Object)
,
setDeserializationProperty(Object,Object)
public void setLookup(java.lang.Class t, java.lang.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(java.lang.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 java.lang.Object lookup(java.lang.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-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |