Andrus,

OK. Please let me verify my understanding. So for example, if I had created an 
expression like:

        Expression exp = 
ExpressionFactory.matchExp(Product.IS_DISABLED_PROPERTY, false);
        exp = 
exp.andExp(ExpressionFactory.matchExp(Product.IS_VINTAGE_PROPERTY, false));

the new equivalent would be

        Expression exp = Product.IS_DISABLED.isFalse();
        exp = exp.andExp(Product.IS_VINTAGE.isFalse());

producing the SQL

        System.out.println("expression: " + exp);


and an Attribute name/value for “vintage” would be printed as

        System.out.println("isVintage: " + Product.IS_VINTAGE.getName());

This looks pretty concise and easy to replace to me.

Question:
Is that the new “best practice”?   Are there any other new 
(expression/ordering) tricks I should look into?

Thanks
Joe



> On Jul 31, 2015, at 1:25 PM, Andrus Adamchik <and...@objectstyle.org> wrote:
> 
> 
>> On Jul 31, 2015, at 7:50 PM, Joe Baldwin <jfbald...@earthlink.net> wrote:
>> 
>> functional replacement that would also give me access to the String value of 
>> the property (for display purposes).
> 
> Here is an example:
> 
> (generated code)
> 
>  @Deprecated
>  public static final String TITLE_PROPERTY = "title";
>  public static final Property<String> TITLE = new Property<String>("title");
> 
> (accessing property name in a new way)
> 
>  TITLE.getName();
> 
> But the point of the new API is to replace code like this:
> 
>  Expression exp = ExpressionFactory.matchExp(Product.IS_DISABLED_PROPERTY, 
> false);
> 
> with this:
> 
>  Expression exp = Product.IS_DISABLED.isFalse();
> 
> Which does not require knowing the property name. IIRC 4.0 tutorial has other 
> examples of expressions using the new API.
> 
> Andrus
> 

Reply via email to