Class RemoteMethodInfo

java.lang.Object
org.tentackle.buildsupport.RemoteMethodInfo

public class RemoteMethodInfo extends Object
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 Details

  • Constructor Details

    • RemoteMethodInfo

      public RemoteMethodInfo(String type) throws IOException
      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 environment
      methodElement - the ExecutableElement to create an info from
      Throws:
      IOException - if some I/O error occurs
  • Method Details

    • readInfo

      public static RemoteMethodInfo readInfo(File infoFile) throws 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:
      IOException - if reading failed
    • readInfo

      public static RemoteMethodInfo readInfo(LineNumberReader reader) throws 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:
      IOException - if reading failed
    • getNameCollection

      public String getNameCollection()
      Gets the classname for a collection.
      Returns:
      the classname
    • getNameSession

      public String getNameSession()
      Gets the classname for a session.
      Returns:
      the classname
    • getNameDbObject

      public String getNameDbObject()
      Gets the classname for a simple db object.
      Returns:
      the classname
    • getNameCursor

      public String getNameCursor()
      Gets the classname for a cursor.
      Returns:
      the classname
    • getNameContext

      public String getNameContext()
      Gets the classname for a domain context.
      Returns:
      the classname
    • getNamePdo

      public String getNamePdo()
      Gets the classname for a PDO.
      Returns:
      the classname
    • getType

      public String getType()
      Gets the type of this analyze info.
      Returns:
      the type
    • getClassName

      public String getClassName()
      Gets the name of the class this analyze info is part of.
      Returns:
      the classname
    • setClassName

      public void setClassName(String className)
      Sets the classname and the packagename from a given classname.
      Parameters:
      className - the full class name
    • getSuperClassName

      public String getSuperClassName()
      Gets the name of the superclass this analyze info is part of.
      Returns:
      the classname
    • setSuperClassName

      public void setSuperClassName(String superClassName)
      Sets the classname of the superclass.
      Parameters:
      superClassName - the full class name
    • getMethodName

      public String getMethodName()
      Gets the method name the annotation belongs to.
      Returns:
      the method name
    • setMethodName

      public void setMethodName(String methodName)
      Sets the method name the annotation belongs to.
      Parameters:
      methodName - the method name
    • getReturnType

      public String getReturnType()
      Gets the return type of the method
      Returns:
      the return type
    • setReturnType

      public void setReturnType(String returnType)
      Sets the return type of the method
      Parameters:
      returnType - the return type
    • getGenericReturnType

      public String getGenericReturnType()
      Gets the generic return type.
      Returns:
      the generic type, null or empty if none
    • setGenericReturnType

      public void setGenericReturnType(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 Modifier[] getModifiers()
      Gets the modifiers for the method
      Returns:
      the array of modifiers
    • getModifiersAsString

      public String getModifiersAsString()
      Gets the method's modifiers as a string
      Returns:
      the modifiers as a string
    • isModifierSet

      public boolean isModifierSet(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(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 String toString()
      Gets the declaration string.

      Overrides:
      toString in class Object
    • write

      public void write(PrintWriter writer) throws IOException
      Writes this object to an info file.
      Parameters:
      writer - is the PrintWriter object
      Throws:
      IOException - if write failed
    • cleanTypeString

      public String cleanTypeString(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