net.esper.client.soda
Class SelectClause

java.lang.Object
  extended by net.esper.client.soda.SelectClause
All Implemented Interfaces:
Serializable

public class SelectClause
extends Object
implements Serializable

A select-clause consists of selection expressions and optionally an indicator that a wildcard is selected and an optional stream selector.

See Also:
Serialized Form

Constructor Summary
protected SelectClause(StreamSelector streamSelector, boolean isWildcard)
          Ctor.
  SelectClause(StreamSelector streamSelector, String... propertyNames)
          Ctor.
 
Method Summary
 SelectClause add(Expression expression)
          Adds an expression to the select clause.
 SelectClause add(Expression expression, String asName)
          Adds an expression to the select clause and an "as"-asName for the column.
 SelectClause add(String... propertyNames)
          Adds property names to be selected.
 SelectClause addStreamWildcard(String streamAliasName)
          Adds to the select-clause a stream wildcard selector (e.g.
 SelectClause addStreamWildcard(String streamAliasName, String columnAlias)
          Adds to the select-clause a stream wildcard selector with column alias (e.g.
 SelectClause addWithAlias(String propertyName, String asName)
          Adds a single property name and an "as"-asName for the column.
static SelectClause create()
          Creates an empty select-clause to be added to via add methods.
static SelectClause create(StreamSelector streamSelector)
          Creates an empty select-clause.
static SelectClause create(StreamSelector streamSelector, String... propertyNames)
          Creates a select-clause consisting of a list of property names.
static SelectClause create(String... propertyNames)
          Creates a select-clause consisting of a list of property names.
static SelectClause createStreamWildcard(String streamAliasName)
          Creates a select-clause with a single stream wildcard selector (e.g.
static SelectClause createWildcard()
          Creates a wildcard select-clause, additional expressions can still be added.
static SelectClause createWildcard(StreamSelector streamSelector)
          Creates a wildcard select-clause, additional expressions can still be added.
 List<SelectClauseElement> getSelectList()
          Returns the list of expressions in the select clause.
 StreamSelector getStreamSelector()
          Returns the stream selector.
 List<SelectClauseStreamWildcard> getStreamWildcardSelectList()
          Returns the list of stream wildcard selectors (e.g.
 boolean isWildcard()
          Returns true is a wildcard is part of the select clause, or false if not.
 void setSelectList(List<SelectClauseElement> selectList)
          Sets the list of expressions in the select clause.
 void setStreamSelector(StreamSelector streamSelector)
          Sets the stream selector.
 void setWildcard(boolean wildcard)
          Set to true if a wildcard is part of the select clause, or false if not.
 void toEQL(StringWriter writer)
          Renders the clause in textual representation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SelectClause

protected SelectClause(StreamSelector streamSelector,
                       boolean isWildcard)
Ctor.

Parameters:
streamSelector - selects the stream
isWildcard - is true for wildcard selects

SelectClause

public SelectClause(StreamSelector streamSelector,
                    String... propertyNames)
Ctor.

Parameters:
streamSelector - select the stream
propertyNames - is a list of properties
Method Detail

createWildcard

public static SelectClause createWildcard()
Creates a wildcard select-clause, additional expressions can still be added.

Returns:
select-clause

create

public static SelectClause create()
Creates an empty select-clause to be added to via add methods.

Returns:
select-clause

create

public static SelectClause create(String... propertyNames)
Creates a select-clause consisting of a list of property names.

Parameters:
propertyNames - is the names of properties to select
Returns:
select-clause

createStreamWildcard

public static SelectClause createStreamWildcard(String streamAliasName)
Creates a select-clause with a single stream wildcard selector (e.g. select streamAliasName.* from MyStream as streamAliasName)

Parameters:
streamAliasName - is the alias given to a stream
Returns:
select-clause

createWildcard

public static SelectClause createWildcard(StreamSelector streamSelector)
Creates a wildcard select-clause, additional expressions can still be added.

Parameters:
streamSelector - can be used to select insert or remove streams
Returns:
select-clause

create

public static SelectClause create(StreamSelector streamSelector)
Creates an empty select-clause.

Parameters:
streamSelector - can be used to select insert or remove streams
Returns:
select-clause

create

public static SelectClause create(StreamSelector streamSelector,
                                  String... propertyNames)
Creates a select-clause consisting of a list of property names.

Parameters:
propertyNames - is the names of properties to select
streamSelector - can be used to select insert or remove streams
Returns:
select-clause

add

public SelectClause add(String... propertyNames)
Adds property names to be selected.

Parameters:
propertyNames - is a list of property names to add
Returns:
clause

addWithAlias

public SelectClause addWithAlias(String propertyName,
                                 String asName)
Adds a single property name and an "as"-asName for the column.

Parameters:
propertyName - name of property
asName - is the "as"-asName for the column
Returns:
clause

add

public SelectClause add(Expression expression)
Adds an expression to the select clause.

Parameters:
expression - to add
Returns:
clause

add

public SelectClause add(Expression expression,
                        String asName)
Adds an expression to the select clause and an "as"-asName for the column.

Parameters:
expression - to add
asName - is the "as"-alias for the column
Returns:
clause

getStreamSelector

public StreamSelector getStreamSelector()
Returns the stream selector.

Returns:
stream selector

getSelectList

public List<SelectClauseElement> getSelectList()
Returns the list of expressions in the select clause.

Returns:
list of expressions with column aliases

addStreamWildcard

public SelectClause addStreamWildcard(String streamAliasName)
Adds to the select-clause a stream wildcard selector (e.g. select streamAliasName.* from MyStream as streamAliasName)

Parameters:
streamAliasName - is the alias given to a stream
Returns:
select-clause

addStreamWildcard

public SelectClause addStreamWildcard(String streamAliasName,
                                      String columnAlias)
Adds to the select-clause a stream wildcard selector with column alias (e.g. select streamAliasName.* as colAlias from MyStream as streamAliasName)

Parameters:
streamAliasName - is the alias given to a stream
columnAlias - the alias given to the column
Returns:
select-clause

getStreamWildcardSelectList

public List<SelectClauseStreamWildcard> getStreamWildcardSelectList()
Returns the list of stream wildcard selectors (e.g. select streamAliasName.* as colAlias from MyStream as streamAliasName)

Returns:
list of stream wildcard selectors

isWildcard

public boolean isWildcard()
Returns true is a wildcard is part of the select clause, or false if not.

Returns:
true for wildcard

setStreamSelector

public void setStreamSelector(StreamSelector streamSelector)
Sets the stream selector.

Parameters:
streamSelector - stream selector to set

setSelectList

public void setSelectList(List<SelectClauseElement> selectList)
Sets the list of expressions in the select clause.

Parameters:
selectList - list of expressions with column aliases

setWildcard

public void setWildcard(boolean wildcard)
Set to true if a wildcard is part of the select clause, or false if not.

Parameters:
wildcard - true for wildcard

toEQL

public void toEQL(StringWriter writer)
Renders the clause in textual representation.

Parameters:
writer - to output to

© 2007 EsperTech Inc.
All rights reserved.
Visit us at espertech.com