public class HibernateRepositoryUtils extends Object
Restrictions
and HibernateRepositoryUtils
instead of calling:
userRepository.list(properties("firstName","lastName"), restrictions(Restrictions.equal(),Restrictions.ilike()), values("John","D%"),page(1,10));
you can have:
userRepository.list(properties("firstName","lastName"), restrictions(equal(),ilike()), values("John","D%"),page(1,10));
or even:
userRepository.list(p("firstName","lastName"), r(equal(),ilike()), v("John","D%"),p(1,10));Constructor and Description |
---|
HibernateRepositoryUtils() |
Modifier and Type | Method and Description |
---|---|
static Page |
p(int number,
int size) |
static String[] |
p(String... properties)
a short version of method to avoid creating arrays of property names with new String[]{"properyName1","properyName2"} approach
|
static Page |
page(int number,
int size)
A short version of creating page
|
static String[] |
properties(String... properties)
a method to avoid creating arrays of property names with new String[]{"properyName1","properyName2"} approach
|
static Restrictions.Restriction[] |
r(Restrictions.Restriction... restrictions)
A short version of method to avoid creating arrays of parameters with new
Restrictions [ ]{Restriction.someRestrcion1,Restriction.someRestrcion2} approach |
static Restrictions.Restriction[] |
restrictions(Restrictions.Restriction... restrictions)
A method to avoid creating arrays of parameters with new
Restrictions [ ]{Restriction.someRestrcion1,Restriction.someRestrcion2} approach |
static Object[] |
v(Object... values)
A short version of method to avoid creating arrays of values for restricting properties with new Object[]{"value1","value2"} approach
|
static Object[] |
values(Object... values)
A method to avoid creating arrays of values for restricting properties with new Object[]{"value1","value2"} approach
|
public static String[] properties(String... properties)
names
- public static String[] p(String... properties)
names
- public static Restrictions.Restriction[] restrictions(Restrictions.Restriction... restrictions)
Restrictions
[ ]{Restriction.someRestrcion1,Restriction.someRestrcion2} approachrestrictions
- public static Restrictions.Restriction[] r(Restrictions.Restriction... restrictions)
Restrictions
[ ]{Restriction.someRestrcion1,Restriction.someRestrcion2} approachrestrictions
- public static Object[] values(Object... values)
values
- public static Object[] v(Object... values)
values
- public static Page page(int number, int size)
number
- page numbersize
- page sizepublic static Page p(int number, int size)
number
- page numbersize
- page sizeCopyright © 2007–2014 Semochkin Vitaly Evgenevich. All rights reserved.