com.espertech.esper.client.soda
Class SelectClause

java.lang.Object
  extended by com.espertech.esper.client.soda.SelectClause
All Implemented Interfaces:
java.io.Serializable

public class SelectClause
extends java.lang.Object
implements java.io.Serializable

A select-clause consists of a list of selection elements (expressions, wildcard(s), stream wildcard and the like) and an optional stream selector.

See Also:
Serialized Form

Constructor Summary
  SelectClause()
          Ctor.
protected SelectClause(StreamSelector streamSelector, java.util.List<SelectClauseElement> selectList)
          Ctor.
 
Method Summary
 SelectClause add(Expression expression)
          Adds an expression to the select clause.
 SelectClause add(Expression expression, java.lang.String asName)
          Adds an expression to the select clause and an "as"-asName for the column.
 SelectClause add(java.lang.String... propertyNames)
          Adds property names to be selected.
 void addElements(java.util.List<SelectClauseElement> selectClauseElements)
          Add a select expression element.
 SelectClause addStreamWildcard(java.lang.String streamName)
          Adds to the select-clause a stream wildcard selector (e.g.
 SelectClause addStreamWildcard(java.lang.String streamName, java.lang.String columnName)
          Adds to the select-clause a stream wildcard selector with column name (e.g.
 SelectClause addWildcard()
          Adds to the select-clause a wildcard selector (e.g.
 SelectClause addWithAsProvidedName(java.lang.String propertyName, java.lang.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, java.lang.String... propertyNames)
          Creates a select-clause consisting of a list of property names.
static SelectClause create(java.lang.String... propertyNames)
          Creates a select-clause consisting of a list of property names.
static SelectClause createStreamWildcard(java.lang.String streamName)
          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.
 SelectClause distinct()
          Sets distinct to true.
 SelectClause distinct(boolean distinct)
          Sets distinct
 boolean getDistinct()
          Returns indicator whether distinct or not.
 java.util.List<SelectClauseElement> getSelectList()
          Returns the list of expressions in the select clause.
 StreamSelector getStreamSelector()
          Returns the stream selector.
 boolean isDistinct()
          Returns indicator whether distinct or not.
 void setDistinct(boolean distinct)
          Returns indicator whether distinct or not.
 void setSelectList(java.util.List<SelectClauseElement> selectList)
          Sets the list of expressions in the select clause.
 void setStreamSelector(StreamSelector streamSelector)
          Sets the stream selector.
 SelectClause streamSelector(StreamSelector streamSelector)
          Sets the stream selector.
 void toEPL(java.io.StringWriter writer, EPStatementFormatter formatter, boolean isTopLevel, boolean andDelete)
          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

public SelectClause()
Ctor.


SelectClause

protected SelectClause(StreamSelector streamSelector,
                       java.util.List<SelectClauseElement> selectList)
Ctor.

Parameters:
streamSelector - selects the stream
selectList - is a list of elements in the select-clause
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(java.lang.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(java.lang.String streamName)
Creates a select-clause with a single stream wildcard selector (e.g. select streamName.* from MyStream as streamName)

Parameters:
streamName - is the name 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,
                                  java.lang.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(java.lang.String... propertyNames)
Adds property names to be selected.

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

addWithAsProvidedName

public SelectClause addWithAsProvidedName(java.lang.String propertyName,
                                          java.lang.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,
                        java.lang.String asName)
Adds an expression to the select clause and an "as"-asName for the column.

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

getSelectList

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

Returns:
list of expressions with column names

addStreamWildcard

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

Parameters:
streamName - is the name given to a stream
Returns:
select-clause

addWildcard

public SelectClause addWildcard()
Adds to the select-clause a wildcard selector (e.g. select * from MyStream as streamName)

Returns:
select-clause

addStreamWildcard

public SelectClause addStreamWildcard(java.lang.String streamName,
                                      java.lang.String columnName)
Adds to the select-clause a stream wildcard selector with column name (e.g. select streamName.* as colName from MyStream as streamName)

Parameters:
streamName - is the name given to a stream
columnName - the name given to the column
Returns:
select-clause

setStreamSelector

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

Parameters:
streamSelector - stream selector to set

streamSelector

public SelectClause streamSelector(StreamSelector streamSelector)
Sets the stream selector.

Parameters:
streamSelector - stream selector to set
Returns:
select clause

getStreamSelector

public StreamSelector getStreamSelector()
Returns the stream selector.

Returns:
stream selector

setSelectList

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

Parameters:
selectList - list of expressions with column names

addElements

public void addElements(java.util.List<SelectClauseElement> selectClauseElements)
Add a select expression element.

Parameters:
selectClauseElements - to add

toEPL

public void toEPL(java.io.StringWriter writer,
                  EPStatementFormatter formatter,
                  boolean isTopLevel,
                  boolean andDelete)
Renders the clause in textual representation.

Parameters:
writer - to output to
formatter - for newline-whitespace formatting
isTopLevel - to indicate if this select-clause is inside other clauses.
andDelete - indicator whether select and delete

isDistinct

public boolean isDistinct()
Returns indicator whether distinct or not.

Returns:
distinct indicator

getDistinct

public boolean getDistinct()
Returns indicator whether distinct or not.

Returns:
distinct indicator

setDistinct

public void setDistinct(boolean distinct)
Returns indicator whether distinct or not.

Parameters:
distinct - distinct indicator

distinct

public SelectClause distinct(boolean distinct)
Sets distinct

Parameters:
distinct - distinct indicator
Returns:
the select clause

distinct

public SelectClause distinct()
Sets distinct to true.

Returns:
the select clause

© 2006-2015 EsperTech Inc.
All rights reserved.
Visit us at espertech.com