|
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.AbstractInputHandler
public abstract class AbstractInputHandler
An abstract convenience implementation of the InputHandler
interface.
Constructor Summary | |
---|---|
protected |
AbstractInputHandler()
Initializes a new instance of the AbstractInputHandler class. |
protected |
AbstractInputHandler(ParsePrecedence precedence)
Initializes a new instance of the AbstractInputHandler class. |
Method Summary | |
---|---|
void |
applyDefault(GraphMLParseContext context)
This method is invoked when no data tag is defined, and the default value should be applied. |
java.lang.Object |
getDefaultValue()
Gets the default value that will be applied to the keys where the data attribute is missing. |
ParsePrecedence |
getPrecedence()
Gets the parse precedence that is associated with this handler. |
java.util.Set |
getValidScopes()
Allows to restrict the scopes where the handler is used, if the handler is registered to KeyScope.ALL . |
void |
initializeFromKeyDefinition(GraphMLParseContext context,
org.w3c.dom.Element definition)
Initializes this instance from the GraphML key definition. |
boolean |
isDefaultExists()
Gets value indicating whether the default value exists in the key definition. |
boolean |
isParseDefaultValue()
Gets a value indicating whether the default value in the key definition should be parsed. |
void |
parseData(GraphMLParseContext context,
org.w3c.dom.Node node)
This method is invoked each time a data element with matching key is processed. |
protected abstract java.lang.Object |
parseDataCore(GraphMLParseContext context,
org.w3c.dom.Node node)
Abstract method callback that actually parses the data. |
void |
setDefaultExists(boolean value)
Sets a value indicating whether the default value exists in the key definition. |
void |
setDefaultValue(java.lang.Object value)
Sets the default value that will be applied to the keys where the data attribute is missing. |
void |
setParseDefaultValue(boolean value)
Sets a value indicating whether the default value in the key definition should be parsed. |
void |
setPrecedence(ParsePrecedence value)
Sets the parse precedence that is associated with this handler. |
void |
setValidScopes(java.util.Set value)
Allows to restrict the scopes where the handler is used, if the handler is registered to KeyScope.ALL . |
protected abstract void |
setValue(GraphMLParseContext context,
java.lang.Object key,
java.lang.Object data)
Abstract method callback that actually stores the value with the keys. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected AbstractInputHandler()
AbstractInputHandler
class.
The getPrecedence()
has an initial value
of ParsePrecedence.DEFAULT
.
protected AbstractInputHandler(ParsePrecedence precedence)
AbstractInputHandler
class.
The getPrecedence()
gets the initial value
assigned to precedence
precedence
- The precedence to assign to the getPrecedence()
property.Method Detail |
---|
public boolean isParseDefaultValue()
true
if the default value should be parsed; otherwise, false
. The default is true
.setParseDefaultValue(boolean)
,
getDefaultValue()
public void setParseDefaultValue(boolean value)
value
- true
if the default value should be parsed; otherwise, false
. The default is true
.getDefaultValue()
,
setDefaultExists(boolean)
public java.lang.Object getDefaultValue()
setDefaultValue(Object)
public void setDefaultValue(java.lang.Object value)
value
- The default value.getDefaultValue()
public boolean isDefaultExists()
If this property is to true
, the
applyDefault(GraphMLParseContext)
method will call the
setValue(GraphMLParseContext, Object, Object)
method
true
if the default value exists; otherwise, false
.setDefaultExists(boolean)
,
isParseDefaultValue()
,
getDefaultValue()
public void setDefaultExists(boolean value)
If this property is set to true
, the
applyDefault(GraphMLParseContext)
method will call the
setValue(GraphMLParseContext, Object, Object)
method
value
- true
if the default value exists; otherwise, false
.isDefaultExists()
,
isParseDefaultValue()
,
getDefaultValue()
public ParsePrecedence getPrecedence()
getPrecedence
in interface InputHandler
setPrecedence(ParsePrecedence)
public void setPrecedence(ParsePrecedence value)
value
- The parse precedence.getPrecedence()
public void parseData(GraphMLParseContext context, org.w3c.dom.Node node) throws GraphMLParseException
parseData
in interface InputHandler
context
- the current parse context.node
- the DOM node representing the data element.
GraphMLParseException
parseDataCore(GraphMLParseContext,org.w3c.dom.Node)
public java.util.Set getValidScopes()
KeyScope.ALL
.
By default the collection contains the KeyScope.ALL
.
KeyScope
s for this handler.setValidScopes(java.util.Set)
public void setValidScopes(java.util.Set value)
KeyScope.ALL
.
By default the collection contains the KeyScope.ALL
.
value
- A set of valid KeyScope
s for this handler.getValidScopes()
public void initializeFromKeyDefinition(GraphMLParseContext context, org.w3c.dom.Element definition) throws GraphMLParseException
This implementation looks for the GraphML default element and delegates to
parseDataCore(GraphMLParseContext, org.w3c.dom.Node)
if a default
is found to store the getDefaultValue()
and set the
isDefaultExists()
property.
context
- The context.definition
- The definition.
GraphMLParseException
protected abstract java.lang.Object parseDataCore(GraphMLParseContext context, org.w3c.dom.Node node) throws GraphMLParseException
context
- The context.node
- The node that contains the data. This is either the GraphML data
element or the
default
element.
GraphMLParseException
protected abstract void setValue(GraphMLParseContext context, java.lang.Object key, java.lang.Object data) throws GraphMLParseException
context
- The context.key
- The key.data
- The data.
GraphMLParseException
public void applyDefault(GraphMLParseContext context) throws GraphMLParseException
This implementation delegates to
setValue(GraphMLParseContext, Object, Object)
.
if isDefaultExists()
applyDefault
in interface InputHandler
context
- the current parse context.
GraphMLParseException
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |