Skip to content

Commit

Permalink
Update documentation in the column condition
Browse files Browse the repository at this point in the history
Signed-off-by: Otavio Santana <otaviopolianasantana@gmail.com>
  • Loading branch information
otaviojava committed May 4, 2022
1 parent daf0c5c commit 93dc2ba
Showing 1 changed file with 120 additions and 0 deletions.
Expand Up @@ -20,6 +20,7 @@
import jakarta.nosql.Condition;
import jakarta.nosql.ServiceLoaderProvider;

import java.util.Objects;
import java.util.function.BiFunction;

/**
Expand Down Expand Up @@ -82,6 +83,21 @@ static ColumnCondition eq(Column column) {
return ServiceLoaderProvider.get(ColumnConditionProvider.class).apply(column, Condition.EQUALS);
}

/**
* an alias method to {@link ColumnCondition#eq(Column)} where it will create a {@link Column}
* instance first and then apply te condition.
* @param name the name of the column
* @param value the column information
* @return a {@link ColumnCondition} with {@link Condition#EQUALS}
* @throws NullPointerException when either name or value is null
*/
static ColumnCondition eq(String name, Object value) {
Objects.requireNonNull(name, "name is required");
Objects.requireNonNull(value, "value is required");
return ServiceLoaderProvider.get(ColumnConditionProvider.class)
.apply(Column.of(name, value), Condition.EQUALS);
}

/**
* Creates a {@link ColumnCondition} that has a {@link Condition#GREATER_THAN}, it means a select will scanning to a
* column family that has the same name and the value greater than informed in this column.
Expand All @@ -94,6 +110,20 @@ static ColumnCondition gt(Column column) {
return ServiceLoaderProvider.get(ColumnConditionProvider.class).apply(column, Condition.GREATER_THAN);
}

/**
* an alias method to {@link ColumnCondition#gt(Column)} where it will create a {@link Column}
* instance first and then apply te condition.
* @param name the name of the column
* @param value the column information
* @return a {@link ColumnCondition} with {@link Condition#GREATER_THAN}
* @throws NullPointerException when either name or value is null
*/
static ColumnCondition gt(String name, Object value) {
Objects.requireNonNull(name, "name is required");
Objects.requireNonNull(value, "value is required");
return ServiceLoaderProvider.get(ColumnConditionProvider.class)
.apply(Column.of(name, value), Condition.GREATER_THAN);
}
/**
* Creates a {@link ColumnCondition} that has a {@link Condition#GREATER_EQUALS_THAN},
* it means a select will scanning to a column family that has the same name and the value
Expand All @@ -107,6 +137,21 @@ static ColumnCondition gte(Column column) {
return ServiceLoaderProvider.get(ColumnConditionProvider.class).apply(column, Condition.GREATER_EQUALS_THAN);
}

/**
* an alias method to {@link ColumnCondition#gte(Column)} where it will create a {@link Column}
* instance first and then apply te condition.
* @param name the name of the column
* @param value the column information
* @return a {@link ColumnCondition} with {@link Condition#GREATER_EQUALS_THAN}
* @throws NullPointerException when either name or value is null
*/
static ColumnCondition gte(String name, Object value) {
Objects.requireNonNull(name, "name is required");
Objects.requireNonNull(value, "value is required");
return ServiceLoaderProvider.get(ColumnConditionProvider.class)
.apply(Column.of(name, value), Condition.GREATER_EQUALS_THAN);
}

/**
* Creates a {@link ColumnCondition} that has a {@link Condition#LESSER_THAN}, it means a select will scanning to a
* column family that has the same name and the value lesser than informed in this column.
Expand All @@ -119,6 +164,21 @@ static ColumnCondition lt(Column column) {
return ServiceLoaderProvider.get(ColumnConditionProvider.class).apply(column, Condition.LESSER_THAN);
}

/**
* an alias method to {@link ColumnCondition#lt(Column)} where it will create a {@link Column}
* instance first and then apply te condition.
* @param name the name of the column
* @param value the column information
* @return a {@link ColumnCondition} with {@link Condition#LESSER_THAN}
* @throws NullPointerException when either name or value is null
*/
static ColumnCondition lt(String name, Object value) {
Objects.requireNonNull(name, "name is required");
Objects.requireNonNull(value, "value is required");
return ServiceLoaderProvider.get(ColumnConditionProvider.class)
.apply(Column.of(name, value), Condition.LESSER_THAN);
}

/**
* Creates a {@link ColumnCondition} that has a {@link Condition#LESSER_EQUALS_THAN},
* it means a select will scanning to a column family that has the same name and the value
Expand All @@ -132,6 +192,21 @@ static ColumnCondition lte(Column column) {
return ServiceLoaderProvider.get(ColumnConditionProvider.class).apply(column, Condition.LESSER_EQUALS_THAN);
}

/**
* an alias method to {@link ColumnCondition#lte(Column)} where it will create a {@link Column}
* instance first and then apply te condition.
* @param name the name of the column
* @param value the column information
* @return a {@link ColumnCondition} with {@link Condition#LESSER_EQUALS_THAN}
* @throws NullPointerException when either name or value is null
*/
static ColumnCondition lte(String name, Object value) {
Objects.requireNonNull(name, "name is required");
Objects.requireNonNull(value, "value is required");
return ServiceLoaderProvider.get(ColumnConditionProvider.class)
.apply(Column.of(name, value), Condition.LESSER_EQUALS_THAN);
}

/**
* Creates a {@link ColumnCondition} that has a {@link Condition#IN}, it means a select will scanning to a
* column family that has the same name and the value is within informed in this column.
Expand All @@ -145,6 +220,21 @@ static ColumnCondition in(Column column) {
return ServiceLoaderProvider.get(ColumnConditionProvider.class).in(column);
}

/**
* an alias method to {@link ColumnCondition#in(Column)} where it will create a {@link Column}
* instance first and then apply te condition.
* @param name the name of the column
* @param value the column information
* @return a {@link ColumnCondition} with {@link Condition#IN}
* @throws NullPointerException when either name or value is null
*/
static ColumnCondition in(String name, Object value) {
Objects.requireNonNull(name, "name is required");
Objects.requireNonNull(value, "value is required");
return ServiceLoaderProvider.get(ColumnConditionProvider.class)
.in(Column.of(name, value));
}

/**
* Creates a {@link ColumnCondition} that has a {@link Condition#LIKE}, it means a select will scanning to a
* column family that has the same name and the value is like than informed in this column.
Expand All @@ -157,6 +247,21 @@ static ColumnCondition like(Column column) {
return ServiceLoaderProvider.get(ColumnConditionProvider.class).apply(column, Condition.LIKE);
}

/**
* an alias method to {@link ColumnCondition#like(Column)} where it will create a {@link Column}
* instance first and then apply te condition.
* @param name the name of the column
* @param value the column information
* @return a {@link ColumnCondition} with {@link Condition#LIKE}
* @throws NullPointerException when either name or value is null
*/
static ColumnCondition like(String name, Object value) {
Objects.requireNonNull(name, "name is required");
Objects.requireNonNull(value, "value is required");
return ServiceLoaderProvider.get(ColumnConditionProvider.class)
.apply(Column.of(name, value), Condition.LIKE);
}

/**
* Creates a {@link ColumnCondition} that has a {@link Condition#BETWEEN},
* it means a select will scanning to a column family that is between two values informed
Expand All @@ -174,6 +279,21 @@ static ColumnCondition between(Column column) {
return ServiceLoaderProvider.get(ColumnConditionProvider.class).between(column);
}

/**
* an alias method to {@link ColumnCondition#between(Column)} (Column)} where it will create a {@link Column}
* instance first and then apply te condition.
* @param name the name of the column
* @param value the column information
* @return a {@link ColumnCondition} with {@link Condition#BETWEEN}
* @throws NullPointerException when either name or value is null
*/
static ColumnCondition between(String name, Object value) {
Objects.requireNonNull(name, "name is required");
Objects.requireNonNull(value, "value is required");
return ServiceLoaderProvider.get(ColumnConditionProvider.class)
.between(Column.of(name, value));
}


/**
* Returns a new {@link ColumnCondition} aggregating ,as ¨AND", all the conditions as just one condition.
Expand Down

0 comments on commit 93dc2ba

Please sign in to comment.