public class Perspectives extends Object
| Constructor and Description |
|---|
Perspectives(Cloner cloner) |
| Modifier and Type | Method and Description |
|---|---|
<T,E extends T> |
viewAs(Class<E> c,
T o)
Sample: if o is an instance of Product and c is OrderedProduct.class then this returns
and instance of OrderedProduct.class which has equal field values to those of the instance of Product.
|
<I,NI extends I,T extends Collection<I>,E extends Collection<NI>> |
viewCollectionAs(E newCollection,
Class<NI> perspectiveCollectionItemClass,
T currentCollection)
Sample: if o is a [ Products extends LinkedList
|
public Perspectives(Cloner cloner)
public <T,E extends T> E viewAs(Class<E> c, T o)
T - the objectE - this will be the returned type and it must be instanceof T. All properties of o will be copied to this instance.c - the class of E. This is used to generate new instances of co - the object that must be viewed from a different perspectivepublic <I,NI extends I,T extends Collection<I>,E extends Collection<NI>> E viewCollectionAs(E newCollection, Class<NI> perspectiveCollectionItemClass, T currentCollection)
T - the type of the collection oI - the type of the elements of the collection oE - the type of the perspective collectionNI - the type of the perspective's elementsnewCollection - the collection to which the adapted instances should be addedcurrentCollection - the collection with the instances to be adaptedperspectiveCollectionItemClass - the class of the NICopyright © 2012. All Rights Reserved.