javax.beans.binding
Class ListCondenser

java.lang.Object
  extended by javax.beans.binding.ListCondenser

public abstract class ListCondenser
extends java.lang.Object

ListCondenser is used to condense a list of values into a single value. ListCondenser is used by Binding to select the value for the target when evaluating an expression that yields a list as a part of the expression.


Constructor Summary
ListCondenser()
           
 
Method Summary
static ListCondenser concatenatingCondenser(java.lang.String leading, java.lang.String trailing, java.lang.String separator)
          Creates and returns a ListCondenser that returns a string representation of each of the elements supplied to the condense method.
abstract  java.lang.Object condense(java.util.List<?> elements)
          Condenses the list into a single value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ListCondenser

public ListCondenser()
Method Detail

concatenatingCondenser

public static ListCondenser concatenatingCondenser(java.lang.String leading,
                                                   java.lang.String trailing,
                                                   java.lang.String separator)
Creates and returns a ListCondenser that returns a string representation of each of the elements supplied to the condense method. The resulting string is generated by concatenating the results of invoking toString on each of the elements. The string value is wrapped in the leading and trailing strings, and if multiple values are present, each is separated by a separator string. A value of null in the list is treated as an empty string.

Parameters:
leading - a string to prefix each element with; a value of null is treated as an empty string
trailing - a string to append to each element; a value of null is treated as an empty string
separator - string used to separate each element; a value of null is treated as an empty string
Returns:
a condenser that concatenates the elements

condense

public abstract java.lang.Object condense(java.util.List<?> elements)
Condenses the list into a single value. Subclasses can expect the list to be non-null, but elements of the list may be null.

Parameters:
elements - the List of elements to condense
Returns:
the appropriate element
Throws:
java.lang.NullPointerException - if elements is null
java.lang.IndexOutOfBoundsException - if elements is empty