Package org.tentackle.buildsupport
Class RemoteMethodInfo
java.lang.Object
org.tentackle.buildsupport.RemoteMethodInfo
Holds 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 -
Constructor Summary
ConstructorsConstructorDescriptionRemoteMethodInfo(String type) Creates an RemoteMethodInfo for a given type.RemoteMethodInfo(ProcessingEnvironment processingEnv, ExecutableElement methodElement) Creates an RemoteMethodInfo from a method element. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddParameter(RemoteMethodInfoParameter parameter) Adds a formal parametercleanTypeString(String type) Simplifies some classnames by removing package names.
Makes generated code better readable.Gets the name of the class this analyze-info is part of.Gets the generic return type.Gets the method name the annotation belongs to.Modifier[]Gets the modifiers for the methodGets the method's modifiers as a stringGets the classname for a collection.Gets the classname for a domain context.Gets the classname for a cursor.Gets the classname for a simple db object.Gets the classname for a PDO.Gets the classname for a session.Gets the formal parameters of the method.Gets the return type of the methodGets the name of the superclass this analyze-info is part of.getType()Gets the type of this analyze info.booleanisModifierSet(Modifier modifier) Checks whether given modifier is set for the methodbooleanChecks whether the method is returning a cursor.booleanChecks whether the method is returning a low-level db object.booleanChecks whether the method is returning a collection of low-level db objects.booleanChecks whether the method is returning a PDO.booleanChecks whether the method is returning a collection of PDOs.booleanbooleanReturns whether the method has varargs.static RemoteMethodInfoReads info from a file.static RemoteMethodInforeadInfo(LineNumberReader reader) Reads info from a line reader.voidsetClassName(String className) Sets the classname and the packagename from a given classname.voidsetGenericReturnType(String genericReturnType) Sets the generic return type.voidsetMethodName(String methodName) Sets the method name the annotation belongs to.voidsetModifiers(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(String returnType) Sets the return type of the methodvoidsetSuperClassName(String superClassName) Sets the classname of the superclass.voidsetVarArgsMethod(boolean varArgsMethod) Sets whether the method has varargs.toString()Gets the declaration string.voidwrite(PrintWriter writer) Writes this object to an info file.
-
Field Details
-
INFO_FILE_VERSION
File-format version- See Also:
-
INFO_FILE_EXTENSION
all remote method info files end with .remote- See Also:
-
TYPE_METHOD
Information type for a method.- See Also:
-
TYPE_CLASS
Information type for a class.- See Also:
-
-
Constructor Details
-
RemoteMethodInfo
Creates an RemoteMethodInfo for a given type. Used when reading from infofile.- Parameters:
type- one of TYPE_...- Throws:
IOException- if unsupported TYPE_...
-
RemoteMethodInfo
public RemoteMethodInfo(ProcessingEnvironment processingEnv, ExecutableElement methodElement) throws IOException Creates 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:
IOException- if some I/O error occurs
-
-
Method Details
-
readInfo
Reads info from a 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:
IOException- if reading failed
-
readInfo
Reads info from a line reader.- Parameters:
reader- is the LineNumberReader- Returns:
- an RemoteMethodInfo object, null if file is empty or does not contain an RemoteMethodInfo-text
- Throws:
IOException- if reading failed
-
getNameCollection
Gets the classname for a collection.- Returns:
- the classname
-
getNameSession
Gets the classname for a session.- Returns:
- the classname
-
getNameDbObject
Gets the classname for a simple db object.- Returns:
- the classname
-
getNameCursor
Gets the classname for a cursor.- Returns:
- the classname
-
getNameContext
Gets the classname for a domain context.- Returns:
- the classname
-
getNamePdo
Gets the classname for a PDO.- Returns:
- the classname
-
getType
Gets the type of this analyze info.- Returns:
- the type
-
getClassName
Gets the name of the class this analyze-info is part of.- Returns:
- the classname
-
setClassName
Sets the classname and the packagename from a given classname.- Parameters:
className- the full class name
-
getSuperClassName
Gets the name of the superclass this analyze-info is part of.- Returns:
- the classname
-
setSuperClassName
Sets the classname of the superclass.- Parameters:
superClassName- the full class name
-
getMethodName
Gets the method name the annotation belongs to.- Returns:
- the method name
-
setMethodName
Sets the method name the annotation belongs to.- Parameters:
methodName- the method name
-
getReturnType
Gets the return type of the method- Returns:
- the return type
-
setReturnType
Sets the return type of the method- Parameters:
returnType- the return type
-
getGenericReturnType
Gets the generic return type.- Returns:
- the generic type, null or empty if none
-
setGenericReturnType
Sets the generic return type.- Parameters:
genericReturnType- the generic type, null or empty if none
-
getParameters
Gets the formal parameters of the method.- Returns:
- the array of parameters
-
addParameter
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
Gets the modifiers for the method- Returns:
- the array of modifiers
-
getModifiersAsString
Gets the method's modifiers as a string- Returns:
- the modifiers as a string
-
isModifierSet
Checks whether given modifier is set for the method- Parameters:
modifier- the modifier to test- Returns:
- true if modifier set
-
setModifiers
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 an AbstractDbObject
-
setReturningDbObject
public void setReturningDbObject(boolean returningDbObject) Sets whether the method is returning a low-level db object.- Parameters:
returningDbObject- true if method returns an AbstractDbObject
-
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 AbstractDbObjects
-
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 AbstractDbObjects
-
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
Gets the declaration string. -
write
Writes this object to an info file.- Parameters:
writer- is the PrintWriter object- Throws:
IOException- if write failed
-
cleanTypeString
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
-