Skip to content

Commit

Permalink
2.1.7
Browse files Browse the repository at this point in the history
  • Loading branch information
haiyangl committed Dec 17, 2024
1 parent 7cdfe71 commit 06ad636
Show file tree
Hide file tree
Showing 30 changed files with 330 additions and 369 deletions.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.1.7

* Improvements

## 2.1.6

* Improvements
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# abacus-query

[![Maven Central](https://img.shields.io/maven-central/v/com.landawn/abacus-query.svg)](https://maven-badges.herokuapp.com/maven-central/com.landawn/abacus-query/)
[![Javadocs](https://img.shields.io/badge/javadoc-2.1.6-brightgreen.svg)](https://www.javadoc.io/doc/com.landawn/abacus-query/2.1.6/index.html)
[![Javadocs](https://img.shields.io/badge/javadoc-2.1.7-brightgreen.svg)](https://www.javadoc.io/doc/com.landawn/abacus-query/2.1.7/index.html)

## Download/Installation & [Changes](https://github.com/landawn/abacus-query/blob/master/CHANGES.md):

Expand All @@ -10,7 +10,7 @@
* Gradle:
```gradle
// JDK 1.8 or above:
compile 'com.landawn:abacus-query:2.1.6'
compile 'com.landawn:abacus-query:2.1.7'
```


Expand Down
2 changes: 1 addition & 1 deletion maven/0.0.1-SNAPSHOT/abacus-query-0.0.1-SNAPSHOT.pom
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
<dependency>
<groupId>com.landawn</groupId>
<artifactId>abacus-common</artifactId>
<version>5.6.5</version>
<version>5.6.8</version>
</dependency>
</dependencies>

Expand Down
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>com.landawn</groupId>
<artifactId>abacus-query</artifactId>
<version>2.1.7</version>
<version>2.1.8</version>
<packaging>jar</packaging>

<name>abacus-query</name>
Expand All @@ -25,14 +25,14 @@
<dependency>
<groupId>com.landawn</groupId>
<artifactId>abacus-common</artifactId>
<version>5.6.5</version>
<version>5.6.8</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.34</version>
<version>1.18.36</version>
<scope>provided</scope>
</dependency>

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/landawn/abacus/condition/Between.java
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public void clearParameters() {
@SuppressWarnings("unchecked")
@Override
public <T extends Condition> T copy() {
final Between copy = (Between) super.copy();
final Between copy = super.copy();

if (minValue instanceof Condition) {
copy.minValue = ((Condition) minValue).copy();
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/landawn/abacus/condition/Binary.java
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public void clearParameters() {
@SuppressWarnings("unchecked")
@Override
public <T extends Condition> T copy() {
final Binary copy = (Binary) super.copy();
final Binary copy = super.copy();

if (propValue instanceof Condition) {
copy.propValue = ((Condition) propValue).copy();
Expand Down
7 changes: 3 additions & 4 deletions src/main/java/com/landawn/abacus/condition/Cell.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,9 @@ public void setCondition(final Condition condition) {
*
* @return
*/
@SuppressWarnings("unchecked")
@Override
public List<Object> getParameters() {
return (condition == null) ? N.<Object> emptyList() : condition.getParameters();
return (condition == null) ? N.emptyList() : condition.getParameters();
}

/**
Expand All @@ -94,7 +93,7 @@ public void clearParameters() {
@SuppressWarnings("unchecked")
@Override
public <T extends Condition> T copy() {
final Cell copy = (Cell) super.copy();
final Cell copy = super.copy();

if (condition != null) {
copy.condition = condition.copy();
Expand All @@ -121,7 +120,7 @@ public String toString(final NamingPolicy namingPolicy) {
@Override
public int hashCode() {
int h = 17;
h = (h * 31) + operator.hashCode();
h = (h * 31) + ((operator == null) ? 0 : operator.hashCode());
return (h * 31) + ((condition == null) ? 0 : condition.hashCode());
}

Expand Down
73 changes: 36 additions & 37 deletions src/main/java/com/landawn/abacus/condition/ConditionFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -188,23 +188,22 @@ public static Or eqOr(final String propName, final Collection<?> propValues) {
public static Or eqOr(final Map<String, ?> props) {
N.checkArgNotEmpty(props, "props");

final Collection<String> selectPropNames = props.keySet();
final Iterator<String> iter = selectPropNames.iterator();

if (selectPropNames.size() == 1) {
final String propName = iter.next();
return or(eq(propName, props.get(propName)));
} else if (selectPropNames.size() == 2) {
final String propName1 = iter.next();
final String propName2 = iter.next();
return eq(propName1, props.get(propName1)).or(eq(propName2, props.get(propName2)));
final Iterator<? extends Map.Entry<String, ?>> propIter = props.entrySet().iterator();

if (props.size() == 1) {
final Map.Entry<String, ?> prop = propIter.next();
return or(eq(prop.getKey(), prop.getValue()));
} else if (props.size() == 2) {
final Map.Entry<String, ?> prop1 = propIter.next();
final Map.Entry<String, ?> prop2 = propIter.next();
return eq(prop1.getKey(), prop1.getValue()).or(eq(prop2.getKey(), prop2.getValue()));
} else {
final Condition[] conds = new Condition[selectPropNames.size()];
String propName = null;
final Condition[] conds = new Condition[props.size()];
Map.Entry<String, ?> prop = null;

for (int i = 0, size = selectPropNames.size(); i < size; i++) {
propName = iter.next();
conds[i] = CF.eq(propName, props.get(propName));
for (int i = 0, size = props.size(); i < size; i++) {
prop = propIter.next();
conds[i] = CF.eq(prop.getKey(), prop.getValue());
}

return or(conds);
Expand Down Expand Up @@ -289,27 +288,27 @@ public static Or eqOr(final String propName1, final Object propValue1, final Str
public static And eqAnd(final Map<String, ?> props) {
N.checkArgNotEmpty(props, "props");

final Collection<String> selectPropNames = props.keySet();
final Iterator<String> iter = selectPropNames.iterator();
final Iterator<? extends Map.Entry<String, ?>> propIter = props.entrySet().iterator();

if (selectPropNames.size() == 1) {
final String propName = iter.next();
return and(eq(propName, props.get(propName)));
} else if (selectPropNames.size() == 2) {
final String propName1 = iter.next();
final String propName2 = iter.next();
return eq(propName1, props.get(propName1)).and(eq(propName2, props.get(propName2)));
if (props.size() == 1) {
final Map.Entry<String, ?> prop = propIter.next();
return and(eq(prop.getKey(), prop.getValue()));
} else if (props.size() == 2) {
final Map.Entry<String, ?> prop1 = propIter.next();
final Map.Entry<String, ?> prop2 = propIter.next();
return eq(prop1.getKey(), prop1.getValue()).and(eq(prop2.getKey(), prop2.getValue()));
} else {
final Condition[] conds = new Condition[selectPropNames.size()];
String propName = null;
final Condition[] conds = new Condition[props.size()];
Map.Entry<String, ?> prop = null;

for (int i = 0, size = selectPropNames.size(); i < size; i++) {
propName = iter.next();
conds[i] = CF.eq(propName, props.get(propName));
for (int i = 0, size = props.size(); i < size; i++) {
prop = propIter.next();
conds[i] = CF.eq(prop.getKey(), prop.getValue());
}

return and(conds);
}

}

/**
Expand Down Expand Up @@ -1188,7 +1187,7 @@ public static GroupBy groupBy(final String propName, final SortDirection directi
* @return
*/
public static GroupBy groupBy(final String propNameA, final SortDirection directionA, final String propNameB, final SortDirection directionB) {
return groupBy(N.<String, SortDirection> asLinkedHashMap(propNameA, directionA, propNameB, directionB));
return groupBy(N.asLinkedHashMap(propNameA, directionA, propNameB, directionB));
}

/**
Expand All @@ -1203,7 +1202,7 @@ public static GroupBy groupBy(final String propNameA, final SortDirection direct
*/
public static GroupBy groupBy(final String propNameA, final SortDirection directionA, final String propNameB, final SortDirection directionB,
final String propNameC, final SortDirection directionC) {
return groupBy(N.<String, SortDirection> asLinkedHashMap(propNameA, directionA, propNameB, directionB, propNameC, directionC));
return groupBy(N.asLinkedHashMap(propNameA, directionA, propNameB, directionB, propNameC, directionC));
}

/**
Expand Down Expand Up @@ -1328,7 +1327,7 @@ public static OrderBy orderBy(final String propName, final SortDirection directi
* @return
*/
public static OrderBy orderBy(final String propNameA, final SortDirection directionA, final String propNameB, final SortDirection directionB) {
return orderBy(N.<String, SortDirection> asLinkedHashMap(propNameA, directionA, propNameB, directionB));
return orderBy(N.asLinkedHashMap(propNameA, directionA, propNameB, directionB));
}

/**
Expand All @@ -1343,7 +1342,7 @@ public static OrderBy orderBy(final String propNameA, final SortDirection direct
*/
public static OrderBy orderBy(final String propNameA, final SortDirection directionA, final String propNameB, final SortDirection directionB,
final String propNameC, final SortDirection directionC) {
return orderBy(N.<String, SortDirection> asLinkedHashMap(propNameA, directionA, propNameB, directionB, propNameC, directionC));
return orderBy(N.asLinkedHashMap(propNameA, directionA, propNameB, directionB, propNameC, directionC));
}

/**
Expand Down Expand Up @@ -2025,7 +2024,7 @@ public static Criteria groupBy(final Condition condition) {
* @return
*/
@SafeVarargs
public static final Criteria groupBy(final String... propNames) {
public static Criteria groupBy(final String... propNames) {
return CF.criteria().groupBy(propNames);
}

Expand Down Expand Up @@ -2090,7 +2089,7 @@ public static Criteria having(final String condition) {
* @param propNames
* @return
*/
public static final Criteria orderByAsc(final String... propNames) {
public static Criteria orderByAsc(final String... propNames) {
return CF.criteria().orderByAsc(propNames);
}

Expand All @@ -2108,7 +2107,7 @@ public static Criteria orderByAsc(final Collection<String> propNames) {
* @param propNames
* @return
*/
public static final Criteria orderByDesc(final String... propNames) {
public static Criteria orderByDesc(final String... propNames) {
return CF.criteria().orderByDesc(propNames);
}

Expand Down Expand Up @@ -2136,7 +2135,7 @@ public static Criteria orderBy(final Condition condition) {
* @return
*/
@SafeVarargs
public static final Criteria orderBy(final String... propNames) {
public static Criteria orderBy(final String... propNames) {
return CF.criteria().orderBy(propNames);
}

Expand Down
7 changes: 3 additions & 4 deletions src/main/java/com/landawn/abacus/condition/Criteria.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
/**
* At present, Supports
* {@code Where, OrderBy, GroupBy, Having, Join, Limit, ForUpdate, Union, UnionAll, Intersect, Except} clause. Each
* {@code clause} is independent. A {@code clause} should not be included in another {@code clause}. If there more than
* {@code clause} is independent. A {@code clause} should not be included in another {@code clause}. If there are more than
* one {@code clause}, they should be composed in one {@code Criteria} condition.
*
*/
Expand Down Expand Up @@ -113,7 +113,6 @@ public Cell getHaving() {
*
* @return
*/
@SuppressWarnings("unchecked")
public List<Cell> getAggregation() {
List<Cell> result = null;

Expand Down Expand Up @@ -233,7 +232,6 @@ public void clear() {
*
* @return
*/
@SuppressWarnings("unchecked")
@Override
public List<Object> getParameters() {
if (conditionList.size() > 0) {
Expand Down Expand Up @@ -758,7 +756,7 @@ public Criteria minus(final SubQuery subQuery) {
@Override
@SuppressWarnings("unchecked")
public <T extends Condition> T copy() {
final Criteria result = (Criteria) super.copy();
final Criteria result = super.copy();

result.conditionList = new ArrayList<>();

Expand All @@ -774,6 +772,7 @@ public <T extends Condition> T copy() {
* @param namingPolicy
* @return
*/
@SuppressWarnings("StringConcatenationInLoop")
@Override
public String toString(final NamingPolicy namingPolicy) {
final String preselect = Strings.isEmpty(this.preselect) ? Strings.EMPTY_STRING : WD.SPACE + this.preselect; //NOSONAR
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/landawn/abacus/condition/CriteriaUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public static Set<Operator> getClauseOperators() {
* @return true, if is clause
*/
public static boolean isClause(final Operator operator) {
return (operator == null) ? false : clauseOperators.contains(operator);
return operator != null && clauseOperators.contains(operator);
}

/**
Expand Down Expand Up @@ -114,7 +114,7 @@ public static boolean isClause(final Condition condition) {
// } else {
// return isClause(condition.getOperator());
// }
return (condition == null) ? false : isClause(condition.getOperator());
return condition != null && isClause(condition.getOperator());
}

/**
Expand Down
7 changes: 3 additions & 4 deletions src/main/java/com/landawn/abacus/condition/Expression.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
*/
public class Expression extends AbstractCondition {

static final String NULL_STRING = "null".intern();
static final String NULL_STRING = "null";

static final char[] NULL_CHAR_ARRAY = NULL_STRING.toCharArray();

Expand All @@ -87,7 +87,7 @@ public class Expression extends AbstractCondition {

private static final String LEFT_SHIFT = "<<";

private static final String RIGTH_SHIFT = ">>";
private static final String RIGHT_SHIFT = ">>";

private static final String NULL = "NULL";

Expand Down Expand Up @@ -421,7 +421,7 @@ public static String lShift(final Object... objects) {
*/
@SafeVarargs
public static String rShift(final Object... objects) {
return link(RIGTH_SHIFT, objects);
return link(RIGHT_SHIFT, objects);
}

/**
Expand Down Expand Up @@ -919,7 +919,6 @@ public static String upper(final String st) {
*
* @return
*/
@SuppressWarnings("unchecked")
@Override
public List<Object> getParameters() {
return N.emptyList();
Expand Down
15 changes: 6 additions & 9 deletions src/main/java/com/landawn/abacus/condition/In.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ public String getPropName() {
*
* @return
*/
@SuppressWarnings("unchecked")
public List<?> getValues() { //NOSONAR
return values;
}
Expand Down Expand Up @@ -114,7 +113,7 @@ public void clearParameters() {
@SuppressWarnings("unchecked")
@Override
public <T extends Condition> T copy() {
final In copy = (In) super.copy();
final In copy = super.copy();

copy.values = new ArrayList<>(values);

Expand All @@ -128,13 +127,11 @@ public <T extends Condition> T copy() {
*/
@Override
public String toString(final NamingPolicy namingPolicy) {
if (namingPolicy == NamingPolicy.NO_CHANGE) {
return propName + WD._SPACE + getOperator().toString()
+ Joiner.with(WD.COMMA_SPACE, WD.SPACE_PARENTHESES_L, WD.PARENTHESES_R).reuseCachedBuffer().appendAll(values).toString();
} else {
return namingPolicy.convert(propName) + WD._SPACE + getOperator().toString()
+ Joiner.with(WD.COMMA_SPACE, WD.SPACE_PARENTHESES_L, WD.PARENTHESES_R).reuseCachedBuffer().appendAll(values).toString();
}
//noinspection resource
return Joiner.with(WD.COMMA_SPACE, namingPolicy.convert(propName) + WD._SPACE + getOperator().toString() + WD.SPACE_PARENTHESES_L, WD.PARENTHESES_R)
.reuseCachedBuffer()
.appendAll(values)
.toString();
}

/**
Expand Down
Loading

0 comments on commit 06ad636

Please sign in to comment.