public final class DBFluteMatchers extends Object
修飾子とタイプ | メソッドと説明 |
---|---|
static <T extends org.dbflute.cbean.ConditionBean> |
argCB(Class<T> cbclass,
Matcher<T> matcher)
Allows creating custom argument matcher that evaluates ConditionBean.
|
static <T extends org.dbflute.cbean.ConditionBean> |
captor(Class<T> clazz)
Creates a method argument captor.
|
static <T extends org.dbflute.cbean.ConditionBean> |
cb(Class<T> cbclass,
Matcher<T> matcher)
Creates an argument matcher that evaluates ConditionBean.
|
static IsColumnExpressed |
equal(Matcher<?> matcher)
Creates a matcher that matches when the examined column has
EQUAL condition with value matched with the specified
matcher . |
static IsColumnExpressed |
equal(Object value)
A shortcut to
equal(equalTo(value)) . |
static IsColumnExpressed |
greaterEqual(Matcher<?> matcher)
Creates a matcher that matches when the examined column has
GREATER_EQUAL condition with value matched with the specified
matcher . |
static IsColumnExpressed |
greaterEqual(Object value)
A shortcut to
greaterEqual(equalTo(value)) . |
static IsColumnExpressed |
greaterThan(Matcher<?> matcher)
Creates a matcher that matches when the examined column has
GREATER_THAN condition with value matched with the specified
matcher . |
static IsColumnExpressed |
greaterThan(Object value)
A shortcut to
greaterThan(equalTo(value)) . |
static <T extends org.dbflute.cbean.ConditionBean> |
hasCondition(String column,
Matcher<?> matcher)
Creates a matcher that gets a
ConditionValue of specified column
and pass it to subsequent matcher. |
static <T extends org.dbflute.cbean.ConditionBean> |
hasRelation(String table,
HasCondition<T> hasCondition)
Creates a matcher that gets a
ConditionQuery of specified table
and pass it to subsequent matcher. |
static <T extends org.dbflute.cbean.ConditionBean> |
hasRelationCondition(String table,
String column,
Matcher<?> matcher)
A shortcut to
hasRelation("table", hasCondition("column", ...)) . |
static IsColumnExpressed |
in(Matcher<?> matcher)
Creates a matcher that matches when the examined column has
IN condition with value matched with the specified
matcher . |
static IsColumnExpressed |
in(Object... items)
A shortcut to
in(hasItems(items)) . |
static IsColumnIsNotNull |
isNotNull()
Creates a matcher that matches when the examined column has
IS_NOT_NULL condition.
|
static IsColumnIsNull |
isNull()
Creates a matcher that matches when the examined column has
IS_NULL condition.
|
static IsColumnExpressed |
lessEqual(Matcher<?> matcher)
Creates a matcher that matches when the examined column has
LESS_EQUAL condition with value matched with the specified
matcher . |
static IsColumnExpressed |
lessEqual(Object value)
A shortcut to
lessEqual(equalTo(value)) . |
static IsColumnExpressed |
lessThan(Matcher<?> matcher)
Creates a matcher that matches when the examined column has
GREATER_THAN condition with value matched with the specified
matcher . |
static IsColumnExpressed |
lessThan(Object value)
A shortcut to
lessThan(equalTo(value)) . |
static IsColumnExpressed |
like(Matcher<?> matcher)
Creates a matcher that matches when the examined column has
LIKE condition with value matched with the specified
matcher . |
static IsColumnExpressed |
like(Object value)
A shortcut to
like(equalTo(value)) . |
static IsColumnExpressed |
likeContain(String value)
A shortcut to
like(equalTo("%" + value + "%")) . |
static IsColumnExpressed |
likePrefix(String value)
A shortcut to
like(equalTo(value + "%")) . |
static IsColumnExpressed |
likeSuffix(String value)
A shortcut to
like(equalTo("%" + value)) . |
static IsColumnExpressed |
notEqual(Matcher<?> matcher)
Creates a matcher that matches when the examined column has
NOT_EQUAL condition with value matched with the specified
matcher . |
static IsColumnExpressed |
notEqual(Object value)
A shortcut to
notEqual(equalTo(value)) . |
static IsColumnExpressed |
notIn(Matcher<?> matcher)
Creates a matcher that matches when the examined column has
NOT_IN condition with value matched with the specified
matcher . |
static IsColumnExpressed |
notIn(Object... items)
A shortcut to
notIn(contains(items)) . |
static IsColumnExpressed |
notLike(Matcher<?> matcher)
Creates a matcher that matches when the examined column has
NOT_LIKE condition with value matched with the specified
matcher . |
static IsColumnExpressed |
notLike(Object value)
A shortcut to
notLike(equalTo(value)) . |
static IsColumnExpressed |
notLikeContain(String value)
A shortcut to
notLike(equalTo("%" + value + "%")) . |
static IsColumnExpressed |
notLikePrefix(String value)
A shortcut to
notLike(equalTo(value + "%")) . |
static IsColumnExpressed |
notLikeSuffix(String value)
A shortcut to
notLike(equalTo("%" + value)) . |
static <T extends org.dbflute.cbean.ConditionBean> |
shouldSelect(String columnName)
Creates a matcher that matches if the query selects the column.
|
public static <T extends org.dbflute.cbean.ConditionBean> BehaviorArgumentCaptor<T> captor(Class<T> clazz)
T
- the type of clazz
clazz
- the class of ConditionBean implementationpublic static <T extends org.dbflute.cbean.ConditionBean> org.dbflute.bhv.readable.CBCall<T> argCB(Class<T> cbclass, Matcher<T> matcher)
T
- the type of clazz
cbclass
- class of ConditionBean implementationmatcher
- the matcher to apply to ConditionBeannull
Matchers.argThat(Matcher)
public static <T extends org.dbflute.cbean.ConditionBean> BehaviorArgumentMatcher<T> cb(Class<T> cbclass, Matcher<T> matcher)
T
- the type of clazz
cbclass
- class of ConditionBean implementationmatcher
- the matcher to apply to ConditionBeanpublic static <T extends org.dbflute.cbean.ConditionBean> HasCondition<T> hasCondition(String column, Matcher<?> matcher)
ConditionValue
of specified column
and pass it to subsequent matcher.T
- the type of clazz
column
- the name of column which evaluatesmatcher
- the matcher that evaluates ConditionValue
public static <T extends org.dbflute.cbean.ConditionBean> HasRelation<T> hasRelation(String table, HasCondition<T> hasCondition)
ConditionQuery
of specified table
and pass it to subsequent matcher.T
- the type of clazz
table
- the name of relating table which evaluateshasCondition
- the matcher that evaluates ConditionQuery
public static <T extends org.dbflute.cbean.ConditionBean> HasRelation<T> hasRelationCondition(String table, String column, Matcher<?> matcher)
hasRelation("table", hasCondition("column", ...))
.T
- the type of clazz
table
- the name of relating tablecolumn
- the name of column which evaluatesmatcher
- the matcher that evaluates ConditionValue
public static IsColumnExpressed equal(Matcher<?> matcher)
matcher
.
Example:
cb.query.setMemberName_Equal("John Doe");
assertThat(cb, hasCondition("memberName", equal(startsWith("J"))));
matcher
- a matcher that evaluates the condition valuepublic static IsColumnExpressed equal(Object value)
equal(equalTo(value))
.
Example:
cb.query.setMemberId_Equal(10);
assertThat(cb, hasCondition("memberId", equal(10)));
value
- the value of conditionpublic static IsColumnExpressed notEqual(Matcher<?> matcher)
matcher
.
Example:
cb.query.setMemberName_NotEqual("John Doe");
assertThat(cb, hasCondition("memberName", notEqual(startsWith("J"))));
matcher
- a matcher that evaluates the condition valuepublic static IsColumnExpressed notEqual(Object value)
notEqual(equalTo(value))
.
Example:
cb.query().setMemberId_NotEqual(10);
assertThat(cb, hasCondition("memberId", notEqual(10)));
value
- the value of conditionpublic static IsColumnExpressed greaterThan(Matcher<?> matcher)
matcher
.
Example:
cb.query.setMemberName_GreaterThan("John Doe");
assertThat(cb, hasCondition("memberName", greaterThan(startsWith("J"))));
matcher
- a matcher that evaluates the condition valuepublic static IsColumnExpressed greaterThan(Object value)
greaterThan(equalTo(value))
.
Example:
cb.query.setMemberId_GreaterThan(10);
assertThat(cb, hasCondition("memberId", greaterThan(10)));
value
- the value of conditionpublic static IsColumnExpressed greaterEqual(Matcher<?> matcher)
matcher
.
Example:
cb.query.setMemberName_GreaterEqual("John Doe");
assertThat(cb, hasCondition("memberName", greaterEqual(startsWith("J"))));
matcher
- a matcher that evaluates the condition valuepublic static IsColumnExpressed greaterEqual(Object value)
greaterEqual(equalTo(value))
.
Example:
cb.query.setMemberId_GreaterEqual(10);
assertThat(cb, hasCondition("memberId", greaterEqual(10)));
value
- the value of conditionpublic static IsColumnExpressed lessThan(Matcher<?> matcher)
matcher
.
Example:
cb.query.setMemberName_LessThan("John Doe");
assertThat(cb, hasCondition("memberName", lessThan(startsWith("J"))));
matcher
- a matcher that evaluates the condition valuepublic static IsColumnExpressed lessThan(Object value)
lessThan(equalTo(value))
.
Example:
cb.query.setMemberId_LessThan(10);
assertThat(cb, hasCondition("memberId", lessThan(10)));
value
- the value of conditionpublic static IsColumnExpressed lessEqual(Matcher<?> matcher)
matcher
.
Example:
cb.query.setMemberName_LessEqual("John Doe");
assertThat(cb, hasCondition("memberName", lessEqual(startsWith("J"))));
matcher
- a matcher that evaluates the condition valuepublic static IsColumnExpressed lessEqual(Object value)
lessEqual(equalTo(value))
.
Example:
cb.query.setMemberId_LessEqual(10);
assertThat(cb, hasCondition("memberId", lessEqual(10)));
value
- the value of conditionpublic static IsColumnExpressed in(Matcher<?> matcher)
matcher
.
Example:
cb.query().setMemberName_InScope(Arrays.asList("John Doe", "Jane Doe"));
assertThat(cb, hasCondition("memberName", in(contains("John Doe", "Jane Doe"))));
matcher
- a matcher that evaluates the condition valuepublic static IsColumnExpressed in(Object... items)
in(hasItems(items))
.
Example:
cb.query().setMemberName_InScope(Arrays.asList("John Doe", "Jane Doe"));
assertThat(cb, hasCondition("memberName", in("John Doe", "Jane Doe")));
items
- the value of conditionpublic static IsColumnExpressed notIn(Matcher<?> matcher)
matcher
.
Example:
cb.query().setMemberName_NotInScope(Arrays.asList("John Doe", "Jane Doe"));
assertThat(cb, hasCondition("memberName", notIn(contains("John Doe", "Jane Doe"))));
matcher
- a matcher that evaluates the condition valuepublic static IsColumnExpressed notIn(Object... items)
notIn(contains(items))
.
Example:
cb.query().setMemberName_NotInScope(Arrays.asList("John Doe", "Jane Doe"));
assertThat(cb, hasCondition("memberName", notIn("John Doe", "Jane Doe")));
items
- the value of conditionpublic static IsColumnExpressed like(Matcher<?> matcher)
matcher
.
Example:
cb.query().setMemberName_LikeSearch("John", op -> op.likePrefix());
assertThat(cb, hasCondition("memberName", like(equalTo("John%"))));
matcher
- a matcher that evaluates the condition valuepublic static IsColumnExpressed like(Object value)
like(equalTo(value))
.
Example:
cb.query().setMemberName_LikeSearch("John", op -> op.likePrefix());
assertThat(cb, hasCondition("memberName", like("John%")));
value
- the value of conditionpublic static IsColumnExpressed likePrefix(String value)
like(equalTo(value + "%"))
.
Example:
cb.query().setMemberName_LikeSearch("John", op -> op.likePrefix());
assertThat(cb, hasCondition("memberName", likePrefix("John")));
value
- the value of conditionpublic static IsColumnExpressed likeSuffix(String value)
like(equalTo("%" + value))
.
Example:
cb.query().setMemberName_LikeSearch("Doe", op -> op.likeSuffix());
assertThat(cb, hasCondition("memberName", likeSuffix("Doe")));
value
- the value of conditionpublic static IsColumnExpressed likeContain(String value)
like(equalTo("%" + value + "%"))
.
Example:
cb.query().setMemberName_LikeSearch("n D", op -> op.likeContain());
assertThat(cb, hasCondition("memberName", likeContain("n D")));
value
- the value of conditionpublic static IsColumnExpressed notLike(Matcher<?> matcher)
matcher
.
Example:
cb.query().setMemberName_NotLikeSearch("John", op -> op.likePrefix());
assertThat(cb, hasCondition("memberName", notLike(equalTo("John%"))));
matcher
- a matcher that evaluates the condition valuepublic static IsColumnExpressed notLike(Object value)
notLike(equalTo(value))
.
Example:
cb.query().setMemberName_NotLikeSearch("John", op -> op.likePrefix());
assertThat(cb, hasCondition("memberName", notLike("John%")));
value
- the value of conditionpublic static IsColumnExpressed notLikePrefix(String value)
notLike(equalTo(value + "%"))
.
Example:
cb.query().setMemberName_NotLikeSearch("John", op -> op.likePrefix());
assertThat(cb, hasCondition("memberName", notLikePrefix("John")));
value
- the value of conditionpublic static IsColumnExpressed notLikeSuffix(String value)
notLike(equalTo("%" + value))
.
Example:
cb.query().setMemberName_NotLikeSearch("Doe", op -> op.likeSuffix());
assertThat(cb, hasCondition("memberName", notLikeSuffix("Doe")));
value
- the value of conditionpublic static IsColumnExpressed notLikeContain(String value)
notLike(equalTo("%" + value + "%"))
.
Example:
cb.query().setMemberName_NotLikeSearch("n D", op -> op.likeContain());
assertThat(cb, hasCondition("memberName", notLikeContain("n D")));
value
- the value of conditionpublic static IsColumnIsNull isNull()
Example:
cb.query.setMemberName_IsNull();
assertThat(cb, hasCondition("memberName", isNull()));
public static IsColumnIsNotNull isNotNull()
Example:
cb.query.setMemberName_IsNotNull();
assertThat(cb, hasCondition("memberName", isNotNull()));
public static <T extends org.dbflute.cbean.ConditionBean> ShouldSelect<T> shouldSelect(String columnName)
Example:
cb.specify().columnMemberName();
assertThat(cb, shouldSelect("memberName"));
cb.specify().specifyMemberStatus().columnMemberStatusName();
assertThat(cb, shouldSelect("memberStatus.memberStatusName"));
cb.specify().specifyMemberServiceAsOne().specifyServiceRank().columnServiceRankName();
// 'AsOne' can be omitted from table name
assertThat(cb, shouldSelect("memberService.serviceRank.serviceRankName"));
T
- the type of clazz
columnName
- the name of columnCopyright © 2015 The DBFlute Project. All rights reserved.