public class Perspectives
extends java.lang.Object
| 构造器和说明 |
|---|
Perspectives(Cloner cloner) |
| 限定符和类型 | 方法和说明 |
|---|---|
<T,E extends T> |
viewAs(java.lang.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 java.util.Collection<I>,E extends java.util.Collection<NI>> |
viewCollectionAs(E newCollection,
java.lang.Class<NI> perspectiveCollectionItemClass,
T currentCollection)
Sample: if o is a [ Products extends LinkedList
|
public Perspectives(Cloner cloner)
public <T,E extends T> E viewAs(java.lang.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 java.util.Collection<I>,E extends java.util.Collection<NI>> E viewCollectionAs(E newCollection,
java.lang.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 NI