org.apache.openjpa.util
Interface ProxyManager

All Known Implementing Classes:
ProxyManagerImpl

public interface ProxyManager

Manager for copying and proxying second class objects. Second class objects are those that are often used as fields of persistent or transactional instances, and which can themselves be modified without resetting the owning class' field. Because these types can change without an explicit call to the owning persistence capable instance, special care must be taken to ensure that their state is managed correctly. Specifically, they must be copied when saving state for rollback, and they must be proxied for any instance whose state is managed by a state manager, where proxying involves creating a second class object that automaticlly notifies its owning instance whenever it is modified. Generally, this factory is only used by the implementation; second class object handling is transparent to client code.

Author:
Abe White

Method Summary
 Object copyArray(Object orig)
          Return a new array of the same component type as the given array and containing the same elements.
 Calendar copyCalendar(Calendar orig)
          Return a copy of the given Calendar with the same information.
 Collection copyCollection(Collection orig)
          Return a new collection of the same type as the given one with a copy of all contained elements.
 Object copyCustom(Object orig)
          Return a copy of the given object with the same information.
 Date copyDate(Date orig)
          Return a copy of the given date with the same information.
 Map copyMap(Map orig)
          Return a new map of the same type as the given one with a copy of all contained key/value pairs.
 Proxy newCalendarProxy(Class type, TimeZone timeZone)
          Return a new calendar proxy.
 Proxy newCollectionProxy(Class type, Class elementType, Comparator compare)
          Return a proxy for the given collection type.
 Proxy newCustomProxy(Object obj)
          Return a proxy for the given object, or null if this manager cannot proxy the object.
 Proxy newDateProxy(Class type)
          Return a new date proxy.
 Proxy newMapProxy(Class type, Class keyType, Class valueType, Comparator compare)
          Return a proxy for the given map type.
 

Method Detail

copyDate

Date copyDate(Date orig)
Return a copy of the given date with the same information.


copyCalendar

Calendar copyCalendar(Calendar orig)
Return a copy of the given Calendar with the same information.


copyCollection

Collection copyCollection(Collection orig)
Return a new collection of the same type as the given one with a copy of all contained elements. If the given owner is non-null, the returned value should be a proxy for the given owner, otherwise it should not be a proxy.


copyMap

Map copyMap(Map orig)
Return a new map of the same type as the given one with a copy of all contained key/value pairs. If the given owner is non-null, the returned value should be a proxy for the given owner, otherwise it should not be a proxy.


copyArray

Object copyArray(Object orig)
Return a new array of the same component type as the given array and containing the same elements. Works for both primitive and object array types.


copyCustom

Object copyCustom(Object orig)
Return a copy of the given object with the same information. If this manager cannot proxy the given type, return null. If the given owner is non-null, the returned value should be a proxy for the given owner, otherwise it should not be a proxy.

Since:
0.2.5

newDateProxy

Proxy newDateProxy(Class type)
Return a new date proxy.


newCalendarProxy

Proxy newCalendarProxy(Class type,
                       TimeZone timeZone)
Return a new calendar proxy.


newCollectionProxy

Proxy newCollectionProxy(Class type,
                         Class elementType,
                         Comparator compare)
Return a proxy for the given collection type. The returned collection will allow only addition of elements assignable from the given element type and will use the given comparator, if it is not null.


newMapProxy

Proxy newMapProxy(Class type,
                  Class keyType,
                  Class valueType,
                  Comparator compare)
Return a proxy for the given map type. The returned map will allow only addition of keys/values assignable from the given keyType/valueType, and will use the given comparator, if it is not null.


newCustomProxy

Proxy newCustomProxy(Object obj)
Return a proxy for the given object, or null if this manager cannot proxy the object.

Since:
0.2.5


Copyright © 2006 Apache Software Foundation. All Rights Reserved.