com.emarsys.ecommon.util
Class EntityExporter
java.lang.Object
com.emarsys.ecommon.util.EntityExporter
public class EntityExporter
- extends java.lang.Object
Extra bean utilities try to "de-Hibernate" an attached object within reason.
We ignore all lazily-loadeded properties, as well as transient properties or
properties with no setter.
Limitations
This class is still a work in progress.
BE VERY CAREFUL about the includeLazy method. This does create caches
of elements, so that you will not constantly pull the same elements. However,
if you have a ManyToMany relationship, you will likely enter an infinite
loop in your object graph.
Future directions
Instead of using an interface, I should probably just have my types depend
upon being marked by the @Entity attribute, and search for the identifer
via the @Id attribute. Then the exporter will just search the class hierarchy
of an object by attributes rather than by type. Since everything is based
upon reflection anyway, this is not a big deal.
- Author:
- Tristan Juricek
Method Summary |
void |
cache(java.lang.Object toCopy,
java.lang.Object value)
|
|
copy(T from,
T to)
Copies all bean properties that are not marked as being fetched Lazily,
are not transient, and are storable. |
|
create(T toCopy)
|
java.lang.Object |
getCached(java.lang.Object obj)
|
java.lang.Class |
getExportableParent(java.lang.Class clazz)
|
boolean |
isCached(java.lang.Object obj)
|
boolean |
isList(java.lang.Class clazz)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
EntityExporter
public EntityExporter(boolean includeLazy)
create
public <T extends Identifiable> T create(T toCopy)
isCached
public boolean isCached(java.lang.Object obj)
getCached
public java.lang.Object getCached(java.lang.Object obj)
cache
public void cache(java.lang.Object toCopy,
java.lang.Object value)
copy
public <T extends Identifiable> void copy(T from,
T to)
- Copies all bean properties that are not marked as being fetched Lazily,
are not transient, and are storable.
- Type Parameters:
T
- - Parameters:
from
- to
-
getExportableParent
public java.lang.Class getExportableParent(java.lang.Class clazz)
isList
public boolean isList(java.lang.Class clazz)
Copyright © 2010 emarsys AG. All Rights Reserved.