public class ModelWurblet
extends org.wurbelizer.wurblet.AbstractJavaWurblet
AbstractJavaWurblet providing basic functionality for the persistent object model.
The following wurblet options are parsed:
AbstractWurblet.| Constructor and Description |
|---|
ModelWurblet()
Creates a wurblet.
|
| Modifier and Type | Method and Description |
|---|---|
void |
appendCommaSeparated(StringBuilder builder,
String appendStr)
Adds a string to a comma separated list.
|
String |
createDeclaredArgsForSelectOrDeleteMethod(Relation relation)
Creates the method argument declaration for the select or delete method.
|
String |
createListRelationDeleteMethodName(Relation relation)
Creates the method name to select a relation.
|
String |
createRelationSelectMethodName(Relation relation)
Creates the method name to select a relation.
|
String |
deriveClassNameForEntity(Entity otherEntity)
Applies the semantics of
AbstractJavaWurblet.getClassName() to another entity.Example: |
List<String> |
getArgs()
Gets the wurblet arguments.
|
Entity |
getEntity()
Gets the model entity.
|
String |
getMethodName()
Gets the methodname.
From the guardname or from arg "--method=<.....>" if present. |
String |
getModelDirName()
Gets the name of the model directory.
|
String |
getModelName()
Gets the name of the modelfile.
|
String |
getOption(String option)
Gets the option if set.
Options come in two flavours: without a value. |
List<String> |
getOptionArgs()
Gets the wurblet options.
The options got the leading '--' removed. |
String |
getPdoClassName()
Gets the pdo class from the source.
Looks for annotations @DomainObjectService, @PersistentObjectService and interface extensions. |
List<String> |
getWurbletArgs()
Gets the wurblet arguments.
All arguments except the options. |
boolean |
isAttributeDerived(Attribute attribute)
Checks whether attribute is derived from a superclass.
|
boolean |
isGenerified()
Returns whether the class is defined using java generics.
|
boolean |
isIdAttribute(Attribute attribute)
Checks whether attribute is the pdo ID.
|
boolean |
isIdOrSerialAttribute(Attribute attribute)
Checks whether attribute is the pdo ID or serial.
|
boolean |
isInterface()
Returns whether wurblet is defined within an interface.
Only valid if isPdo() returns non-null. |
boolean |
isPartOfInheritanceHierarchy()
Returns whether the entity is part of an inheritance tree.
|
boolean |
isPdo()
Returns whether this is a pdo.
|
boolean |
isRemote()
Returns true if --remote option set.
|
boolean |
isSerialAttribute(Attribute attribute)
Checks whether attribute is the pdo serial.
|
boolean |
isSetGetRequired(Attribute attribute)
Determines whether setter/getter need to be used to access an attribute.
|
List<Entity> |
orderByInheritanceLevelAndClassId(List<Entity> entities)
Sorts the given list of entities by inheritance level plus classid.
|
void |
prependCommaSeparated(StringBuilder builder,
String prependStr)
Prepends a string to a comma separated list.
|
void |
run() |
void |
setRemote(boolean remote)
Sets the remote option explicitly.
|
getClassName, getPackageName, getSuperClassName, isAbstract, isFinal, isPrivate, isProtected, isPublic, toStringpublic String getModelDirName()
public String getPdoClassName() throws org.wurbelizer.wurbel.WurbelException
@DomainObjectService, @PersistentObjectService and interface extensions.org.wurbelizer.wurbel.WurbelException - if pdo class cannot be determined from the source filepublic boolean isPdo()
public boolean isInterface()
public boolean isRemote()
public void setRemote(boolean remote)
remote - true if remoting enabledpublic boolean isPartOfInheritanceHierarchy()
public boolean isGenerified()
Generics are used in abstract inheritable classes. Final concrete PDO classes must not use generics. Otherwise the generated wurblet code will not compile.
public String getMethodName() throws org.wurbelizer.wurbel.WurbelException
org.wurbelizer.wurbel.WurbelException - if no guardnamepublic String getModelName() throws org.wurbelizer.wurbel.WurbelException
org.wurbelizer.wurbel.WurbelException - if model could not be determinedpublic String deriveClassNameForEntity(Entity otherEntity) throws org.wurbelizer.wurbel.WurbelException
AbstractJavaWurblet.getClassName() to another entity.getEntity() -> Firma getClassName() -> "MyFirmaPersistenceImpl" Assumed that otherEntity = Kontakt (which is a superclass of Firma, for example), then: deriveClassNameForEntity(otherEntity) -> "MyKontaktPersistenceImpl"
otherEntity - the other entityorg.wurbelizer.wurbel.WurbelException - if this classname does not contain the entity name as a substringpublic List<Entity> orderByInheritanceLevelAndClassId(List<Entity> entities)
entities - the entitiespublic Entity getEntity()
public List<String> getOptionArgs()
public String getOption(String option)
option - the optionpublic List<String> getWurbletArgs()
public String createRelationSelectMethodName(Relation relation)
relation - the relationpublic String createListRelationDeleteMethodName(Relation relation)
relation - the relationpublic String createDeclaredArgsForSelectOrDeleteMethod(Relation relation) throws ModelException
relation - the relationModelException - if failedpublic void run()
throws org.wurbelizer.wurbel.WurbelException
Overridden to load the map file.
run in interface org.wurbelizer.wurblet.Wurbletrun in class org.wurbelizer.wurblet.AbstractWurbletorg.wurbelizer.wurbel.WurbelException - if running the wurblet failedpublic boolean isIdAttribute(Attribute attribute)
attribute - the attributepublic boolean isSerialAttribute(Attribute attribute)
attribute - the attributepublic boolean isIdOrSerialAttribute(Attribute attribute)
attribute - the attributepublic boolean isAttributeDerived(Attribute attribute)
attribute - the attributepublic boolean isSetGetRequired(Attribute attribute)
attribute - the attributepublic void appendCommaSeparated(StringBuilder builder, String appendStr)
builder - the string builderappendStr - the string to appendpublic void prependCommaSeparated(StringBuilder builder, String prependStr)
builder - the string builderprependStr - the string to prependTentackle - distributed, domain- and model-driven