net.sf.jagg
Class ConcatAggregator

java.lang.Object
  extended by net.sf.jagg.Aggregator
      extended by net.sf.jagg.ConcatAggregator

public class ConcatAggregator
extends Aggregator

This class represents the "concatenation" aggregator over any values for which toString is well-defined, with an optional separator String between values.

Since:
0.1.0
Author:
Randy Gettman

Field Summary
 
Fields inherited from class net.sf.jagg.Aggregator
PROP_SELF
 
Constructor Summary
ConcatAggregator(java.lang.String property)
          Constructs a ConcatAggregator that operates on the specified property, with an empty separator string.
ConcatAggregator(java.lang.String property, java.lang.String separator)
          Constructs a ConcatAggregator that operates on the specified property, with the given separator string.
 
Method Summary
 void init()
          Initialize the ConcatAggregator to an empty StringBuilder.
 void iterate(java.lang.Object value)
          Concatenate the value as a String, and possibly a separator.
 void merge(Aggregator agg)
          Merge the given Aggregator into this one.
 ConcatAggregator replicate()
          Returns an uninitialized copy of this Aggregator object, with the same property(ies) to analyze.
protected  void setProperty(java.lang.String property)
          Extracts a possible separator String from the property in the format: property, "separator".
 java.lang.String terminate()
          Return the concatenation of all aggregated values.
 java.lang.String toString()
          A String representation of this ConcatAggregator, which takes into account the possible existence of a separator String specified in the property.
 
Methods inherited from class net.sf.jagg.Aggregator
equals, getAggregator, getAggregator, getProperty, getValueFromProperty, hashCode, isInUse, setInUse, terminateDoubleDouble
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ConcatAggregator

public ConcatAggregator(java.lang.String property)
Constructs a ConcatAggregator that operates on the specified property, with an empty separator string.

Parameters:
property - Concatenate this property's values.

ConcatAggregator

public ConcatAggregator(java.lang.String property,
                        java.lang.String separator)
Constructs a ConcatAggregator that operates on the specified property, with the given separator string.

Parameters:
property - Concatenate this property's values.
separator - The separator String.
Method Detail

replicate

public ConcatAggregator replicate()
Returns an uninitialized copy of this Aggregator object, with the same property(ies) to analyze.

Specified by:
replicate in class Aggregator
Returns:
An uninitialized copy of this Aggregator object.

setProperty

protected void setProperty(java.lang.String property)
Extracts a possible separator String from the property in the format: property, "separator".

Overrides:
setProperty in class Aggregator
Parameters:
property - A property name and possible separator.
See Also:
Aggregator.getProperty()

init

public void init()
Initialize the ConcatAggregator to an empty StringBuilder.

Specified by:
init in class Aggregator

iterate

public void iterate(java.lang.Object value)
Concatenate the value as a String, and possibly a separator.

Specified by:
iterate in class Aggregator
Parameters:
value - The value to aggregate.
See Also:
Aggregator.getValueFromProperty(java.lang.Object, java.lang.String)

merge

public void merge(Aggregator agg)
Merge the given Aggregator into this one. Any separator String will be maintained by this ConcatAggregator.

Specified by:
merge in class Aggregator
Parameters:
agg - The Aggregator to merge into this one.

terminate

public java.lang.String terminate()
Return the concatenation of all aggregated values.

Specified by:
terminate in class Aggregator
Returns:
The concatenated String, or an empty String if no values were processed.

toString

public java.lang.String toString()
A String representation of this ConcatAggregator, which takes into account the possible existence of a separator String specified in the property.

Overrides:
toString in class Aggregator


Copyright © 2010-2013 jAgg Team. All Rights Reserved.