|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectTypeHelper
org.objectweb.jorm.generator.lib.CommonHelper
This class is a helper for the generation. All methods provided in this class are shortcut or facilties which simplify the generation.
Field Summary | |
protected boolean |
debug
|
protected Logger |
logger
|
protected LoggerFactory |
loggerFactory
|
static PType[] |
PN_GET_TYPES
|
Constructor Summary | |
CommonHelper()
|
Method Summary | |
PrimitiveElementMapping[] |
buildPemList(java.util.Collection pemcoll)
|
boolean |
canBeNullValue(PType type)
|
java.lang.String |
comparePE(java.lang.String val1,
java.lang.String val2,
PType type)
|
boolean |
containsCharArrayField(Mapping m)
This method tests if a class contains a char[] field. |
boolean |
containsCompositeName(Mapping mo)
This method allows to know if a class represented by its Class meta object, contains a composite PName. |
boolean |
containsFieldWhichCanBeNull(Class co)
This method tests if a class contains a serialized field. |
boolean |
containsGenClassRef(Class co)
This method tests if a class references to a generic class. |
boolean |
containsReference(Class co)
This method tests if a class contains a reference. |
boolean |
containsSerializedField(Class co)
This method tests if a class contains a serialized field. |
java.lang.String |
debug(java.lang.String msg)
|
java.lang.String |
getCNPackageName(MetaObject mo)
This method retrieve the package name for the meta object passed as parameter. |
java.lang.String |
getCoderName(PType t)
|
java.util.Collection |
getCompositeNameDefEntries(NameDef mo)
This method provides an iterator over the map entries which associated a composite field name (key) to the class field name (value). |
java.util.ArrayList |
getCompositeReferences(Mapping mo)
This method return a list containing the nameref implied in composite reference field |
java.lang.String |
getCTDeclaration(PType t)
|
java.lang.String |
getFQNOfCompositeName(java.lang.Object o)
|
java.lang.String |
getInheritedClasses(Class c)
This method is a helper to reach the getInheritedClasses(Class, HashMap) method. |
Logger |
getLogger()
Its retrives the current logger. |
LoggerFactory |
getLoggerFactory()
Its retrives the current logger factory. |
java.lang.String |
getPaGetMethod(PType pt)
This method does the conversion between a PType @pt and the getter function to use on a PAccessorGen (generic accessor). |
java.lang.String |
getPaSetMethod(PType pt)
This method does the conversion between a PType @pt and the setter function to use on a PAccessorGen (generic accessor). |
int |
getPemPos(PrimitiveElementMapping[] pemlist,
PrimitiveElement pe)
|
java.lang.String |
getPNameDecodeFunction(PType pt)
This method permits to find the right decode function either the PType specified by the parameter @pt. |
java.lang.String |
getPNameEncodeFunction(PType pt)
This method permits to find the right encode function either the PType specified by the parameter @pt. |
java.lang.String |
getPNameGetterGetFunction(PType pt)
This method permits to find the right pngetXField function either the PType specified by the parameter @pt. |
PType[] |
getPNGTypes()
|
PrimitiveElement |
getPrimitiveElement(java.lang.Object mo,
Class c,
boolean canBeFieldName)
This method allow to retrieve a primitive element from th meta object mo. |
PrimitiveElement |
getPrimitiveElement(java.lang.String fn,
Class cl)
|
java.lang.String |
getProjectionField(NameDef nd,
java.lang.String cfn)
This method provides the projection of the field name belonging to the class over a field name belonging to the composite name corresponding definition. |
PType |
getPType(java.lang.String ptn)
|
PType |
getPTypeBigDecimal()
Its retrieves the PType object which represents the BigDecimal jorm type. |
PType |
getPTypeBigInteger()
Its retrieves the PType object which represents the BigInteger jorm type. |
PType |
getPTypeBoolean()
Its retrieves the PType object which represents the boolean jorm type. |
PType |
getPTypeByte()
Its retrieves the PType object which represents the byte jorm type. |
PType |
getPTypeByteArray()
Its retrieves the PType object which represents the bytearray jorm type. |
PType |
getPTypeChar()
Its retrieves the PType object which represents the char jorm type. |
PType |
getPTypeCharArray()
Its retrieves the PType object which represents the chararray jorm type. |
PType |
getPTypeDate()
Its retrieves the PType object which represents the date jorm type. |
PType |
getPTypeDouble()
Its retrieves the PType object which represents the double jorm type. |
PType |
getPTypeFloat()
Its retrieves the PType object which represents the float jorm type. |
PType |
getPTypeInt()
Its retrieves the PType object which represents the int jorm type. |
PType |
getPTypeLong()
Its retrieves the PType object which represents the long jorm type. |
PType |
getPTypeOboolean()
Its retrieves the PType object which represents the Boolean jorm type. |
PType |
getPTypeObyte()
Its retrieves the PType object which represents the Byte jorm type. |
PType |
getPTypeOchar()
Its retrieves the PType object which represents the Character jorm type. |
PType |
getPTypeOdouble()
Its retrieves the PType object which represents the Double jorm type. |
PType |
getPTypeOfloat()
Its retrieves the PType object which represents the Float jorm type. |
PType |
getPTypeOint()
Its retrieves the PType object which represents the Integer jorm type. |
PType |
getPTypeOlong()
Its retrieves the PType object which represents the Long jorm type. |
PType |
getPTypeOshort()
Its retrieves the PType object which represents the Short jorm type. |
PType |
getPTypeReference()
Its retrieves the PType object which represents a reference. |
PType |
getPTypeSerialized()
Its retrieves the PType object which represents the serialized jorm type. |
PType |
getPTypeShort()
Its retrieves the PType object which represents the short jorm type. |
java.lang.String |
getPTypeSpaceFieldName(PType pt)
Retrieves the name of the static field of the interface PTypeSpace corresponding to a PType. |
PType |
getPTypeString()
Its retrieves the PType object which represents the string jorm type. |
NameDef |
getRefNameDef(Mapping mo,
Reference field)
|
java.lang.String |
getTupleDecoding(java.lang.String fn,
PType pt,
java.lang.String value)
|
java.lang.String |
getTupleDecoding(java.lang.String tmpv,
java.lang.String fn,
java.lang.String tuplevn,
PType pt,
int pos)
Builds the string representing the expression to decode a PName wrt the relevant tuple field having the right type. |
java.lang.String |
getTupleGetter(java.lang.String tuplevn,
PType pt,
int pos)
Builds the string representing the expression to access the relevant tuple field having the right type. |
boolean |
isCharArrayType(PType t)
This method checks if the PType parameter designs a Serialized type. |
boolean |
isClass(java.lang.Object o)
This method checks if the parameter is an instance of org.objectweb.jorm.metainfo.api.Class |
boolean |
isClassRef(TypedElement te)
This method checks if the parameter is an instance of org.objectweb.jorm.metainfo.api.ClassRef |
boolean |
isCompositeName(NameDef nd)
This method checks if the NameDef is composed by several fields. |
boolean |
isFieldName(java.lang.Object o)
This method checks if the parameter is an instance of org.objectweb.jorm.metainfo.api.FieldName |
boolean |
isGenClassRef(TypedElement te)
This method checks if the parameter is an instance of org.objectweb.jorm.metainfo.api.GenClassRef |
boolean |
isHiddenField(PrimitiveElement pe)
This method checks if the parameter is an instance of org.objectweb.jorm.metainfo.api.PrimitiveElement |
boolean |
isNull(java.lang.Object o)
|
boolean |
isPrimitiveElement(java.lang.Object o)
This method checks if the parameter is an instance of org.objectweb.jorm.metainfo.api.PrimitiveElement |
boolean |
isReference(TypedElement te)
This method checks if the parameter is an instance of org.objectweb.jorm.metainfo.api.Reference |
boolean |
isSerializedField(java.lang.Object o)
This method checks if the parameter designs a Serialized field. |
boolean |
isSerializedType(PType t)
This method checks if the PType parameter designs a Serialized type. |
boolean |
isValidString(java.lang.String str)
This method tests if a String is valid. |
java.lang.String |
log(java.lang.String msg)
|
boolean |
not(boolean b)
|
void |
setLogger(Logger l)
Its assigns a logger. |
void |
setLoggerFactory(LoggerFactory lf)
Its assigns a logger factory. |
java.lang.String |
upperFL(java.lang.String word)
This methods returns the word specified in parameter with the first character in upper-case. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected LoggerFactory loggerFactory
protected Logger logger
protected boolean debug
public static final PType[] PN_GET_TYPES
Constructor Detail |
public CommonHelper()
Method Detail |
public java.lang.String upperFL(java.lang.String word)
word
- The String which the first character must be set in
upper-case
public PrimitiveElement getPrimitiveElement(java.lang.Object mo, Class c, boolean canBeFieldName) throws PException
mo
- the meta object embeding the primitive elementc
- the class embeding the meta object mo
PException
public boolean containsReference(Class co)
co
- The meta object Class
public java.util.ArrayList getCompositeReferences(Mapping mo) throws java.lang.Exception
mo
- The meta object Mapping to be analysed.
java.lang.Exception
public java.lang.String getCNPackageName(MetaObject mo)
mo
- The meta object
public boolean containsSerializedField(Class co)
co
- The meta object Class
public boolean containsCharArrayField(Mapping m)
m
- The meta object Mapping
public boolean containsFieldWhichCanBeNull(Class co) throws PException
co
- The meta object Class
PException
public boolean isValidString(java.lang.String str)
str
- The string which must be checked
public boolean containsGenClassRef(Class co)
co
- The meta object Class
public boolean isCompositeName(NameDef nd)
nd
- the meta object NameDef which must be tested
public java.util.Collection getCompositeNameDefEntries(NameDef mo) throws java.lang.Exception
mo
- the meta object NameDef which must be used
java.lang.Exception
public java.lang.String getFQNOfCompositeName(java.lang.Object o)
public boolean containsCompositeName(Mapping mo)
mo
- the Mapping which must analyzedpublic boolean isClass(java.lang.Object o)
o
- the object which the type must be checked
public boolean isReference(TypedElement te)
te
- the object which the type must be checked
public boolean isClassRef(TypedElement te)
te
- the object which the type must be checked
public boolean isGenClassRef(TypedElement te)
te
- the object which the type must be checked
public boolean isPrimitiveElement(java.lang.Object o)
o
- the object which the type must be checked
public java.lang.String comparePE(java.lang.String val1, java.lang.String val2, PType type)
val1
- the variable name of the first elementval2
- the variable name of the second elementtype
- the type of the elements
public boolean isNull(java.lang.Object o)
public boolean isHiddenField(PrimitiveElement pe)
pe
- the object which the type must be checked
public boolean isFieldName(java.lang.Object o)
o
- the object which the type must be checked
public boolean isSerializedField(java.lang.Object o)
o
- the object which the type must be checked
public boolean isSerializedType(PType t)
t
- the PType object which the type must be checked
public boolean isCharArrayType(PType t)
t
- the PType object which the type must be checked
public PrimitiveElementMapping[] buildPemList(java.util.Collection pemcoll)
public int getPemPos(PrimitiveElementMapping[] pemlist, PrimitiveElement pe) throws PExceptionCompiler
PExceptionCompiler
public PrimitiveElement getPrimitiveElement(java.lang.String fn, Class cl) throws PExceptionCompiler
PExceptionCompiler
public NameDef getRefNameDef(Mapping mo, Reference field) throws PException
PException
public java.lang.String getTupleDecoding(java.lang.String fn, PType pt, java.lang.String value) throws PException
PException
public java.lang.String getTupleDecoding(java.lang.String tmpv, java.lang.String fn, java.lang.String tuplevn, PType pt, int pos) throws PException
tmpv
- The temporary variable that holds the tuple field value.fn
- The name of the involved application field.tuplevn
- The variable name that holds the corresponding tuple.pt
- The PType of the associated field.pos
- The position of the tuple field into this tuple.
PException
public java.lang.String getTupleGetter(java.lang.String tuplevn, PType pt, int pos) throws PException
tuplevn
- The variable name that holds the corresponding tuple.pt
- The PType of the associated field.pos
- The position of the tuple field into this tuple.
PException
public java.lang.String getPaGetMethod(PType pt) throws PException
pt
- the ptype which helps to find the right paccessor method
PException
public java.lang.String getPaSetMethod(PType pt) throws PException
pt
- the ptype which helps to find the right paccessor method
PException
public java.lang.String getPNameDecodeFunction(PType pt) throws PException
pt
- the ptype which helps to find the right decode method
PException
public java.lang.String getCoderName(PType t)
public java.lang.String getPNameGetterGetFunction(PType pt) throws PException
pt
- the ptype which helps to find the right pname getter method
PException
public java.lang.String getPNameEncodeFunction(PType pt) throws PException
pt
- the ptype which helps to find the right encode method
PException
public java.lang.String getCTDeclaration(PType t)
public java.lang.String getProjectionField(NameDef nd, java.lang.String cfn) throws java.lang.Exception
nd
- the meta object NameDef embeding a nameref with a projection.cfn
- the field name belonging to the pname in the class.
java.lang.Exception
public PType getPType(java.lang.String ptn)
public PType getPTypeBoolean()
public PType getPTypeOboolean()
public PType getPTypeChar()
public PType getPTypeOchar()
public PType getPTypeByte()
public PType getPTypeObyte()
public PType getPTypeShort()
public PType getPTypeOshort()
public PType getPTypeInt()
public PType getPTypeOint()
public PType getPTypeLong()
public PType getPTypeOlong()
public PType getPTypeFloat()
public PType getPTypeOfloat()
public PType getPTypeDouble()
public PType getPTypeOdouble()
public PType getPTypeString()
public PType getPTypeDate()
public PType getPTypeCharArray()
public PType getPTypeByteArray()
public PType getPTypeSerialized()
public PType getPTypeBigInteger()
public PType getPTypeBigDecimal()
public PType getPTypeReference()
public PType[] getPNGTypes()
public boolean not(boolean b)
public boolean canBeNullValue(PType type) throws PException
PException
public java.lang.String getInheritedClasses(Class c)
public java.lang.String log(java.lang.String msg)
public java.lang.String debug(java.lang.String msg)
public java.lang.String getPTypeSpaceFieldName(PType pt)
public void setLoggerFactory(LoggerFactory lf)
setLoggerFactory
in interface Loggable
lf
- the LoggerFactory object to obtain new loggerspublic void setLogger(Logger l)
setLogger
in interface Loggable
l
- the logger objectpublic Logger getLogger()
getLogger
in interface Loggable
public LoggerFactory getLoggerFactory()
getLoggerFactory
in interface Loggable
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |