Class SelectClause

java.lang.Object
com.espertech.esper.common.client.soda.SelectClause
All Implemented Interfaces:
Serializable

public class SelectClause extends Object implements 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:
  • Constructor Details

    • SelectClause

      public SelectClause()
      Ctor.
    • SelectClause

      protected SelectClause(StreamSelector streamSelector, List<SelectClauseElement> selectList)
      Ctor.
      Parameters:
      streamSelector - selects the stream
      selectList - is a list of elements in the select-clause
  • Method Details

    • 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 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, 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
    • addWithAsProvidedName

      public SelectClause addWithAsProvidedName(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"-provided for the column
      Returns:
      clause
    • getSelectList

      public List<SelectClauseElement> getSelectList()
      Returns the list of expressions in the select clause.
      Returns:
      list of expressions with column names
    • addStreamWildcard

      public SelectClause addStreamWildcard(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(String streamName, 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(List<SelectClauseElement> selectList)
      Sets the list of expressions in the select clause.
      Parameters:
      selectList - list of expressions with column names
    • addElements

      public void addElements(List<SelectClauseElement> selectClauseElements)
      Add a select expression element.
      Parameters:
      selectClauseElements - to add
    • toEPL

      public void toEPL(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