|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.olap4j.mdx.IdentifierNode
public class IdentifierNode
Multi-part identifier.
An identifier is immutable.
An identifer consists of one or more IdentifierSegment
s. A segment
is either:
CA
',
[San Francisco]
', or
&[Key 1]&Key2&[5]
'.
Segment types are indicated by the Quoting
enumeration.
A key segment is of type Quoting.KEY
, and has one or more
component parts accessed via the
IdentifierSegment.getKeyParts()
method. The parts
are of type Quoting.UNQUOTED
or Quoting.QUOTED
.
A simple example is the identifier Measures.[Unit Sales]
. It
has two segments:
A more complex example illustrates a compound key. The identifier [Customers].[City].&[San Francisco]&CA&USA.&[cust1234]
contains four segments as follows:
KEY
.
It has 3 sub-segments:
Constructor Summary | |
---|---|
IdentifierNode(IdentifierSegment... segments)
Creates an identifier containing one or more segments. |
|
IdentifierNode(List<IdentifierSegment> segments)
Creates an identifier containing a list of segments. |
Method Summary | ||
---|---|---|
|
accept(ParseTreeVisitor<T> visitor)
Accepts a visitor to this MDX parse tree node. |
|
IdentifierNode |
append(IdentifierSegment segment)
Returns a new Identifier consisting of this one with another segment appended. |
|
IdentifierNode |
deepCopy()
Creates a deep copy of this ParseTreeNode object. |
|
ParseRegion |
getRegion()
Returns the region of the source code which this node was created from, if it was created by parsing. |
|
List<IdentifierSegment> |
getSegmentList()
Returns the list of segments which consistitute this identifier. |
|
Type |
getType()
Returns the type of this expression. |
|
static IdentifierNode |
ofNames(String... names)
Converts an array of quoted name segments into an identifier. |
|
static IdentifierNode |
parseIdentifier(String identifier)
Parses an MDX identifier string into an IdentifierNode . |
|
String |
toString()
|
|
void |
unparse(ParseTreeWriter writer)
Converts this node into MDX text. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public IdentifierNode(IdentifierSegment... segments)
segments
- Array of Segments, each consisting of a name and quoting
stylepublic IdentifierNode(List<IdentifierSegment> segments)
segments
- List of segmentsMethod Detail |
---|
public Type getType()
ParseTreeNode
Returns null if this node is not an expression, for instance a
SELECT
node.
getType
in interface ParseTreeNode
public List<IdentifierSegment> getSegmentList()
public ParseRegion getRegion()
ParseTreeNode
A non-leaf node's region will encompass the regions of all of its
children. For example, a the region of a function call node
Crossjoin([Gender], {[Store].[USA]})
stretches from
the first character of the function name to the closing parenthesis.
Region may be null, if the node was created programmatically, not from a piece of source code.
getRegion
in interface ParseTreeNode
public IdentifierNode append(IdentifierSegment segment)
segment
- Name of segment
public <T> T accept(ParseTreeVisitor<T> visitor)
ParseTreeNode
The implementation should generally dispatches to the
ParseTreeVisitor.visit(org.olap4j.mdx.SelectNode)
method appropriate to the type of expression.
accept
in interface ParseTreeNode
visitor
- Visitor
public void unparse(ParseTreeWriter writer)
ParseTreeNode
unparse
in interface ParseTreeNode
writer
- Parse tree writerpublic String toString()
toString
in class Object
public IdentifierNode deepCopy()
ParseTreeNode
Note: implementing classes can return the concrete type instead of ParseTreeNode (using Java 1.5 covariant return types)
deepCopy
in interface ParseTreeNode
public static IdentifierNode parseIdentifier(String identifier)
IdentifierNode
.
It contains a list of segments
, each
of which is a name combined with a description of how the name
was quoted
. For example,
parseIdentifier(
"[Customers].USA.[South Dakota].[Sioux Falls].&[1245]")
returns an IdentifierNode consisting of the following segments:
- NameSegment("Customers", quoted=true),
- NameSegment("USA", quoted=false),
- NameSegment("South Dakota", quoted=true),
- NameSegment("Sioux Falls", quoted=true),
- KeySegment( { NameSegment("1245", quoted=true) } )
identifier
- MDX identifier string
IllegalArgumentException
- if the format of the identifier is
invalidofNames(String...)
public static IdentifierNode ofNames(String... names)
For example,
IdentifierNode.ofNames("Store", "USA", "CA")
returns an IdentifierNode consisting of the following segments:
- NameSegment("Customers", quoted=true),
- NameSegment("USA", quoted=false),
- NameSegment("South Dakota", quoted=true),
- NameSegment("Sioux Falls", quoted=true),
- KeySegment( { NameSegment("1245", quoted=true) } )
names
- Array of names
parseIdentifier(String)
|
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |