net.ontopia.topicmaps.db2tm
Class Functions

java.lang.Object
  extended by net.ontopia.topicmaps.db2tm.Functions

public class Functions
extends Object

INTERNAL: A collection of DB2TM functions intended to be used in the function-column element.


Constructor Summary
Functions()
           
 
Method Summary
static String asIs(String str)
          INTERNAL: Returns the string argument as-is.
static String coalesce(String str1, String str2)
          INTERNAL: Returns the first non-null argument.
static String coalesce(String str1, String str2, String str3)
          INTERNAL: Returns the first non-null argument.
static String coalesceThen(String str1, String then1)
          INTERNAL: Same as coalesce, but will return then-argument instead of the checked value.
static String coalesceThen(String str1, String then1, String str2, String then2)
          INTERNAL: Same as coalesce, but will return then-argument instead of the checked value.
static String convertDate(String date, String informat, String outformat)
          INTERNAL: Conversion between two date formats.
static String failIfEmpty(String str, String message)
          INTERNAL: Function will throw an exception with the given message if the string value is null or empty.
static String ifEmptyThenElse(String str, String thenval, String elseval)
          INTERNAL: Checks to see that the string is null or empty.
static String ifEqualThenElse(String str1, String str2, String thenval, String elseval)
          INTERNAL: Compares the first two arguments.
static String makePSI(String str)
          INTERNAL: Turn a string into a suffix suitable for a PSI.
static String stringReplaceAll(String str, String regex, String toValue)
          INTERNAL: Replace all occurrences of a regex in a string with a new value.
static String stripSpaces(String str)
          INTERNAL: Returns the string minus all spaces.
static String substring(String str, String beginIndex, String endIndex)
          INTERNAL: Returns a substring of the given String.
static String toLowerCase(String str)
          INTERNAL: Lowercases the given String.
static String toUpperCase(String str)
          INTERNAL: Uppercases the given String.
static String trim(String str)
          INTERNAL: Trims the given String.
static String useFirstIfDifferent(String str1, String str2)
          INTERNAL: Returns the first argument if the two arguments are different.
static String useFirstIfEqual(String str1, String str2)
          INTERNAL: Returns the first argument if the two arguments are equal.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Functions

public Functions()
Method Detail

asIs

public static String asIs(String str)
INTERNAL: Returns the string argument as-is. This is useful because parameters can be constructed as patterns.


toUpperCase

public static String toUpperCase(String str)
INTERNAL: Uppercases the given String. If the parameter is null it returns null.


toLowerCase

public static String toLowerCase(String str)
INTERNAL: Lowercases the given String. If the parameter is null it returns null.


trim

public static String trim(String str)
INTERNAL: Trims the given String. If the parameter is null it returns null.


substring

public static String substring(String str,
                               String beginIndex,
                               String endIndex)
                        throws NumberFormatException
INTERNAL: Returns a substring of the given String.

Throws:
NumberFormatException

ifEqualThenElse

public static String ifEqualThenElse(String str1,
                                     String str2,
                                     String thenval,
                                     String elseval)
INTERNAL: Compares the first two arguments. If they are equal the third argument is returned, if not the fourth one is.


ifEmptyThenElse

public static String ifEmptyThenElse(String str,
                                     String thenval,
                                     String elseval)
INTERNAL: Checks to see that the string is null or empty. If it is then the then value is returned, otherwise the else value.


useFirstIfDifferent

public static String useFirstIfDifferent(String str1,
                                         String str2)
INTERNAL: Returns the first argument if the two arguments are different. If they are equal null is returned.


useFirstIfEqual

public static String useFirstIfEqual(String str1,
                                     String str2)
INTERNAL: Returns the first argument if the two arguments are equal. If they are different null is returned.


coalesce

public static String coalesce(String str1,
                              String str2)
INTERNAL: Returns the first non-null argument.


coalesce

public static String coalesce(String str1,
                              String str2,
                              String str3)
INTERNAL: Returns the first non-null argument.


coalesceThen

public static String coalesceThen(String str1,
                                  String then1)
INTERNAL: Same as coalesce, but will return then-argument instead of the checked value. Will return null if none of the checked values are non-empty.


coalesceThen

public static String coalesceThen(String str1,
                                  String then1,
                                  String str2,
                                  String then2)
INTERNAL: Same as coalesce, but will return then-argument instead of the checked value. Will return null if none of the checked values are non-empty.


failIfEmpty

public static String failIfEmpty(String str,
                                 String message)
INTERNAL: Function will throw an exception with the given message if the string value is null or empty.


convertDate

public static String convertDate(String date,
                                 String informat,
                                 String outformat)
INTERNAL: Conversion between two date formats.

See Also:
SimpleDateFormat

stringReplaceAll

public static String stringReplaceAll(String str,
                                      String regex,
                                      String toValue)
INTERNAL: Replace all occurrences of a regex in a string with a new value.


makePSI

public static String makePSI(String str)
INTERNAL: Turn a string into a suffix suitable for a PSI.


stripSpaces

public static String stripSpaces(String str)
INTERNAL: Returns the string minus all spaces. Differs from trim() in that internal spaces are also removed.



Copyright © 2000-2012 Ontopia.