|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.slim3.datastore.AbstractModelRef<M>
org.slim3.datastore.ModelRef<M>
M - the model typepublic class ModelRef<M>
A reference for model like ReferenceProperty of Python.
| Field Summary | |
|---|---|
protected Key |
key
The key. |
protected M |
model
The model. |
| Fields inherited from class org.slim3.datastore.AbstractModelRef |
|---|
modelClass, modelClassName, modelMeta |
| Constructor Summary | |
|---|---|
protected |
ModelRef()
Constructor. |
|
ModelRef(Class<M> modelClass)
Constructor. |
| Method Summary | |
|---|---|
Key |
assignKeyIfNecessary(AsyncDatastoreService ds)
Assigns a new key to the model if necessary. |
void |
clear()
Clears the state of this ModelRef. |
boolean |
equals(Object obj)
|
Key |
getKey()
Returns the key. |
M |
getModel()
Returns the model. |
int |
hashCode()
|
M |
refresh()
Refreshes the model. |
void |
setKey(Key key)
Sets the key. |
void |
setModel(M model)
Sets the model. |
| Methods inherited from class org.slim3.datastore.AbstractModelRef |
|---|
getModelClass, getModelMeta, setModelClass, setModelMeta |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected M model
protected Key key
| Constructor Detail |
|---|
protected ModelRef()
public ModelRef(Class<M> modelClass)
throws NullPointerException
modelClass - the model class
NullPointerException - if the modelClass parameter is null| Method Detail |
|---|
public M getModel()
public void setModel(M model)
throws IllegalArgumentException
model - the model
IllegalArgumentException - if the model is null or if the model does not have a primary
key or if the kind of the key is different from the kind of
ModelMetapublic Key getKey()
public void setKey(Key key)
throws IllegalStateException,
IllegalArgumentException
key - the key
IllegalStateException - if the model is set
IllegalArgumentException - if the kind of the key is different from the kind of
ModelMetapublic M refresh()
public void clear()
ModelRef.
public int hashCode()
hashCode in class Objectpublic boolean equals(Object obj)
equals in class Object
public Key assignKeyIfNecessary(AsyncDatastoreService ds)
throws NullPointerException
ds - the asynchronous datastore service
NullPointerException - if the ds parameter is null
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||