GeneralFactory Class
general factory class
create instance of model
Item Index
Methods
create
-
modelName
-
root
create a factory. If specific factory is defined, return the instance. Otherwise, return instance of GeneralFactory. This method is not suitable for creating collections, thus only called by Repository, which handles Entity (= non-collection).
Parameters:
-
modelName
String -
root
RootInterface
Returns:
createCollection
-
collModelName
-
val
-
[options]
create collection
Parameters:
-
collModelName
Stringmodel name of collection
-
val
Any -
[options]
Object optional
Returns:
dict
createDict
-
dictModelName
-
val
-
[options]
create model dict
Parameters:
-
dictModelName
Stringmodel name of dict
-
val
Any -
[options]
Object optional-
[include]
Object optionaloptions to pass to Includer
-
[async=false]
Object optionalinclude sub-entities asynchronously if true. -
[props]
Array(String) optionalinclude sub-entities of given props
-
-
Returns:
dict
createFromObject
-
obj
-
[options={}]
create instance of model class by plain object
for each prop, values are set by Model#set(prop, value)
Parameters:
-
obj
Object -
[options={}]
Object optional-
[include]
Object optionaloptions to pass to Includer
-
[async=false]
Object optionalinclude sub-entities asynchronously if true. -
[props]
Array(String) optionalinclude sub-entities of given props
-
-
Returns:
model
createList
-
listModelName
-
val
-
[options]
create model list
Parameters:
-
listModelName
Stringmodel name of list
-
val
Any -
[options]
Object optional-
[include]
Object optionaloptions to pass to Includer
-
[async=false]
Object optionalinclude sub-entities asynchronously if true. -
[props]
Array(String) optionalinclude sub-entities of given props
-
-
Returns:
list
createModel
-
modelName
-
obj
-
[options]
-
root
create an instance of the given modelName using obj if obj is null, return null if obj is undefined, empty object is created.
Parameters:
-
modelName
String -
obj
Object -
[options]
Object optional-
[include]
Object optionaloptions to pass to Includer
-
[async=false]
Object optionalinclude sub-entities asynchronously if true. -
[props]
Array(String) optionalinclude sub-entities of given props
-
-
-
root
RootInterface
Returns:
getModelClass
()
Function
get model class this factory handles
Returns:
include
-
model
-
[includeOptions]
include submodels
Parameters:
-
model
BaseModel -
[includeOptions]
Object optional-
[async=false]
Object optionalinclude submodels asynchronously
-
[props]
Array(String) optionalinclude submodels of given props
-