|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.joost.instruction.FactoryBase
public abstract class FactoryBase
Abstract base class for all factory classes which produce nodes
(NodeBase
) for the tree representation of an STX transformation
sheet.
Field Summary | |
---|---|
private static int |
ATT_STATE
state for the finite state machine implemented in parseAVT |
private static int |
EXPR_STATE
state for the finite state machine implemented in parseAVT |
private static int |
LBRACE_STATE
state for the finite state machine implemented in parseAVT |
protected static int |
NO_VALUE
Index in YESNO_VALUES |
private static int |
RBRACE_STATE
state for the finite state machine implemented in parseAVT |
private static int |
STR_STATE
state for the finite state machine implemented in parseAVT |
protected static int |
YES_VALUE
Index in YESNO_VALUES |
protected static String[] |
YESNO_VALUES
Attribute values "yes" and "no" |
Fields inherited from interface net.sf.joost.Constants |
---|
DEBUG, DEFAULT_ENCODING, FEAT_NS, FEAT_NSPREFIX, FEATURE_URI_PREFIX, FUNC_NS, JOOST_EXT_NS, PR_ATTRIBUTES, PR_BUFFER, PR_CHILDREN, PR_CONTINUE, PR_ERROR, PR_SELF, PR_SIBLINGS, STX_NS |
Constructor Summary | |
---|---|
FactoryBase()
|
Method Summary | |
---|---|
protected static void |
checkAttributes(String elementName,
Attributes attrs,
HashSet attNames,
ParseContext context)
Looks for extra attributes and throws an exception if present |
abstract NodeBase |
createNode(NodeBase parent,
String qName,
Attributes attrs,
ParseContext context)
The factory method. |
protected static int |
getEnumAttValue(String name,
Attributes attrs,
String[] enumValues,
ParseContext context)
Looks for the attribute name in attrs
and checks if the value is among the values of enumValues . |
protected static String |
getExpandedName(String qName,
ParseContext context)
Parses a qualified name by extracting local name and namespace URI. |
abstract String |
getName()
|
protected static String |
getRequiredAttribute(String elementName,
Attributes attrs,
String name,
ParseContext context)
Looks for the required attribute name in attrs . |
protected static Tree |
parseAVT(String string,
ParseContext context)
Parses an attribute value template (AVT) and creates a Tree (of AVT nodes) which works similar to the concat function. |
static Tree |
parseExpr(String string,
ParseContext context)
Parses the string given in string as an expression |
protected static Tree |
parsePattern(String string,
ParseContext context)
Parses the string given in string as a pattern. |
protected static Tree |
parseRequiredAVT(String elName,
Attributes attrs,
String attName,
ParseContext context)
|
protected static Tree |
parseRequiredExpr(String elName,
Attributes attrs,
String attName,
ParseContext context)
|
protected static Tree |
parseRequiredPattern(String elName,
Attributes attrs,
String attName,
ParseContext context)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final String[] YESNO_VALUES
protected static final int YES_VALUE
YESNO_VALUES
protected static final int NO_VALUE
YESNO_VALUES
private static final int ATT_STATE
parseAVT
private static final int LBRACE_STATE
parseAVT
private static final int RBRACE_STATE
parseAVT
private static final int EXPR_STATE
parseAVT
private static final int STR_STATE
parseAVT
Constructor Detail |
---|
public FactoryBase()
Method Detail |
---|
public abstract String getName()
public abstract NodeBase createNode(NodeBase parent, String qName, Attributes attrs, ParseContext context) throws SAXException
parent
- the parent NodeqName
- the full name of this nodeattrs
- the attribute set of this nodecontext
- the parse context
SAXParseException
- for missing or wrong attributes, etc.
SAXException
protected static String getRequiredAttribute(String elementName, Attributes attrs, String name, ParseContext context) throws SAXParseException
name
in attrs
.
elementName
- the name of the parent elementattrs
- the attribute setname
- the name of the attribute to look forcontext
- the parse context
SAXParseException
- if this attribute is not presentprotected static int getEnumAttValue(String name, Attributes attrs, String[] enumValues, ParseContext context) throws SAXParseException
name
in attrs
and checks if the value is among the values of enumValues
.
name
- the name of the attribute to look forattrs
- the attribute setenumValues
- allowed attribute valuescontext
- the parse context
enumValues
,
-1 if the attribute isn't present in attrs
SAXParseException
- if the attribute value isn't in
enumValues
protected static void checkAttributes(String elementName, Attributes attrs, HashSet attNames, ParseContext context) throws SAXParseException
elementName
- the name of the parent elementattrs
- the attribute setattNames
- a set of allowed attribute namescontext
- the parse context
SAXParseException
- if an attribute was found that is not
in attNames
protected static String getExpandedName(String qName, ParseContext context) throws SAXParseException
qName
- string representing the qualified namecontext
- the parse context
SAXParseException
protected static Tree parsePattern(String string, ParseContext context) throws SAXParseException
string
as a pattern.
string
- the string to be parsedcontext
- the parse context
Tree
representation of the pattern
SAXParseException
- if a parse error occuredprotected static Tree parseRequiredPattern(String elName, Attributes attrs, String attName, ParseContext context) throws SAXParseException
SAXParseException
getRequiredAttribute(String, Attributes, String, ParseContext)
,
parsePattern(String, ParseContext)
public static Tree parseExpr(String string, ParseContext context) throws SAXParseException
string
as an expression
string
- the string to be parsedcontext
- the parse context
Tree
representation of the expression or
null
if string
was null
SAXParseException
- if a parse error occuredprotected static Tree parseRequiredExpr(String elName, Attributes attrs, String attName, ParseContext context) throws SAXParseException
SAXParseException
getRequiredAttribute(String, Attributes, String, ParseContext)
,
parseExpr(String, ParseContext)
protected static Tree parseAVT(String string, ParseContext context) throws SAXParseException
string
- the string to be parsedcontext
- the parse context
Tree
representation of the AVT or
null
if string
was null
SAXParseException
- if a parse error occuredprotected static Tree parseRequiredAVT(String elName, Attributes attrs, String attName, ParseContext context) throws SAXParseException
SAXParseException
getRequiredAttribute(String, Attributes, String, ParseContext)
,
parseAVT(String, ParseContext)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |