Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HHH-11737 - Remove dependency on org.hibernate.criterion package.
- Loading branch information
Chris Cranford
committed
May 10, 2017
1 parent
5ff2289
commit f9aa6e6
Showing
4 changed files
with
72 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
hibernate-envers/src/main/java/org/hibernate/envers/query/criteria/MatchMode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
* Hibernate, Relational Persistence for Idiomatic Java | ||
* | ||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later. | ||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. | ||
*/ | ||
package org.hibernate.envers.query.criteria; | ||
|
||
/** | ||
* A strategy for matching strings using "like". | ||
* | ||
* @author Chris Cranford | ||
*/ | ||
public enum MatchMode { | ||
/** | ||
* Match the pattern exactly. | ||
*/ | ||
EXACT { | ||
@Override | ||
public String toMatchString(String pattern) { | ||
return pattern; | ||
} | ||
}, | ||
|
||
/** | ||
* Match the start of the string to the pattern. | ||
*/ | ||
START { | ||
@Override | ||
public String toMatchString(String pattern) { | ||
return pattern + '%'; | ||
} | ||
}, | ||
|
||
/** | ||
* Match the end of the string to the pattern. | ||
*/ | ||
END { | ||
@Override | ||
public String toMatchString(String pattern) { | ||
return '%' + pattern; | ||
} | ||
}, | ||
|
||
/** | ||
* Match the pattern anywhere in the string. | ||
*/ | ||
ANYWHERE { | ||
@Override | ||
public String toMatchString(String pattern) { | ||
return '%' + pattern + '%'; | ||
} | ||
}; | ||
|
||
/** | ||
* Convert the pattern by prepending/append "%". | ||
* | ||
* @param pattern The pattern to convert according to the mode. | ||
* @return The converted pattern. | ||
*/ | ||
public abstract String toMatchString(String pattern); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters