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

org.cantaloop.cgimlet.lang
Class AbstractUtils

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

public abstract class AbstractUtils
extends java.lang.Object
implements CGUtils


Constructor Summary
AbstractUtils()
           
 
Method Summary
 java.lang.String caseConcat(java.lang.String s1, java.lang.String s2)
          Concats s1 and s2 and makes sure that the first letter of s2 is an upper case letter.
 java.lang.String caseConcat(java.lang.String s1, java.lang.String s2, java.lang.String s3)
          Concats s1, s2 and s3 and makes sure that the first letter of s2 and s3 is an upper case letter.
 java.lang.String caseConcat(java.lang.String s1, java.lang.String s2, java.lang.String s3, java.lang.String s4)
          Concats s1, s2, s3 and s4 and makes sure that the first letter of s2, s3 and s4 is an upper case letter.
 MethodTemplate getter(FieldTemplate field)
          Factory method that returns a template for a get-method.
 java.lang.String invoke(java.lang.String methodName)
          Returns a statement that invokes the method named methodName.
 java.lang.String invoke(java.lang.String methodName, java.lang.String param1)
          Returns a statement that invokes the method named methodName with the given parameter.
 java.lang.String invoke(java.lang.String methodName, java.lang.String param1, java.lang.String param2)
          Returns a statement that invokes the method named methodName with param1, param2 as parameter.
 java.lang.String invokeExpr(java.lang.String methodName)
          Returns a expression that invokes the method named methodName.
 java.lang.String invokeExpr(java.lang.String methodName, java.lang.String param1)
          Returns a expression that invokes the method named methodName with param1 as parameter.
 java.lang.String invokeExpr(java.lang.String methodName, java.lang.String param1, java.lang.String param2)
          Returns a expression that invokes the method named methodName with param1, param2 as parameter.
 java.lang.String invokeOn(java.lang.String varName, java.lang.String methodName)
          Returns a statement that invokes the method named methodName.
 java.lang.String invokeOn(java.lang.String varName, java.lang.String methodName, java.lang.String param1)
          Returns a statement that invokes the method named methodName with the given parameter.
 java.lang.String invokeOn(java.lang.String varName, java.lang.String methodName, java.lang.String param1, java.lang.String param2)
          Returns a statement that invokes the method named methodName with param1, param2 as parameter.
 java.lang.String invokeOnExpr(java.lang.String varName, java.lang.String methodName)
          Returns a expression that invokes the method named methodName.
 java.lang.String invokeOnExpr(java.lang.String varName, java.lang.String methodName, java.lang.String param1)
          Returns a expression that invokes the method named methodName with param1 as parameter.
 java.lang.String invokeOnExpr(java.lang.String varName, java.lang.String methodName, java.lang.String param1, java.lang.String param2)
          Returns a expression that invokes the method named methodName with param1, param2 as parameter.
 java.lang.String makeClassName(java.lang.String template, java.lang.String baseName, char placeholder)
          Create a classname based on a template.
 java.lang.String mapPut(java.lang.String key, java.lang.String value)
          Shorthand for: mapPut("map", key, value).
 java.lang.String mapStrPut(java.lang.String key, java.lang.String value)
          Shorthand for: mapStrPut("map", key, value).
 java.lang.String mapStrPut(java.lang.String mapName, java.lang.String key, java.lang.String value)
          Same as mapPut except that key will be quoted.
 java.lang.String newInstance(Type type, java.lang.String name)
          Shorthand for newInstance(type, name, type);.
 java.lang.String nonfinalToFinalIdentifier(java.lang.String s)
          Convert a (valid) identifier to a final identifier.
 java.lang.String quote(java.lang.String s)
           
 MethodTemplate setter(FieldTemplate field)
          Factory method that returns a template for a set-method.
 java.lang.String sprintf(java.lang.String str, java.lang.String arg1)
          Shorthand for sprintf(str, new String[]{arg1}).
 java.lang.String sprintf(java.lang.String str, java.lang.String[] args)
          This method acts like the sprintf routine in C.
 java.lang.String sprintf(java.lang.String str, java.lang.String arg1, java.lang.String arg2)
          Shorthand for sprintf(str, new String[]{arg1,arg2}).
 java.lang.String sprintf(java.lang.String str, java.lang.String arg1, java.lang.String arg2, java.lang.String arg3)
          Shorthand for sprintf(str, new String[]{arg1,arg2,arg3}).
 boolean stringToBoolean(java.lang.String s, boolean def)
          Converts a String into a boolean. The "boolean value" of a string is defined as following:
"yes".equals(s) || "true".equals(s) || "on".equals(s). If s == null the value of def is returned.
 java.lang.String toFinalIdentifier(java.lang.String s)
          Convert s into a identifier which can be used for final fields etc.
 java.lang.String toIdentifier(java.lang.String s)
          Shorthand for toIdentifier(s, false);
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.cantaloop.cgimlet.lang.CGUtils
callReturn, callSet, getter, invoke, invokeExpr, invokeOn, invokeOnExpr, mapPut, newInstance, setter, toIdentifier
 

Constructor Detail

AbstractUtils

public AbstractUtils()
Method Detail

stringToBoolean

public boolean stringToBoolean(java.lang.String s,
                               boolean def)
Description copied from interface: CGUtils

Converts a String into a boolean.

The "boolean value" of a string is defined as following:
"yes".equals(s) || "true".equals(s) || "on".equals(s).

If s == null the value of def is returned.

Specified by:
stringToBoolean in interface CGUtils
Following copied from interface: org.cantaloop.cgimlet.lang.CGUtils
Parameters:
s - a String value
def - the value to return if s == null
Returns:
a boolean value

newInstance

public java.lang.String newInstance(Type type,
                                    java.lang.String name)
Description copied from interface: CGUtils
Shorthand for newInstance(type, name, type);.
Specified by:
newInstance in interface CGUtils

toIdentifier

public java.lang.String toIdentifier(java.lang.String s)
Description copied from interface: CGUtils
Shorthand for toIdentifier(s, false);
Specified by:
toIdentifier in interface CGUtils

toFinalIdentifier

public java.lang.String toFinalIdentifier(java.lang.String s)
Description copied from interface: CGUtils
Convert s into a identifier which can be used for final fields etc.
Specified by:
toFinalIdentifier in interface CGUtils

nonfinalToFinalIdentifier

public java.lang.String nonfinalToFinalIdentifier(java.lang.String s)
Convert a (valid) identifier to a final identifier. The default implementation given here converts all letters to uppercase letters, partwords are separated by '_'.
Specified by:
nonfinalToFinalIdentifier in interface CGUtils

makeClassName

public java.lang.String makeClassName(java.lang.String template,
                                      java.lang.String baseName,
                                      char placeholder)
Description copied from interface: CGUtils
Create a classname based on a template. A template is a string that contains a placeholder. This placeholder is replaced by the given basename. If several placeholder characters are found, the first one is used.
Specified by:
makeClassName in interface CGUtils
Following copied from interface: org.cantaloop.cgimlet.lang.CGUtils
Parameters:
template - a String value
baseName - a String value
placeholder - the caracter which should be treated as the placeholder
Returns:
a String value

mapPut

public java.lang.String mapPut(java.lang.String key,
                               java.lang.String value)
Description copied from interface: CGUtils
Shorthand for: mapPut("map", key, value).
Specified by:
mapPut in interface CGUtils

mapStrPut

public java.lang.String mapStrPut(java.lang.String mapName,
                                  java.lang.String key,
                                  java.lang.String value)
Description copied from interface: CGUtils
Same as mapPut except that key will be quoted.
Specified by:
mapStrPut in interface CGUtils

mapStrPut

public java.lang.String mapStrPut(java.lang.String key,
                                  java.lang.String value)
Description copied from interface: CGUtils
Shorthand for: mapStrPut("map", key, value).
Specified by:
mapStrPut in interface CGUtils

quote

public java.lang.String quote(java.lang.String s)
Specified by:
quote in interface CGUtils

invokeExpr

public java.lang.String invokeExpr(java.lang.String methodName)
Description copied from interface: CGUtils
Returns a expression that invokes the method named methodName.
Specified by:
invokeExpr in interface CGUtils

invokeExpr

public java.lang.String invokeExpr(java.lang.String methodName,
                                   java.lang.String param1)
Description copied from interface: CGUtils
Returns a expression that invokes the method named methodName with param1 as parameter.
Specified by:
invokeExpr in interface CGUtils

invokeExpr

public java.lang.String invokeExpr(java.lang.String methodName,
                                   java.lang.String param1,
                                   java.lang.String param2)
Description copied from interface: CGUtils
Returns a expression that invokes the method named methodName with param1, param2 as parameter.
Specified by:
invokeExpr in interface CGUtils

invoke

public java.lang.String invoke(java.lang.String methodName)
Description copied from interface: CGUtils
Returns a statement that invokes the method named methodName.
Specified by:
invoke in interface CGUtils

invoke

public java.lang.String invoke(java.lang.String methodName,
                               java.lang.String param1)
Description copied from interface: CGUtils
Returns a statement that invokes the method named methodName with the given parameter.
Specified by:
invoke in interface CGUtils

invoke

public java.lang.String invoke(java.lang.String methodName,
                               java.lang.String param1,
                               java.lang.String param2)
Description copied from interface: CGUtils
Returns a statement that invokes the method named methodName with param1, param2 as parameter.
Specified by:
invoke in interface CGUtils

invokeOnExpr

public java.lang.String invokeOnExpr(java.lang.String varName,
                                     java.lang.String methodName)
Description copied from interface: CGUtils
Returns a expression that invokes the method named methodName.
Specified by:
invokeOnExpr in interface CGUtils

invokeOnExpr

public java.lang.String invokeOnExpr(java.lang.String varName,
                                     java.lang.String methodName,
                                     java.lang.String param1)
Description copied from interface: CGUtils
Returns a expression that invokes the method named methodName with param1 as parameter.
Specified by:
invokeOnExpr in interface CGUtils

invokeOnExpr

public java.lang.String invokeOnExpr(java.lang.String varName,
                                     java.lang.String methodName,
                                     java.lang.String param1,
                                     java.lang.String param2)
Description copied from interface: CGUtils
Returns a expression that invokes the method named methodName with param1, param2 as parameter.
Specified by:
invokeOnExpr in interface CGUtils

invokeOn

public java.lang.String invokeOn(java.lang.String varName,
                                 java.lang.String methodName)
Description copied from interface: CGUtils
Returns a statement that invokes the method named methodName.
Specified by:
invokeOn in interface CGUtils

invokeOn

public java.lang.String invokeOn(java.lang.String varName,
                                 java.lang.String methodName,
                                 java.lang.String param1)
Description copied from interface: CGUtils
Returns a statement that invokes the method named methodName with the given parameter.
Specified by:
invokeOn in interface CGUtils

invokeOn

public java.lang.String invokeOn(java.lang.String varName,
                                 java.lang.String methodName,
                                 java.lang.String param1,
                                 java.lang.String param2)
Description copied from interface: CGUtils
Returns a statement that invokes the method named methodName with param1, param2 as parameter.
Specified by:
invokeOn in interface CGUtils

sprintf

public java.lang.String sprintf(java.lang.String str,
                                java.lang.String[] args)
Description copied from interface: CGUtils
This method acts like the sprintf routine in C. It replaces the the n-th occurence of either %s or %q in str with the n-th element of args. If %s is used, the string argument will be inserted as is. If %q is used, the CGUtils.quote(java.lang.String) method will be used to quote the inserted string.
Specified by:
sprintf in interface CGUtils

sprintf

public java.lang.String sprintf(java.lang.String str,
                                java.lang.String arg1)
Description copied from interface: CGUtils
Shorthand for sprintf(str, new String[]{arg1}).
Specified by:
sprintf in interface CGUtils

sprintf

public java.lang.String sprintf(java.lang.String str,
                                java.lang.String arg1,
                                java.lang.String arg2)
Description copied from interface: CGUtils
Shorthand for sprintf(str, new String[]{arg1,arg2}).
Specified by:
sprintf in interface CGUtils

sprintf

public java.lang.String sprintf(java.lang.String str,
                                java.lang.String arg1,
                                java.lang.String arg2,
                                java.lang.String arg3)
Description copied from interface: CGUtils
Shorthand for sprintf(str, new String[]{arg1,arg2,arg3}).
Specified by:
sprintf in interface CGUtils

caseConcat

public java.lang.String caseConcat(java.lang.String s1,
                                   java.lang.String s2)
Description copied from interface: CGUtils
Concats s1 and s2 and makes sure that the first letter of s2 is an upper case letter.
Specified by:
caseConcat in interface CGUtils

caseConcat

public java.lang.String caseConcat(java.lang.String s1,
                                   java.lang.String s2,
                                   java.lang.String s3)
Description copied from interface: CGUtils
Concats s1, s2 and s3 and makes sure that the first letter of s2 and s3 is an upper case letter.
Specified by:
caseConcat in interface CGUtils

caseConcat

public java.lang.String caseConcat(java.lang.String s1,
                                   java.lang.String s2,
                                   java.lang.String s3,
                                   java.lang.String s4)
Description copied from interface: CGUtils
Concats s1, s2, s3 and s4 and makes sure that the first letter of s2, s3 and s4 is an upper case letter.
Specified by:
caseConcat in interface CGUtils

setter

public MethodTemplate setter(FieldTemplate field)
Description copied from interface: CGUtils
Factory method that returns a template for a set-method.
Specified by:
setter in interface CGUtils
Following copied from interface: org.cantaloop.cgimlet.lang.CGUtils
Parameters:
field - the field to set.

getter

public MethodTemplate getter(FieldTemplate field)
Description copied from interface: CGUtils
Factory method that returns a template for a get-method.
Specified by:
getter in interface CGUtils
Following copied from interface: org.cantaloop.cgimlet.lang.CGUtils
Parameters:
field - the field to get.

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