public class DefWalker
extends java.lang.Object
Constructor and Description |
---|
DefWalker(NodeDef[] defs)
Construct a DefWalker, attaching it to a NodeDef array and
specifying a PrintWriter to display error messages for later
consumption.
|
Modifier and Type | Method and Description |
---|---|
NodeDef |
expect(java.lang.Class elemType)
Returns the next node in the defs array, but only if it matches
the provided class elemType.
|
NodeDef[] |
expectArray(java.lang.Class elemType)
Returns a portion of the remaining nodes in the defs array as an
array.
|
java.lang.Object |
expectTypeArray(java.lang.Class elemType)
Returns a portion of the remaining nodes in the defs array as an
array.
|
public DefWalker(NodeDef[] defs)
defs
- a NodeDef array to walk. All returned objects
come from this array.public NodeDef expect(java.lang.Class elemType) throws XOMException
elemType
- the Class of NodeDef to expect. This class will
always be assignable from the returned object.XOMException
- if there are no more nodes in the defs
array or if the next node is of an incorrect type.public NodeDef[] expectArray(java.lang.Class elemType)
elemType
- the Class of NodeDef to expect and return. This
class will always be assignable from each returned object in the
array.public java.lang.Object expectTypeArray(java.lang.Class elemType)
elemType
- the Class of NodeDef to expect and return. This
class will always be assignable from each returned object in the
array.