/** * Exclude zero-valued properties. * * Equivalent to calling {@link #setPropertySelector} passing in {@link NotNullOrZeroPropertySelector#INSTANCE} * * @return {@code this}, for method chaining * * @see #setPropertySelector */ public Example excludeZeroes() { setPropertySelector( NotNullOrZeroPropertySelector.INSTANCE ); return this; }
/** * Include all properties. * * Equivalent to calling {@link #setPropertySelector} passing in {@link AllPropertySelector#INSTANCE} * * @return {@code this}, for method chaining * * @see #setPropertySelector */ public Example excludeNone() { setPropertySelector( AllPropertySelector.INSTANCE ); return this; }
/** * Don't exclude null or zero-valued properties */ public Example excludeNone() { setPropertySelector(ALL); return this; }
/** * Exclude zero-valued properties */ public Example excludeZeroes() { setPropertySelector(NOT_NULL_OR_ZERO); return this; }
/** * Exclude zero-valued properties */ public Example excludeZeroes() { setPropertySelector(NOT_NULL_OR_ZERO); return this; }
/** * Exclude zero-valued properties */ public Example excludeZeroes() { setPropertySelector(NOT_NULL_OR_ZERO); return this; }
/** * Don't exclude null or zero-valued properties */ public Example excludeNone() { setPropertySelector(ALL); return this; }
/** * Exclude zero-valued properties */ public Example excludeZeroes() { setPropertySelector(NOT_NULL_OR_ZERO); return this; }
/** * Don't exclude null or zero-valued properties */ public Example excludeNone() { setPropertySelector(ALL); return this; }
public static Example getExampleCriterion(Object entity, String[] excludePropertes, MatchMode mode) { Example example = Example.create(entity).setPropertySelector(new NotEmptyPropertySelector()); if (null != mode) { example.enableLike(mode); } if (null != excludePropertes) { for (int i = 0; i < excludePropertes.length; i++) { example.excludeProperty(excludePropertes[i]); } } return example; }
private static org.hibernate.criterion.Example adaptExample(final Example expr) { final Object entity = ExampleV2Reflection.getEntity(expr); final org.hibernate.criterion.Example.PropertySelector selector = ExamplePropertySelectorV2Adapter.adapt(ExampleV2Reflection.getSelector(expr)); final org.hibernate.criterion.Example example = org.hibernate.criterion.Example.create(entity); example.setPropertySelector(selector); for (final Object propertyName : ExampleV2Reflection.getExcludedProperties(expr)) { example.excludeProperty((String) propertyName); } if (ExampleV2Reflection.getIsLikeEnabled(expr)) { example.enableLike(MatchModeV2Adapter.adapt(ExampleV2Reflection.getMatchMode(expr))); } return example; }