Package org.tentackle.buildsupport
Class RemoteMethodInfo
- java.lang.Object
-
- org.tentackle.buildsupport.RemoteMethodInfo
-
public class RemoteMethodInfo extends java.lang.ObjectHolds information gathered by the Analyze annotation.The AnalyzeProcessor creates an info file in an apt run and wurblets pick up this information to generate code.
- Author:
- harald
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringINFO_FILE_EXTENSIONall remote method info files end with .remotestatic java.lang.StringINFO_FILE_VERSIONFileformat versionstatic java.lang.StringTYPE_CLASSInformation type for a class.static java.lang.StringTYPE_METHODInformation type for a method.
-
Constructor Summary
Constructors Constructor Description RemoteMethodInfo(java.lang.String type)Creates an RemoteMethodInfo for a given type.RemoteMethodInfo(javax.annotation.processing.ProcessingEnvironment processingEnv, javax.lang.model.element.ExecutableElement methodElement)Creates an RemoteMethodInfo from a method element.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddParameter(RemoteMethodInfoParameter parameter)Adds a formal parameterjava.lang.StringcleanTypeString(java.lang.String type)Simplifies some classnames by removing package names.
Makes generated code better readable.java.lang.StringgetClassName()Gets the name of the class this analyze info is part of.java.lang.StringgetGenericReturnType()Gets the generic return type.java.lang.StringgetMethodName()Gets the method name the annotation belongs to.javax.lang.model.element.Modifier[]getModifiers()Gets the modifiers for the methodjava.lang.StringgetModifiersAsString()Gets the method's modifiers as a stringjava.lang.StringgetNameCollection()Gets the classname for a collection.java.lang.StringgetNameContext()Gets the classname for a domain context.java.lang.StringgetNameCursor()Gets the classname for a cursor.java.lang.StringgetNameDbObject()Gets the classname for a simple db object.java.lang.StringgetNamePdo()Gets the classname for a PDO.java.lang.StringgetNameSession()Gets the classname for a session.RemoteMethodInfoParameter[]getParameters()Gets the formal parameters of the method.java.lang.StringgetReturnType()Gets the return type of the methodjava.lang.StringgetSuperClassName()Gets the name of the superclass this analyze info is part of.java.lang.StringgetType()Gets the type of this analyze info.booleanisModifierSet(javax.lang.model.element.Modifier modifier)Checks whether given modifier is set for the methodbooleanisReturningCursor()Checks whether the method is returning a cursor.booleanisReturningDbObject()Checks whether the method is returning a low-level db object.booleanisReturningDbObjectCollection()Checks whether the method is returning a collection of low-level db objects.booleanisReturningPdo()Checks whether the method is returning a PDO.booleanisReturningPdoCollection()Checks whether the method is returning a collection of PDOs.booleanisReturningPdoCursor()booleanisVarArgsMethod()Returns whether the method has varargs.static RemoteMethodInforeadInfo(java.io.File infoFile)Reads info from an file.static RemoteMethodInforeadInfo(java.io.LineNumberReader reader)Reads info from an line reader.voidsetClassName(java.lang.String className)Sets the classname and the packagename from a given classname.voidsetGenericReturnType(java.lang.String genericReturnType)Sets the generic return type.voidsetMethodName(java.lang.String methodName)Sets the method name the annotation belongs to.voidsetModifiers(javax.lang.model.element.Modifier[] modifiers)Sets the modifiers for the methodvoidsetReturningCursor(boolean returningCursor)Sets whether the method is returning a cursor.voidsetReturningDbObject(boolean returningDbObject)Sets whether the method is returning a low-level db object.voidsetReturningDbObjectCollection(boolean returningDbObjectCollection)Sets whether the method is returning a collection of low-level db objects.voidsetReturningPdo(boolean returningPdo)Sets whether the method is returning a PDO.voidsetReturningPdoCollection(boolean returningPdoCollection)Sets whether the method is returning a collection of PDOs.voidsetReturningPdoCursor(boolean returningPdoCursor)voidsetReturnType(java.lang.String returnType)Sets the return type of the methodvoidsetSuperClassName(java.lang.String superClassName)Sets the classname of the superclass.voidsetVarArgsMethod(boolean varArgsMethod)Sets whether the method has varargs.java.lang.StringtoString()Gets the declaration string.voidwrite(java.io.PrintWriter writer)Writes this object to an info file.
-
-
-
Field Detail
-
INFO_FILE_VERSION
public static final java.lang.String INFO_FILE_VERSION
Fileformat version- See Also:
- Constant Field Values
-
INFO_FILE_EXTENSION
public static final java.lang.String INFO_FILE_EXTENSION
all remote method info files end with .remote- See Also:
- Constant Field Values
-
TYPE_METHOD
public static final java.lang.String TYPE_METHOD
Information type for a method.- See Also:
- Constant Field Values
-
TYPE_CLASS
public static final java.lang.String TYPE_CLASS
Information type for a class.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
RemoteMethodInfo
public RemoteMethodInfo(java.lang.String type) throws java.io.IOExceptionCreates an RemoteMethodInfo for a given type. Used when reading from infofile.- Parameters:
type- one of TYPE_...- Throws:
java.io.IOException- if unsupported TYPE_...
-
RemoteMethodInfo
public RemoteMethodInfo(javax.annotation.processing.ProcessingEnvironment processingEnv, javax.lang.model.element.ExecutableElement methodElement) throws java.io.IOExceptionCreates an RemoteMethodInfo from a method element. Used during apt processing.- Parameters:
processingEnv- the annotation processor's environmentmethodElement- the ExecutableElement to create an info from- Throws:
java.io.IOException- if some I/O error occurs
-
-
Method Detail
-
readInfo
public static RemoteMethodInfo readInfo(java.io.File infoFile) throws java.io.IOException
Reads info from an file.- Parameters:
infoFile- the file to read from- Returns:
- an RemoteMethodInfo object, null if file is empty or does not contain an RemoteMethodInfo-text
- Throws:
java.io.IOException- if reading failed
-
readInfo
public static RemoteMethodInfo readInfo(java.io.LineNumberReader reader) throws java.io.IOException
Reads info from an line reader.- Parameters:
reader- is the LineNumberReader- Returns:
- an RemoteMethodInfo object, null if file is empty or does not contain an RemoteMethodInfo-text
- Throws:
java.io.IOException- if reading failed
-
getNameCollection
public java.lang.String getNameCollection()
Gets the classname for a collection.- Returns:
- the classname
-
getNameSession
public java.lang.String getNameSession()
Gets the classname for a session.- Returns:
- the classname
-
getNameDbObject
public java.lang.String getNameDbObject()
Gets the classname for a simple db object.- Returns:
- the classname
-
getNameCursor
public java.lang.String getNameCursor()
Gets the classname for a cursor.- Returns:
- the classname
-
getNameContext
public java.lang.String getNameContext()
Gets the classname for a domain context.- Returns:
- the classname
-
getNamePdo
public java.lang.String getNamePdo()
Gets the classname for a PDO.- Returns:
- the classname
-
getType
public java.lang.String getType()
Gets the type of this analyze info.- Returns:
- the type
-
getClassName
public java.lang.String getClassName()
Gets the name of the class this analyze info is part of.- Returns:
- the classname
-
setClassName
public void setClassName(java.lang.String className)
Sets the classname and the packagename from a given classname.- Parameters:
className- the full class name
-
getSuperClassName
public java.lang.String getSuperClassName()
Gets the name of the superclass this analyze info is part of.- Returns:
- the classname
-
setSuperClassName
public void setSuperClassName(java.lang.String superClassName)
Sets the classname of the superclass.- Parameters:
superClassName- the full class name
-
getMethodName
public java.lang.String getMethodName()
Gets the method name the annotation belongs to.- Returns:
- the method name
-
setMethodName
public void setMethodName(java.lang.String methodName)
Sets the method name the annotation belongs to.- Parameters:
methodName- the method name
-
getReturnType
public java.lang.String getReturnType()
Gets the return type of the method- Returns:
- the return type
-
setReturnType
public void setReturnType(java.lang.String returnType)
Sets the return type of the method- Parameters:
returnType- the return type
-
getGenericReturnType
public java.lang.String getGenericReturnType()
Gets the generic return type.- Returns:
- the generic type, null or empty if none
-
setGenericReturnType
public void setGenericReturnType(java.lang.String genericReturnType)
Sets the generic return type.- Parameters:
genericReturnType- the generic type, null or empty if none
-
getParameters
public RemoteMethodInfoParameter[] getParameters()
Gets the formal parameters of the method.- Returns:
- the array of parameters
-
addParameter
public void addParameter(RemoteMethodInfoParameter parameter)
Adds a formal parameter- Parameters:
parameter- the formal parameter to add
-
isVarArgsMethod
public boolean isVarArgsMethod()
Returns whether the method has varargs.- Returns:
- true if varargs method
-
setVarArgsMethod
public void setVarArgsMethod(boolean varArgsMethod)
Sets whether the method has varargs.- Parameters:
varArgsMethod- true if varargs method
-
getModifiers
public javax.lang.model.element.Modifier[] getModifiers()
Gets the modifiers for the method- Returns:
- the array of modifiers
-
getModifiersAsString
public java.lang.String getModifiersAsString()
Gets the method's modifiers as a string- Returns:
- the modifiers as a string
-
isModifierSet
public boolean isModifierSet(javax.lang.model.element.Modifier modifier)
Checks whether given modifier is set for the method- Parameters:
modifier- the modifier to test- Returns:
- true if modifier set
-
setModifiers
public void setModifiers(javax.lang.model.element.Modifier[] modifiers)
Sets the modifiers for the method- Parameters:
modifiers- for the method
-
isReturningDbObject
public boolean isReturningDbObject()
Checks whether the method is returning a low-level db object.- Returns:
- true if method returns a DbObject.
-
setReturningDbObject
public void setReturningDbObject(boolean returningDbObject)
Sets whether the method is returning a low-level db object.- Parameters:
returningDbObject- true if method returns a DbObject.
-
isReturningDbObjectCollection
public boolean isReturningDbObjectCollection()
Checks whether the method is returning a collection of low-level db objects.- Returns:
- true if method returns a collection of DbObjects.
-
setReturningDbObjectCollection
public void setReturningDbObjectCollection(boolean returningDbObjectCollection)
Sets whether the method is returning a collection of low-level db objects.- Parameters:
returningDbObjectCollection- true if method returns a collection of DbObjects.
-
isReturningCursor
public boolean isReturningCursor()
Checks whether the method is returning a cursor.- Returns:
- true if method returns a cursor
-
setReturningCursor
public void setReturningCursor(boolean returningCursor)
Sets whether the method is returning a cursor.- Parameters:
returningCursor- true if method returns a cursor
-
isReturningPdoCursor
public boolean isReturningPdoCursor()
-
setReturningPdoCursor
public void setReturningPdoCursor(boolean returningPdoCursor)
-
isReturningPdo
public boolean isReturningPdo()
Checks whether the method is returning a PDO.- Returns:
- true if method returns a PDO.
-
setReturningPdo
public void setReturningPdo(boolean returningPdo)
Sets whether the method is returning a PDO.- Parameters:
returningPdo- true if method returns a PDO
-
isReturningPdoCollection
public boolean isReturningPdoCollection()
Checks whether the method is returning a collection of PDOs.- Returns:
- true if method returns a collection of PDOs.
-
setReturningPdoCollection
public void setReturningPdoCollection(boolean returningPdoCollection)
Sets whether the method is returning a collection of PDOs.- Parameters:
returningPdoCollection- true if method returns a collection of PDOs.
-
toString
public java.lang.String toString()
Gets the declaration string.- Overrides:
toStringin classjava.lang.Object
-
write
public void write(java.io.PrintWriter writer) throws java.io.IOExceptionWrites this object to an info file.- Parameters:
writer- is the PrintWriter object- Throws:
java.io.IOException- if write failed
-
cleanTypeString
public java.lang.String cleanTypeString(java.lang.String type)
Simplifies some classnames by removing package names.
Makes generated code better readable. Can be used by wurblets.- Parameters:
type- the full type- Returns:
- the shortened type
-
-