Cantaloop CGimlet - API Documentation, Version: 0.2.0, Date: 2002-05-13 21:30 CEST

org.cantaloop.cgimlet.lang.java
Class JUtils

java.lang.Object
  |
  +--org.cantaloop.cgimlet.lang.AbstractUtils
        |
        +--org.cantaloop.cgimlet.lang.java.JUtils
All Implemented Interfaces:
CGUtils

public class JUtils
extends AbstractUtils

Version:
0.2.0 ($Revision: 1.3 $)
Author:
David Leuschner, Stefan Heimann

Method Summary
 java.lang.String callReturn(java.lang.String expr)
          Generates a return statement that returns expr.
 java.lang.String callSet(java.lang.String var, java.lang.String property, java.lang.String value)
          Generate a statement for calling a set method.
static CGUtils getInstance()
           
 MethodTemplate getter(java.lang.String externalName, FieldTemplate field)
          Factory method that returns a template for a get-method.
 java.lang.String invoke(java.lang.String methodName, java.lang.String[] params)
          Returns a statement that invokes the method named methodName with the given parameters.
 java.lang.String invokeExpr(java.lang.String methodName, java.lang.String[] params)
          Returns a expression that invokes the method named methodName with the given parameters.
 java.lang.String invokeOn(java.lang.String varName, java.lang.String methodName, java.lang.String[] params)
          Returns a statement that invokes the method named methodName with the given parameters.
 java.lang.String invokeOnExpr(java.lang.String varName, java.lang.String methodName, java.lang.String[] params)
          Returns a expression that invokes the method named methodName with the given parameters.
 java.lang.String mapPut(java.lang.String mapName, java.lang.String key, java.lang.String value)
          Returns a statement that invokes the put method on the map named mapName with the given key and value.
 java.lang.String newInstance(Type interfaceType, java.lang.String name, Type implementationType)
          Creates a statement that icreates a instance of implType and stores that instance in the variable name.
 MethodTemplate setter(java.lang.String externalName, FieldTemplate field)
          Factory method that returns a template for a set-method.
 java.lang.String toIdentifier(java.lang.String s, boolean capitalize)
          Convert s into an indentifier.
 
Methods inherited from class org.cantaloop.cgimlet.lang.AbstractUtils
caseConcat, caseConcat, caseConcat, getter, invoke, invoke, invoke, invokeExpr, invokeExpr, invokeExpr, invokeOn, invokeOn, invokeOn, invokeOnExpr, invokeOnExpr, invokeOnExpr, makeClassName, mapPut, mapStrPut, mapStrPut, newInstance, nonfinalToFinalIdentifier, quote, setter, sprintf, sprintf, sprintf, sprintf, stringToBoolean, toFinalIdentifier, toIdentifier
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static final CGUtils getInstance()

newInstance

public java.lang.String newInstance(Type interfaceType,
                                    java.lang.String name,
                                    Type implementationType)
Description copied from interface: CGUtils
Creates a statement that icreates a instance of implType and stores that instance in the variable name. The type of this variable is determined by the interfaceType parameter.

callSet

public java.lang.String callSet(java.lang.String var,
                                java.lang.String property,
                                java.lang.String value)
Description copied from interface: CGUtils
Generate a statement for calling a set method.
Following copied from interface: org.cantaloop.cgimlet.lang.CGUtils
Parameters:
var - the name of the variable on which to invoke the method
property - the name of the property that should be set.
value - the value to which the property should be set to.
Returns:
a String value

toIdentifier

public java.lang.String toIdentifier(java.lang.String s,
                                     boolean capitalize)
Description copied from interface: CGUtils
Convert s into an indentifier. Whitespace characters and '-' are treated as word bounderies and converted accordingly to the coding conventions of the programming language.
Following copied from interface: org.cantaloop.cgimlet.lang.CGUtils
Parameters:
s - the string to convert.
capitalize - specify if the first letter should be capitalized or not.
Returns:
a String value
Throws:
CodeGenerationException - if s cannot be converted properly

mapPut

public java.lang.String mapPut(java.lang.String mapName,
                               java.lang.String key,
                               java.lang.String value)
Description copied from interface: CGUtils
Returns a statement that invokes the put method on the map named mapName with the given key and value.

invokeExpr

public java.lang.String invokeExpr(java.lang.String methodName,
                                   java.lang.String[] params)
Description copied from interface: CGUtils
Returns a expression that invokes the method named methodName with the given parameters.

invoke

public java.lang.String invoke(java.lang.String methodName,
                               java.lang.String[] params)
Description copied from interface: CGUtils
Returns a statement that invokes the method named methodName with the given parameters.

invokeOnExpr

public java.lang.String invokeOnExpr(java.lang.String varName,
                                     java.lang.String methodName,
                                     java.lang.String[] params)
Description copied from interface: CGUtils
Returns a expression that invokes the method named methodName with the given parameters.

invokeOn

public java.lang.String invokeOn(java.lang.String varName,
                                 java.lang.String methodName,
                                 java.lang.String[] params)
Description copied from interface: CGUtils
Returns a statement that invokes the method named methodName with the given parameters.

callReturn

public java.lang.String callReturn(java.lang.String expr)
Description copied from interface: CGUtils
Generates a return statement that returns expr.

setter

public MethodTemplate setter(java.lang.String externalName,
                             FieldTemplate field)
Description copied from interface: CGUtils
Factory method that returns a template for a set-method.
Following copied from interface: org.cantaloop.cgimlet.lang.CGUtils
Parameters:
externalName - the name that is used outside the class for this property
field - the field that should be set.
Returns:
a MethodTemplate value

getter

public MethodTemplate getter(java.lang.String externalName,
                             FieldTemplate field)
Description copied from interface: CGUtils
Factory method that returns a template for a get-method.
Following copied from interface: org.cantaloop.cgimlet.lang.CGUtils
Parameters:
externalName - the name that is used outside the class for this property
field - the field whose value should be retrieved.
Returns:
a MethodTemplate value

Copyright 2001, 2002 Stefan Heimann, David Leuschner. All rights reserved.