Package org.hcjf.layers.query
Class ParameterizedQuery
- java.lang.Object
-
- org.hcjf.layers.query.ParameterizedQuery
-
- All Implemented Interfaces:
Queryable,BsonParcelable
public class ParameterizedQuery extends java.lang.Object implements Queryable
This class contains a query instance to evaluate using the parameters associated to this instance.- Author:
- javaito
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classParameterizedQuery.ParameterizedConsumerThis implementation use the parameters of the instance.static classParameterizedQuery.ParameterizedQueryBsonCustomBuilderLayerThis inner class implements the custom method to create a Parameterized Query instance from a bson document.-
Nested classes/interfaces inherited from interface org.hcjf.utils.bson.BsonParcelable
BsonParcelable.Builder
-
Nested classes/interfaces inherited from interface org.hcjf.layers.query.Queryable
Queryable.Consumer<O>, Queryable.DataSource<O>, Queryable.DefaultConsumer<O>, Queryable.IntrospectionConsumer<O>, Queryable.ReadableDataSource
-
-
Field Summary
-
Fields inherited from interface org.hcjf.utils.bson.BsonParcelable
MAP_KEYS_FIELD_NAME, MAP_VALUES_FIELD_NAME, PARCELABLE_CLASS_NAME
-
-
Constructor Summary
Constructors Constructor Description ParameterizedQuery(Query query)
-
Method Summary
Modifier and Type Method Description ParameterizedQueryadd(java.lang.Object parameter)Add new parameter into the next place.<O> java.util.Collection<O>evaluate(java.util.Collection<O> dataSource)This method evaluate each object of the collection and sort filtered object to create a result add with the object filtered and sorted.<O> java.util.Collection<O>evaluate(java.util.Collection<O> dataSource, Queryable.Consumer<O> consumer)This method evaluate each object of the collection and sort filtered object to create a result add with the object filtered and sorted.<O> java.util.Collection<O>evaluate(Queryable.DataSource<O> dataSource)This method evaluate each object of the collection and sort filtered object to create a result add with the object filtered and sorted.<O> java.util.Collection<O>evaluate(Queryable.DataSource<O> dataSource, Queryable.Consumer<O> consumer)This method evaluate each object of the collection and sort filtered object to create a result add with the object filtered and sorted.java.util.List<java.lang.Object>getParameters()Returns a list of parameters into the queryable.QuerygetQuery()Returns the query associated to the instance.java.lang.StringgetResourceName()Return the resource name.<P extends BsonParcelable>
Ppopulate(org.hcjf.bson.BsonDocument document)Populate the current instance of parcelable with all the information into the bson document.ParameterizedQueryset(java.lang.Integer place, java.lang.Object parameter)Add a new parameter in the specific place, if exists a parameter in the indicated place then this parameter is replaced.org.hcjf.bson.BsonDocumenttoBson()Returns the bson representation of the instance.java.lang.StringtoString()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.hcjf.utils.bson.BsonParcelable
fromBson, fromBson, fromBson, toBson, toBson, toBson, typeFromBson
-
-
-
-
Constructor Detail
-
ParameterizedQuery
public ParameterizedQuery(Query query)
-
-
Method Detail
-
getResourceName
public java.lang.String getResourceName()
Description copied from interface:QueryableReturn the resource name.- Specified by:
getResourceNamein interfaceQueryable- Returns:
- Resource name.
-
add
public final ParameterizedQuery add(java.lang.Object parameter)
Add new parameter into the next place.- Parameters:
parameter- Parameter to add.- Returns:
- Returns this instance.
-
set
public final ParameterizedQuery set(java.lang.Integer place, java.lang.Object parameter)
Add a new parameter in the specific place, if exists a parameter in the indicated place then this parameter is replaced.- Parameters:
place- Place to add the parameter.parameter- Parameter to add.- Returns:
- Returns this instance.
-
getParameters
public java.util.List<java.lang.Object> getParameters()
Returns a list of parameters into the queryable.- Returns:
- Unmodifiable list of parameters.
-
getQuery
public Query getQuery()
Returns the query associated to the instance.- Returns:
- Query instance.
-
evaluate
public final <O> java.util.Collection<O> evaluate(java.util.Collection<O> dataSource)
This method evaluate each object of the collection and sort filtered object to create a result add with the object filtered and sorted. If there are order fields added then the result implementation is aTreeSetimplementation else the result implementation is aLinkedHashSetimplementation in order to guarantee the data order from the source
-
evaluate
public final <O> java.util.Collection<O> evaluate(java.util.Collection<O> dataSource, Queryable.Consumer<O> consumer)This method evaluate each object of the collection and sort filtered object to create a result add with the object filtered and sorted. If there are order fields added then the result implementation is aTreeSetimplementation else the result implementation is aLinkedHashSetimplementation in order to guarantee the data order from the source
-
evaluate
public final <O> java.util.Collection<O> evaluate(Queryable.DataSource<O> dataSource)
This method evaluate each object of the collection and sort filtered object to create a result add with the object filtered and sorted. If there are order fields added then the result implementation is aTreeSetimplementation else the result implementation is aLinkedHashSetimplementation in order to guarantee the data order from the source
-
evaluate
public final <O> java.util.Collection<O> evaluate(Queryable.DataSource<O> dataSource, Queryable.Consumer<O> consumer)
This method evaluate each object of the collection and sort filtered object to create a result add with the object filtered and sorted. If there are order fields added then the result implementation is aTreeSetimplementation else the result implementation is aLinkedHashSetimplementation in order to guarantee the data order from the source
-
toBson
public org.hcjf.bson.BsonDocument toBson()
Description copied from interface:BsonParcelableReturns the bson representation of the instance.- Specified by:
toBsonin interfaceBsonParcelable- Returns:
- Bson representation.
-
populate
public <P extends BsonParcelable> P populate(org.hcjf.bson.BsonDocument document)
Description copied from interface:BsonParcelablePopulate the current instance of parcelable with all the information into the bson document.- Specified by:
populatein interfaceBsonParcelable- Type Parameters:
P- Expected parcelable type.- Parameters:
document- Bson document to populate the parcelable.- Returns:
- Return the same instance that was populated.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-