- java.lang.Object
-
- io.github.mmm.marshall.AbstractMarshallingObject
-
- io.github.mmm.entity.bean.sql.AbstractClause
-
- io.github.mmm.entity.bean.sql.select.Select
-
- All Implemented Interfaces:
Clause
,StartClause
,io.github.mmm.marshall.MarshallableObject
,io.github.mmm.marshall.Marshaller<Object>
,io.github.mmm.marshall.Marshalling<Object>
,io.github.mmm.marshall.MarshallingObject
,io.github.mmm.marshall.UnmarshallableObject
,io.github.mmm.marshall.Unmarshaller<Object>
public final class Select extends AbstractClause implements StartClause
StartClause
of aSelectStatement
to query data from the database.- Since:
- 1.0.0
-
-
Field Summary
Fields Modifier and Type Field Description static String
NAME_DISTINCT
Name of propertyisDistinct()
for marshaling.static String
NAME_SELECT
Name ofSelect
for marshaling.static String
NAME_SELECTIONS
Name of propertyselections
for marshaling.
-
Constructor Summary
Constructors Constructor Description Select()
The constructor.Select(io.github.mmm.property.criteria.CriteriaAggregation<?> aggregation)
The constructor.Select(io.github.mmm.property.criteria.CriteriaAggregation<?>... aggregations)
The constructor.Select(io.github.mmm.value.PropertyPath<?> property)
The constructor.Select(io.github.mmm.value.PropertyPath<?>... properties)
The constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Select
and(io.github.mmm.property.criteria.CriteriaAggregation<?> aggregation)
Select
and(io.github.mmm.property.criteria.CriteriaAggregation<?>... aggregations)
Select
and(io.github.mmm.value.PropertyPath<?> property)
Select
and(io.github.mmm.value.PropertyPath<?>... properties)
Select
distinct()
SetsDISTINCT
selection (filter out duplicates).<E extends EntityBean>
SelectFrom<E>from(E entity)
protected String
getMarshallingName()
List<Supplier<?>>
getSelections()
SelectStatement<?>
getStatement()
boolean
isDistinct()
protected void
readProperty(io.github.mmm.marshall.StructuredReader reader, String name)
protected void
writeProperties(io.github.mmm.marshall.StructuredWriter writer)
-
Methods inherited from class io.github.mmm.entity.bean.sql.AbstractClause
toString
-
-
-
-
Field Detail
-
NAME_SELECT
public static final String NAME_SELECT
Name ofSelect
for marshaling.- See Also:
- Constant Field Values
-
NAME_DISTINCT
public static final String NAME_DISTINCT
Name of propertyisDistinct()
for marshaling.- See Also:
- Constant Field Values
-
NAME_SELECTIONS
public static final String NAME_SELECTIONS
Name of propertyselections
for marshaling.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Select
public Select()
The constructor.
-
Select
public Select(io.github.mmm.value.PropertyPath<?> property)
The constructor.- Parameters:
property
- theproperty
to select.
-
Select
public Select(io.github.mmm.value.PropertyPath<?>... properties)
The constructor.- Parameters:
properties
- theproperties
to select.
-
Select
public Select(io.github.mmm.property.criteria.CriteriaAggregation<?> aggregation)
The constructor.- Parameters:
aggregation
- theCriteriaAggregation
to select.
-
Select
public Select(io.github.mmm.property.criteria.CriteriaAggregation<?>... aggregations)
The constructor.- Parameters:
aggregations
- theCriteriaAggregation
s to select.
-
-
Method Detail
-
getMarshallingName
protected String getMarshallingName()
- Specified by:
getMarshallingName
in classAbstractClause
- Returns:
- the name of the property for this clause.
-
isDistinct
public boolean isDistinct()
- Returns:
true
forDISTINCT
selection (filter out duplicates),false
otherwise.
-
getSelections
public List<Supplier<?>> getSelections()
- Returns:
- the
List
of selections. Only use for generic code. To build queries use fluent API methods such asand(PropertyPath)
orfrom(EntityBean)
.
-
getStatement
public SelectStatement<?> getStatement()
- Returns:
- the owning
SelectStatement
ornull
if not initialized (what happens whenfrom(EntityBean)
is called).
-
and
public Select and(io.github.mmm.property.criteria.CriteriaAggregation<?> aggregation)
- Parameters:
aggregation
- theCriteriaAggregation
to add to the selection.- Returns:
- this
Select
for fluent API calls.
-
and
public Select and(io.github.mmm.property.criteria.CriteriaAggregation<?>... aggregations)
- Parameters:
aggregations
- theCriteriaAggregation
s to add to the selection.- Returns:
- this
Select
for fluent API calls.
-
and
public Select and(io.github.mmm.value.PropertyPath<?> property)
- Parameters:
property
- theproperty
to add to the selection.- Returns:
- this
Select
for fluent API calls.
-
and
public Select and(io.github.mmm.value.PropertyPath<?>... properties)
- Parameters:
properties
- theproperties
to add to the selection.- Returns:
- this
Select
for fluent API calls.
-
distinct
public Select distinct()
SetsDISTINCT
selection (filter out duplicates).- Returns:
- this
Select
for fluent API calls.
-
from
public <E extends EntityBean> SelectFrom<E> from(E entity)
- Type Parameters:
E
- type of theEntityBean
.- Parameters:
entity
- theentity
to select from.- Returns:
- the
SelectFrom
for fluent API calls.
-
writeProperties
protected void writeProperties(io.github.mmm.marshall.StructuredWriter writer)
- Overrides:
writeProperties
in classAbstractClause
-
readProperty
protected void readProperty(io.github.mmm.marshall.StructuredReader reader, String name)
- Overrides:
readProperty
in classAbstractClause
-
-