net.sf.beanlib.provider.replicator
Class CollectionReplicator

java.lang.Object
  extended by net.sf.beanlib.provider.replicator.ReplicatorTemplate
      extended by net.sf.beanlib.provider.replicator.CollectionReplicator
All Implemented Interfaces:
CollectionReplicatorSpi
Direct Known Subclasses:
Hibernate3CollectionReplicator

public class CollectionReplicator
extends ReplicatorTemplate
implements CollectionReplicatorSpi

Default implementation of CollectionReplicatorSpi.

Author:
Joe D. Velopar

Nested Class Summary
private static class CollectionReplicator.Factory
          Factory for CollectionReplicator
 
Field Summary
private static CollectionReplicator.Factory factory
           
 
Fields inherited from class net.sf.beanlib.provider.replicator.ReplicatorTemplate
log
 
Constructor Summary
protected CollectionReplicator(BeanTransformerSpi beanTransformer)
           
 
Method Summary
protected  Collection<Object> createToCollection(Collection<?> from)
           
protected  Comparator createToComparator(SortedSet fromSortedSet)
          Returns a replicated comparator of the given sorted set, or null if there is no comparator.
protected  Collection<Object> createToInstanceAsCollection(Collection<?> from)
           
protected  SortedSet<Object> createToSortedSetWithComparator(SortedSet from, Comparator comparator)
           
static CollectionReplicator newCollectionReplicatable(BeanTransformerSpi beanTransformer)
           
<V,T> T
replicateCollection(Collection<V> from, Class<T> toClass)
          Returns a replicated collection.
 
Methods inherited from class net.sf.beanlib.provider.replicator.ReplicatorTemplate
chooseClass, createToInstance, createToInstance, createToInstanceWithComparator, getTargetCloned, newInstanceAsPrivileged, populateBean, putTargetCloned, replicate, replicate, replicateByBeanReplicatable, transform
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

factory

private static final CollectionReplicator.Factory factory
Constructor Detail

CollectionReplicator

protected CollectionReplicator(BeanTransformerSpi beanTransformer)
Method Detail

newCollectionReplicatable

public static CollectionReplicator newCollectionReplicatable(BeanTransformerSpi beanTransformer)

replicateCollection

public <V,T> T replicateCollection(Collection<V> from,
                                   Class<T> toClass)
Description copied from interface: CollectionReplicatorSpi
Returns a replicated collection.

Specified by:
replicateCollection in interface CollectionReplicatorSpi
Type Parameters:
V - component type of the from collection
T - target class type
Parameters:
from - from collection
toClass - target class

createToCollection

protected Collection<Object> createToCollection(Collection<?> from)
                                         throws InstantiationException,
                                                IllegalAccessException,
                                                SecurityException,
                                                NoSuchMethodException,
                                                InvocationTargetException
Throws:
InstantiationException
IllegalAccessException
SecurityException
NoSuchMethodException
InvocationTargetException

createToInstanceAsCollection

protected final Collection<Object> createToInstanceAsCollection(Collection<?> from)
                                                         throws InstantiationException,
                                                                IllegalAccessException,
                                                                NoSuchMethodException
Throws:
InstantiationException
IllegalAccessException
NoSuchMethodException

createToSortedSetWithComparator

protected final SortedSet<Object> createToSortedSetWithComparator(SortedSet from,
                                                                  Comparator comparator)
                                                           throws NoSuchMethodException,
                                                                  SecurityException
Throws:
NoSuchMethodException
SecurityException

createToComparator

protected Comparator createToComparator(SortedSet fromSortedSet)
Returns a replicated comparator of the given sorted set, or null if there is no comparator.