mirror of
https://github.com/querydsl/querydsl.git
synced 2026-06-30 21:08:30 +08:00
replaced Assert in util package with mysema-commons-lang variant
This commit is contained in:
parent
0d9ad72b3b
commit
033a92ed3c
@ -10,9 +10,9 @@ import java.util.List;
|
||||
|
||||
import org.codehaus.janino.ExpressionEvaluator;
|
||||
|
||||
import com.mysema.commons.lang.Assert;
|
||||
import com.mysema.query.grammar.JavaOps;
|
||||
import com.mysema.query.grammar.types.Expr;
|
||||
import com.mysema.util.Assert;
|
||||
|
||||
/**
|
||||
* JaninoEvaluator is a Janino compiler based Evaluator implementation
|
||||
|
||||
@ -21,6 +21,7 @@ import org.codehaus.janino.Scanner.ScanException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.mysema.commons.lang.Assert;
|
||||
import com.mysema.query.grammar.JavaOps;
|
||||
import com.mysema.query.grammar.Ops;
|
||||
import com.mysema.query.grammar.Ops.Op;
|
||||
@ -29,7 +30,6 @@ import com.mysema.query.grammar.types.Path;
|
||||
import com.mysema.query.grammar.types.Expr.EConstant;
|
||||
import com.mysema.query.grammar.types.PathMetadata.PathType;
|
||||
import com.mysema.query.serialization.BaseSerializer;
|
||||
import com.mysema.util.Assert;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@ -18,6 +18,7 @@ import org.codehaus.janino.Scanner.ScanException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.mysema.commons.lang.Assert;
|
||||
import com.mysema.query.collections.IteratorSource;
|
||||
import com.mysema.query.collections.eval.Evaluator;
|
||||
import com.mysema.query.collections.eval.FilteredJavaSerializer;
|
||||
@ -27,7 +28,6 @@ import com.mysema.query.collections.utils.QueryIteratorUtils;
|
||||
import com.mysema.query.grammar.JavaOps;
|
||||
import com.mysema.query.grammar.types.Expr;
|
||||
import com.mysema.query.grammar.types.Expr.EBoolean;
|
||||
import com.mysema.util.Assert;
|
||||
|
||||
/**
|
||||
* FilteringMultiIterator extends the MultiIterator to provide a filtered view
|
||||
|
||||
@ -8,6 +8,7 @@ package com.mysema.query.collections.support;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.mysema.commons.lang.Assert;
|
||||
import com.mysema.query.DefaultQueryMetadata;
|
||||
import com.mysema.query.ProjectableAdapter;
|
||||
import com.mysema.query.QueryMetadata;
|
||||
@ -17,7 +18,6 @@ import com.mysema.query.collections.QueryIndexSupport;
|
||||
import com.mysema.query.grammar.JavaOps;
|
||||
import com.mysema.query.grammar.OrderSpecifier;
|
||||
import com.mysema.query.grammar.types.Expr;
|
||||
import com.mysema.util.Assert;
|
||||
|
||||
/**
|
||||
* CustomQueryable a ColQuery like interface for querying on custom IteratorSource sources
|
||||
|
||||
@ -7,6 +7,7 @@ package com.mysema.query.collections.support;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.mysema.commons.lang.Assert;
|
||||
import com.mysema.query.collections.eval.Evaluator;
|
||||
import com.mysema.query.collections.support.DefaultIndexSupport.IndexedPath;
|
||||
import com.mysema.query.collections.utils.EvaluatorUtils;
|
||||
@ -17,7 +18,6 @@ import com.mysema.query.grammar.types.Operation;
|
||||
import com.mysema.query.grammar.types.Path;
|
||||
import com.mysema.query.grammar.types.Expr.EBoolean;
|
||||
import com.mysema.query.grammar.types.Expr.EConstant;
|
||||
import com.mysema.util.Assert;
|
||||
|
||||
/**
|
||||
* IndexCreationTask provides
|
||||
|
||||
@ -8,12 +8,12 @@ package com.mysema.query.collections.support;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import com.mysema.commons.lang.Assert;
|
||||
import com.mysema.query.collections.IteratorSource;
|
||||
import com.mysema.query.collections.QueryIndexSupport;
|
||||
import com.mysema.query.grammar.JavaOps;
|
||||
import com.mysema.query.grammar.types.Expr;
|
||||
import com.mysema.query.grammar.types.Expr.EBoolean;
|
||||
import com.mysema.util.Assert;
|
||||
|
||||
/**
|
||||
* SimpleIndexSupport is a minimal QueryIndexSupport implementation
|
||||
|
||||
@ -9,10 +9,10 @@ import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
import com.mysema.commons.lang.Assert;
|
||||
import com.mysema.query.collections.IteratorSource;
|
||||
import com.mysema.query.collections.QueryIndexSupport;
|
||||
import com.mysema.query.grammar.types.Expr;
|
||||
import com.mysema.util.Assert;
|
||||
|
||||
/**
|
||||
* SimpleIteratorSource is the default implementation of the IndexSupport interface
|
||||
|
||||
@ -7,11 +7,11 @@ package com.mysema.query.collections.utils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.mysema.commons.lang.Assert;
|
||||
import com.mysema.query.collections.eval.Evaluator;
|
||||
import com.mysema.query.collections.eval.JaninoEvaluator;
|
||||
import com.mysema.query.grammar.JavaOps;
|
||||
import com.mysema.query.grammar.types.Expr;
|
||||
import com.mysema.util.Assert;
|
||||
|
||||
/**
|
||||
* EvaluatorUtils provides factory methods for Evaluator creation
|
||||
|
||||
@ -28,6 +28,11 @@
|
||||
<artifactId>commons-lang</artifactId>
|
||||
<version>2.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.mysema.commons</groupId>
|
||||
<artifactId>mysema-commons-lang</artifactId>
|
||||
<version>0.1.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- alias dependencies -->
|
||||
|
||||
|
||||
@ -7,8 +7,8 @@ package com.mysema.query;
|
||||
|
||||
import org.apache.commons.lang.builder.EqualsBuilder;
|
||||
|
||||
import com.mysema.commons.lang.Assert;
|
||||
import com.mysema.query.grammar.types.Expr;
|
||||
import com.mysema.util.Assert;
|
||||
|
||||
/**
|
||||
* JoinExpression is a join element in a Query instance
|
||||
|
||||
@ -8,8 +8,8 @@ package com.mysema.query;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import com.mysema.commons.lang.Assert;
|
||||
import com.mysema.query.grammar.types.Expr;
|
||||
import com.mysema.util.Assert;
|
||||
|
||||
/**
|
||||
* ProjectableAdapter is an adapter implementation for the Projectable
|
||||
|
||||
@ -5,10 +5,10 @@
|
||||
*/
|
||||
package com.mysema.query;
|
||||
|
||||
import com.mysema.commons.lang.Assert;
|
||||
import com.mysema.query.grammar.OrderSpecifier;
|
||||
import com.mysema.query.grammar.types.Expr;
|
||||
import com.mysema.query.grammar.types.Expr.EBoolean;
|
||||
import com.mysema.util.Assert;
|
||||
|
||||
/**
|
||||
* QueryAdapter is an adapter implementation for Query instace wrapping
|
||||
|
||||
@ -7,8 +7,14 @@ package com.mysema.query.grammar;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import com.mysema.commons.lang.Assert;
|
||||
import com.mysema.query.grammar.Ops.OpNumberAgg;
|
||||
import com.mysema.query.grammar.types.*;
|
||||
import com.mysema.query.grammar.types.Alias;
|
||||
import com.mysema.query.grammar.types.CollectionType;
|
||||
import com.mysema.query.grammar.types.CountExpression;
|
||||
import com.mysema.query.grammar.types.Expr;
|
||||
import com.mysema.query.grammar.types.ExprFactory;
|
||||
import com.mysema.query.grammar.types.SimpleExprFactory;
|
||||
import com.mysema.query.grammar.types.Expr.EBoolean;
|
||||
import com.mysema.query.grammar.types.Expr.EComparable;
|
||||
import com.mysema.query.grammar.types.Expr.ENumber;
|
||||
@ -17,7 +23,6 @@ import com.mysema.query.grammar.types.Expr.EString;
|
||||
import com.mysema.query.grammar.types.Operation.OBoolean;
|
||||
import com.mysema.query.grammar.types.Path.PEntity;
|
||||
import com.mysema.query.grammar.types.Path.PEntityCollection;
|
||||
import com.mysema.util.Assert;
|
||||
|
||||
/**
|
||||
* Grammar provides the factory methods for the fluent grammar.
|
||||
|
||||
@ -5,8 +5,8 @@
|
||||
*/
|
||||
package com.mysema.query.grammar;
|
||||
|
||||
import com.mysema.commons.lang.Assert;
|
||||
import com.mysema.query.grammar.types.Expr;
|
||||
import com.mysema.util.Assert;
|
||||
|
||||
/**
|
||||
* OrderSpecifier represents an order by element in a Query instance
|
||||
|
||||
@ -8,6 +8,7 @@ package com.mysema.query.grammar.types;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.mysema.commons.lang.Assert;
|
||||
import com.mysema.query.grammar.Ops.Op;
|
||||
import com.mysema.query.grammar.types.Expr.EBoolean;
|
||||
import com.mysema.query.grammar.types.Expr.EComparable;
|
||||
@ -19,7 +20,6 @@ import com.mysema.query.grammar.types.Operation.OComparable;
|
||||
import com.mysema.query.grammar.types.Operation.ONumber;
|
||||
import com.mysema.query.grammar.types.Operation.OString;
|
||||
import com.mysema.query.grammar.types.Operation.OStringArray;
|
||||
import com.mysema.util.Assert;
|
||||
|
||||
/**
|
||||
* Factory provides factory methods for various needs
|
||||
|
||||
@ -3,7 +3,7 @@ package com.mysema.query.serialization;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.mysema.util.Assert;
|
||||
import com.mysema.commons.lang.Assert;
|
||||
|
||||
/**
|
||||
* PatternElement provides
|
||||
|
||||
@ -1,48 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2009 Mysema Ltd.
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
package com.mysema.util;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
/**
|
||||
* Assert provides
|
||||
*
|
||||
* @author tiwe
|
||||
* @version $Id$
|
||||
*/
|
||||
public class Assert {
|
||||
|
||||
/**
|
||||
* use notEmpty(String) instead
|
||||
*/
|
||||
public static String hasText(String text) {
|
||||
if (StringUtils.isBlank(text)) {
|
||||
throw new IllegalArgumentException("was blank");
|
||||
} else {
|
||||
return text;
|
||||
}
|
||||
}
|
||||
|
||||
public static <T> T notNull(T object) {
|
||||
return notNull(object, "was null");
|
||||
}
|
||||
|
||||
public static <T> T notNull(T object, String message) {
|
||||
if (object == null) throw new IllegalArgumentException(message);
|
||||
return object;
|
||||
}
|
||||
|
||||
public static String notEmpty(String text) {
|
||||
if (text == null || text.equals("")) throw new IllegalArgumentException("was empty");
|
||||
return text;
|
||||
}
|
||||
|
||||
public static <T> T[] notEmpty(T[] objects) {
|
||||
if(objects == null || objects.length == 0) throw new IllegalArgumentException("was empty");
|
||||
return objects;
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user