Mapper Logo
.

7. Value Holders

7.1 Heirarchy

7.2 ValueHolders

7.3 Binding Components to ValueHolders

7.4 ObjectValueHolder

7.5 VariantValueHolder

7.6 VOValueHolder

7.7 ObjectCollectionValueHolder

7.8 ObjectListValueHolder

7.9 VOCollectionValueHolder

7.10 VOListValueHolder

7.11 VOComparators

VOComparator is a Comparator for sorting value objects in a VOListValueHolder. This can sort by one or more properties of the value object. Ascending or descending can be specified for each property (default is ascending).

To sort by a single property, use the setPropertyName method. To sort by more than one property use the setPropertyNames method and pass it a String[] array of property names.

To change the order for a single property, use the setAscendingOrder method (true=Ascending false=descending). To change the order for multiple properties, use the setAscendingOrders method and pass it a boolean[] array. The order of the ascending order indicators should match the array of property names.

This VOComparator is then attached to the VOListValueHolder using the setComparator method. IMPORTANT: This VOComparator can only be used with one VOListValueHolder at a time - it cannot be shared.

Example - sort ascending by a lastName

           VOListValueHolder holder = new VOListValueHolder();
           VOComparator comparator = new VOComparator();
           ...
           comparator.setPropertyName("lastName");
           holder.setComparator(comparator);
        

Example - sort ascending by a salary(descending), yearsWorked(ascending)

           VOListValueHolder holder = new VOListValueHolder();
           VOComparator comparator = new VOComparator();
           ...
           comparator.setPropertyNames(new String[] {"salary", "yearsWorked"});
           comparator.setAscendingOrders(new boolean[] {false, true});
           holder.setComparator(comparator);
        
.