import org.wamblee.persistence.Detachable;
/**
- * A detachable model that wraps a domain object.
- *
+ * A detachable model that wraps a domain object.
+ *
*/
public class DetachableEntity<T> extends LoadableDetachableModel<T> {
-
- private Detachable<T> object;
-
- /**
- * Constructs the model.
- * @param aObject Object to construct the model with.
- */
- public DetachableEntity(Detachable<T> aObject) {
+
+ private Detachable<T> object;
+
+ /**
+ * Constructs the model.
+ *
+ * @param aObject
+ * Object to construct the model with.
+ */
+ public DetachableEntity(Detachable<T> aObject) {
+ super(aObject.get());
object = aObject;
- }
-
- @Override
- protected void onDetach() {
- object.detach();
- }
-
- @Override
- protected T load() {
- return object.get();
- }
-
- @Override
- public void setObject(T object) {
- throw new UnsupportedOperationException("setObject is not supported on this class");
- }
+ }
+
+ @Override
+ protected void onDetach() {
+ object.detach();
+ }
+
+ @Override
+ protected T load() {
+ return object.get();
+ }
+
+ @Override
+ public void setObject(T aObject) {
+ throw new UnsupportedOperationException(
+ "setObject is not supported on this class");
+ }
}