net.sf.beanlib.provider.replicator
Class MapReplicator

java.lang.Object
  extended by net.sf.beanlib.provider.replicator.ReplicatorTemplate
      extended by net.sf.beanlib.provider.replicator.MapReplicator
All Implemented Interfaces:
MapReplicatorSpi
Direct Known Subclasses:
Hibernate3MapReplicator

public class MapReplicator
extends ReplicatorTemplate
implements MapReplicatorSpi

Default implementation of MapReplicatorSpi.

Author:
Joe D. Velopar

Nested Class Summary
private static class MapReplicator.Factory
          Factory for MapReplicator
 
Field Summary
private static MapReplicator.Factory factory
           
 
Fields inherited from class net.sf.beanlib.provider.replicator.ReplicatorTemplate
log
 
Constructor Summary
protected MapReplicator(BeanTransformerSpi beanTransformer)
           
 
Method Summary
private
<K,V> Comparator<K>
createToComparator(SortedMap<K,V> fromSortedMap)
          Returns a replicated comparator of the given sorted map, or null if there is no comparator.
private
<K,V> Map<K,V>
createToInstanceAsMap(Map<K,V> from)
           
private
<K,V> Map<K,V>
createToMap(Map<K,V> from)
           
private
<K,V> SortedMap<K,V>
createToSortedMapWithComparator(SortedMap<K,V> from, Comparator<? super K> comparator)
           
static MapReplicator newMapReplicatable(BeanTransformerSpi beanTransformer)
           
<K,V,T> T
replicateMap(Map<K,V> from, Class<T> toClass)
          Returns a replicated map.
 
Methods inherited from class net.sf.beanlib.provider.replicator.ReplicatorTemplate
chooseClass, containsTargetCloned, createToInstance, createToInstance, createToInstanceWithComparator, getCustomerBeanTransformer, getTargetCloned, newInstanceAsPrivileged, populateBean, putTargetCloned, replicate, replicate, replicateByBeanReplicatable, transform, unenhanceObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

factory

private static final MapReplicator.Factory factory
Constructor Detail

MapReplicator

protected MapReplicator(BeanTransformerSpi beanTransformer)
Method Detail

newMapReplicatable

public static MapReplicator newMapReplicatable(BeanTransformerSpi beanTransformer)

replicateMap

public <K,V,T> T replicateMap(Map<K,V> from,
                              Class<T> toClass)
Description copied from interface: MapReplicatorSpi
Returns a replicated map.

Specified by:
replicateMap in interface MapReplicatorSpi
Type Parameters:
K - key type of the from map
V - value type of the from map
T - target class type
Parameters:
from - from map
toClass - target class

createToMap

private <K,V> Map<K,V> createToMap(Map<K,V> from)
                      throws InstantiationException,
                             IllegalAccessException,
                             SecurityException,
                             NoSuchMethodException
Throws:
InstantiationException
IllegalAccessException
SecurityException
NoSuchMethodException

createToInstanceAsMap

private <K,V> Map<K,V> createToInstanceAsMap(Map<K,V> from)
                                throws InstantiationException,
                                       IllegalAccessException,
                                       NoSuchMethodException
Throws:
InstantiationException
IllegalAccessException
NoSuchMethodException

createToComparator

private <K,V> Comparator<K> createToComparator(SortedMap<K,V> fromSortedMap)
Returns a replicated comparator of the given sorted map, or null if there is no comparator.


createToSortedMapWithComparator

private <K,V> SortedMap<K,V> createToSortedMapWithComparator(SortedMap<K,V> from,
                                                             Comparator<? super K> comparator)
                                                throws NoSuchMethodException,
                                                       SecurityException
Throws:
NoSuchMethodException
SecurityException