Skip to content

Commit

Permalink
try release icefrog
Browse files Browse the repository at this point in the history
  • Loading branch information
HbnKing committed Dec 27, 2023
1 parent 4434459 commit a734365
Show file tree
Hide file tree
Showing 32 changed files with 1,609 additions and 176 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
*/
package com.whaleal.mars.codecs.internal;

import com.whaleal.icefrog.core.lang.Precondition;
import com.whaleal.mars.util.Assert;
import org.bson.BsonType;
import org.bson.codecs.Codec;
import org.bson.codecs.configuration.CodecConfigurationException;
Expand All @@ -42,8 +42,8 @@ public class BsonTypeCodecMap {
private final Codec<?>[] codecs = new Codec[256];

public BsonTypeCodecMap(BsonTypeClassMap bsonTypeClassMap, CodecRegistry codecRegistry) {
this.bsonTypeClassMap = (BsonTypeClassMap) Precondition.notNull("bsonTypeClassMap", bsonTypeClassMap);
Precondition.notNull("codecRegistry", codecRegistry);
this.bsonTypeClassMap = (BsonTypeClassMap) Assert.notNull(bsonTypeClassMap,"bsonTypeClassMap");
Assert.notNull(codecRegistry,"codecRegistry");
Iterator var3 = bsonTypeClassMap.keys().iterator();

while (var3.hasNext()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,13 @@


import com.whaleal.icefrog.core.util.ClassUtil;
import com.whaleal.mars.util.Assert;

import java.lang.annotation.Annotation;
import java.lang.reflect.*;
import java.util.*;

import static com.whaleal.icefrog.core.lang.Precondition.notNull;

import static java.lang.String.format;
import static java.lang.reflect.Modifier.isProtected;
import static java.lang.reflect.Modifier.isPublic;
Expand Down Expand Up @@ -67,7 +68,7 @@ final class MarsBuilderHelper {
@SuppressWarnings("unchecked")
static <T> void configureClassModelBuilder(final EntityModelBuilder<T> entityModelBuilder, final Class<T> clazz) {
// 断言 非空 并封装 type
entityModelBuilder.type(notNull("clazz", clazz));
entityModelBuilder.type(Assert.notNull( clazz));

// 类对象上的 注解保存
List<Annotation> annotations = new ArrayList<Annotation>();
Expand Down Expand Up @@ -208,8 +209,8 @@ private static <T, S> PropertyMetadata<T> getOrCreateMethodPropertyMetadata(fina
}

private static boolean isAssignableClass(final Class<?> propertyTypeClass, final Class<?> typeDataClass) {
notNull("propertyTypeClass", propertyTypeClass);
notNull("typeDataClass", typeDataClass);
Assert.notNull(propertyTypeClass);
Assert.notNull( typeDataClass);
return propertyTypeClass.isAssignableFrom(typeDataClass) || typeDataClass.isAssignableFrom(propertyTypeClass);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
package com.whaleal.mars.codecs.pojo.annotations;


import com.whaleal.icefrog.core.util.StrUtil;


import java.lang.annotation.*;

Expand All @@ -51,7 +51,7 @@
* 表名 标记 用于对象和实体之间的差异
* @return tableName
*/
String value() default StrUtil.EMPTY;
String value() default "";


}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
import com.whaleal.mars.core.aggregation.codecs.stages.*;
import com.whaleal.mars.core.aggregation.expressions.impls.Expression;
import com.whaleal.mars.core.aggregation.stages.*;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;



import org.bson.codecs.Codec;
import org.bson.codecs.configuration.CodecProvider;
import org.bson.codecs.configuration.CodecRegistry;
Expand All @@ -20,7 +22,7 @@ public class AggregationCodecProvider implements CodecProvider {
private final MongoMappingContext mapper;
private Map<Class, StageCodec > codecs;

@SuppressFBWarnings("EI_EXPOSE_REP2")
@SuppressWarnings("EI_EXPOSE_REP2")
public AggregationCodecProvider( MongoMappingContext mapper) {
this.mapper = mapper;
expressionCodec = new ExpressionCodec(mapper);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.whaleal.mars.core.aggregation.stages;

import com.whaleal.icefrog.core.lang.Precondition;
import com.whaleal.mars.util.Assert;
import com.whaleal.mars.core.domain.Direction;
import com.whaleal.mars.core.domain.ISort;
import com.whaleal.mars.core.domain.SortType;
Expand Down Expand Up @@ -58,7 +58,7 @@ public static Sort sort() {
*/
public static Sort by( SortType... orders) {

Precondition.notNull(orders, "Orders must not be null!");
Assert.notNull(orders, "Orders must not be null!");

return new Sort(Arrays.asList(orders));
}
Expand All @@ -72,9 +72,9 @@ public static Sort by( SortType... orders) {
*/
public static Sort by( Direction direction, String... properties) {

Precondition.notNull(direction, "Direction must not be null!");
Precondition.notNull(properties, "Properties must not be null!");
Precondition.isTrue(properties.length > 0, "At least one property must be given!");
Assert.notNull(direction, "Direction must not be null!");
Assert.notNull(properties, "Properties must not be null!");
Assert.isTrue(properties.length > 0, "At least one property must be given!");

return Sort.by(Arrays.stream(properties)//
.map(it -> new SortType(it ,direction))//
Expand Down Expand Up @@ -108,7 +108,7 @@ private Sort( Direction direction, List<String> properties) {
*/
public static Sort by( String... properties) {

Precondition.notNull(properties, "Properties must not be null!");
Assert.notNull(properties, "Properties must not be null!");

return properties.length == 0 //
? Sort.unsorted() //
Expand All @@ -123,7 +123,7 @@ public static Sort by( String... properties) {
*/
public static Sort by( List< SortType > orders) {

Precondition.notNull(orders, "Orders must not be null!");
Assert.notNull(orders, "Orders must not be null!");

return orders.isEmpty() ? Sort.unsorted() : new Sort(orders);
}
Expand Down Expand Up @@ -216,7 +216,7 @@ public Sort meta(String field) {

@Override
public Sort and( ISort sort ) {
Precondition.notNull(sort, "Sort must not be null!");
Assert.notNull(sort, "Sort must not be null!");

ArrayList<SortType> these = new ArrayList<>(this.getSorts());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@


import com.mongodb.lang.Nullable;
import com.whaleal.icefrog.core.lang.Precondition;
import com.whaleal.mars.util.Assert;

/**
* Basic Java Bean implementation of {@link Pageable}.
Expand All @@ -27,7 +27,7 @@ protected PageRequest(int page, int size, ISort sort) {

super(page, size);

Precondition.notNull(sort, "Sort must not be null!");
Assert.notNull(sort, "Sort must not be null!");

this.sort = sort;
}
Expand Down
18 changes: 9 additions & 9 deletions mars-core/src/main/java/com/whaleal/mars/core/domain/Sort.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.whaleal.mars.core.domain;

import com.mongodb.lang.Nullable;
import com.whaleal.icefrog.core.lang.Precondition;
import com.whaleal.icefrog.core.util.StrUtil;
import com.whaleal.mars.util.Assert;
import com.whaleal.mars.util.StrUtil;
import org.bson.BsonWriter;

import java.util.ArrayList;
Expand Down Expand Up @@ -65,7 +65,7 @@ public static Sort sort() {
*/
public static Sort by(SortType... orders) {

Precondition.notNull(orders, "Orders must not be null!");
Assert.notNull(orders, "Orders must not be null!");

return new Sort(Arrays.asList(orders));
}
Expand All @@ -79,9 +79,9 @@ public static Sort by(SortType... orders) {
*/
public static Sort by(Direction direction, String... properties) {

Precondition.notNull(direction, "Direction must not be null!");
Precondition.notNull(properties, "Properties must not be null!");
Precondition.isTrue(properties.length > 0, "At least one property must be given!");
Assert.notNull(direction, "Direction must not be null!");
Assert.notNull(properties, "Properties must not be null!");
Assert.isTrue(properties.length > 0, "At least one property must be given!");

return Sort.by(Arrays.stream(properties)//
.map(it -> new SortType(it ,direction))//
Expand All @@ -95,7 +95,7 @@ public static Sort by(Direction direction, String... properties) {
*/
public static Sort by(String... properties) {

Precondition.notNull(properties, "Properties must not be null!");
Assert.notNull(properties, "Properties must not be null!");

return properties.length == 0 //
? Sort.unsorted() //
Expand All @@ -110,7 +110,7 @@ public static Sort by(String... properties) {
*/
public static Sort by(List<SortType> orders) {

Precondition.notNull(orders, "Orders must not be null!");
Assert.notNull(orders, "Orders must not be null!");

return orders.isEmpty() ? Sort.unsorted() : new Sort(orders);
}
Expand Down Expand Up @@ -169,7 +169,7 @@ public Sort meta( String field ) {

@Override
public Sort and( ISort sort ) {
Precondition.notNull(sort, "Sort must not be null!");
Assert.notNull(sort, "Sort must not be null!");

ArrayList<SortType> these = new ArrayList<>(this.getSorts());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@

import com.mongodb.client.gridfs.GridFSFindIterable;
import com.mongodb.client.gridfs.model.GridFSFile;
import com.whaleal.icefrog.core.util.ObjectUtil;

import com.whaleal.icefrog.core.util.ReUtil;
import com.whaleal.icefrog.core.util.StrUtil;

import com.whaleal.mars.core.query.Criteria;
import com.whaleal.mars.core.query.Query;
import com.whaleal.mars.util.ObjectUtil;
import com.whaleal.mars.util.StrUtil;
import org.bson.Document;
import org.bson.types.ObjectId;

Expand Down
18 changes: 9 additions & 9 deletions mars-core/src/main/java/com/whaleal/mars/core/index/Index.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@


import com.mongodb.lang.Nullable;
import com.whaleal.icefrog.core.lang.Precondition;
import com.whaleal.mars.util.Assert;
import com.whaleal.mars.session.option.IndexOptions;
import org.bson.Document;

Expand Down Expand Up @@ -63,33 +63,33 @@ public Index() {

public Index( String field, IndexDirection direction ) {

Precondition.notNull("field can't be null in Index", field);
Precondition.notNull("direction can't be null in Index", direction);
Assert.notNull(field,"field can't be null in Index") ;
Assert.notNull(direction,"direction can't be null in Index");
key.put(field, direction);
}

public Index( String field, IndexDirection direction, IndexOptions options ) {

Precondition.notNull("field can't be null in Index", field);
Precondition.notNull("direction can't be null in Index", direction);
Precondition.notNull("IndexOptions can't be null in Index", options);
Assert.notNull(field,"field can't be null in Index" );
Assert.notNull(direction,"direction can't be null in Index" );
Assert.notNull(options, "IndexOptions can't be null in Index" );
key.put(field, direction);
this.options = options;

}

public Index on( String field, IndexDirection direction ) {

Precondition.notNull("field can't be null in Index", field);
Precondition.notNull("direction can't be null in Index", direction);
Assert.notNull(field, "field can't be null in Index");
Assert.notNull(direction, "direction can't be null in Index");
key.put(field, direction);
return this;
}


public Index setOptions( IndexOptions options ) {

Precondition.notNull("IndexOptions can't be null", options);
Assert.notNull(options,"IndexOptions can't be null" );
this.options = options;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

import com.mongodb.client.model.Collation;
import com.mongodb.client.model.changestream.FullDocument;
import com.whaleal.icefrog.core.lang.Precondition;
import com.whaleal.mars.util.Assert;
import com.whaleal.icefrog.core.util.ObjectUtil;
import com.whaleal.mars.core.aggregation.AggregationPipeline;
import org.bson.BsonTimestamp;
Expand Down Expand Up @@ -283,7 +283,7 @@ private ChangeStreamOptionsBuilder() {
*/
public ChangeStreamOptionsBuilder collation(Collation collation) {

Precondition.notNull(collation, "Collation must not be null nor empty!");
Assert.notNull(collation, "Collation must not be null nor empty!");

this.collation = collation;
return this;
Expand All @@ -298,7 +298,7 @@ public ChangeStreamOptionsBuilder collation(Collation collation) {
*/
public ChangeStreamOptionsBuilder filter( AggregationPipeline filter) {

Precondition.notNull(filter, "Filter must not be null!");
Assert.notNull(filter, "Filter must not be null!");

this.filter = filter;
return this;
Expand All @@ -312,7 +312,7 @@ public ChangeStreamOptionsBuilder filter( AggregationPipeline filter) {
*/
public ChangeStreamOptionsBuilder filter(Document... filter) {

Precondition.noNullElements(filter, "Filter must not contain null values");
Assert.noNullElements(filter, "Filter must not contain null values");

this.filter = Arrays.asList(filter);
return this;
Expand All @@ -327,7 +327,7 @@ public ChangeStreamOptionsBuilder filter(Document... filter) {
*/
public ChangeStreamOptionsBuilder resumeToken(BsonValue resumeToken) {

Precondition.notNull(resumeToken, "ResumeToken must not be null!");
Assert.notNull(resumeToken, "ResumeToken must not be null!");

this.resumeToken = resumeToken;

Expand Down Expand Up @@ -356,7 +356,7 @@ public ChangeStreamOptionsBuilder returnFullDocumentOnUpdate() {
*/
public ChangeStreamOptionsBuilder fullDocumentLookup(FullDocument lookup) {

Precondition.notNull(lookup, "Lookup must not be null!");
Assert.notNull(lookup, "Lookup must not be null!");

this.fullDocumentLookup = lookup;
return this;
Expand All @@ -370,7 +370,7 @@ public ChangeStreamOptionsBuilder fullDocumentLookup(FullDocument lookup) {
*/
public ChangeStreamOptionsBuilder resumeAt(Instant resumeTimestamp) {

Precondition.notNull(resumeTimestamp, "ResumeTimestamp must not be null!");
Assert.notNull(resumeTimestamp, "ResumeTimestamp must not be null!");

this.resumeTimestamp = resumeTimestamp;
return this;
Expand All @@ -384,7 +384,7 @@ public ChangeStreamOptionsBuilder resumeAt(Instant resumeTimestamp) {
*/
public ChangeStreamOptionsBuilder resumeAt(BsonTimestamp resumeTimestamp) {

Precondition.notNull(resumeTimestamp, "ResumeTimestamp must not be null!");
Assert.notNull(resumeTimestamp, "ResumeTimestamp must not be null!");

this.resumeTimestamp = resumeTimestamp;
return this;
Expand Down
Loading

0 comments on commit a734365

Please sign in to comment.