org.ioc.commons.integration.service.ServiceObjectManager Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ioc-commons Show documentation
Show all versions of ioc-commons Show documentation
This project defines a set of useful java interfaces for helping you in the definition of the structure of your developments in Java-projects which are designed using a Inversion-Of-Control (IOC) pattern. Useful for MVP-Pattern designs in applications coded on GWT, SWT, Android, etc.
package org.ioc.commons.integration.service;
import org.ioc.commons.integration.common.ObjectState;
public interface ServiceObjectManager {
/**
* Creates a new object for being used as service method parameter.
*
* @param class1
* Class of the new object
* @return An instance of a new object.
*/
T create(Class class1);
/**
* Enables edition on an object returned by a service method.
*
* @param entity
* Object to start editing
* @return Entity object ready for editing.
*/
T edit(T entity);
/**
* The service which this object manager comes from
*
* @return Service
*/
Service getService();
/**
* Get the state of the object.
*
* Notice that not all implementations will be able to determine object
* state. These implementions will return ObjectState.UNKNOWN value.
*/
ObjectState getObjectState(Object object);
/**
* Get a detached copy from a persistent object instance. It detaches
* recursively all object attributes as well.
*
* In case object state is not PERSISTENT, this method will return the same
* object past by argument.
*
* @param persistentObject
* Persistent object to detach
*
* @return Detached instance.
*/
T detach(T persistentObject);
/**
* Get a detached copy from a persistent object instance. It can detach
* recursively all object attributes or not depending on second attribute.
*
* In case object state is not PERSISTENT, this method will return the same
* object past by argument.
*
* @param persistentObject
* Persistent object to detach
* @param detachAttributesRecursively
* Detaches or not attributes recursively too or not.
*
* @return Detached instance.
*/
T detach(T persistentObject, boolean detachAttributesRecursively);
}