org.jcon.data
Class GroupByPropertyValue

java.lang.Object
  extended by org.jcon.data.GroupByPropertyValue
All Implemented Interfaces:
ObjectTransform

public class GroupByPropertyValue
extends java.lang.Object
implements ObjectTransform

Transforms a collection of objects into a Map that groups objects together based on shared values for a specified property. The result is keyed by the unique values of the specified property; the values associated with these keys are sets containing all objects that have that value for the property. For example, if you ran it on a list of objects which all have the property "color", you would specify "color" as the value of propertyName. The result would be a Map with keys like "blue", "red", "green", etc. The value for "red" would contain all the objects whose "color" property was "red".

Author:
Paul Reavis

Constructor Summary
GroupByPropertyValue()
           
GroupByPropertyValue(java.lang.String propertyName)
           
 
Method Summary
 java.lang.String getPropertyName()
          Name of property to group by.
 void setPropertyName(java.lang.String newName)
           
 java.lang.Object transform(java.lang.Object victim)
          Our one method; this transforms one object into another.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GroupByPropertyValue

public GroupByPropertyValue()

GroupByPropertyValue

public GroupByPropertyValue(java.lang.String propertyName)
Method Detail

transform

public java.lang.Object transform(java.lang.Object victim)
Description copied from interface: ObjectTransform
Our one method; this transforms one object into another. Transformation must be nondestructive, but may produce a derived product that is still affected by changes to the original, so beware.

Specified by:
transform in interface ObjectTransform

getPropertyName

public java.lang.String getPropertyName()
Name of property to group by.


setPropertyName

public void setPropertyName(java.lang.String newName)