net.ontopia.topicmaps.db2tm
Class Functions

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

public class Functions
extends java.lang.Object

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


Constructor Summary
Functions()
           
 
Method Summary
static java.lang.String asIs(java.lang.String str)
          INTERNAL: Returns the string argument as-is.
static java.lang.String coalesce(java.lang.String str1, java.lang.String str2)
          INTERNAL: Returns the first non-null argument.
static java.lang.String coalesce(java.lang.String str1, java.lang.String str2, java.lang.String str3)
          INTERNAL: Returns the first non-null argument.
static java.lang.String coalesceThen(java.lang.String str1, java.lang.String then1)
          INTERNAL: Same as coalesce, but will return then-argument instead of the checked value.
static java.lang.String coalesceThen(java.lang.String str1, java.lang.String then1, java.lang.String str2, java.lang.String then2)
          INTERNAL: Same as coalesce, but will return then-argument instead of the checked value.
static java.lang.String convertDate(java.lang.String date, java.lang.String informat, java.lang.String outformat)
          INTERNAL: Conversion between two date formats.
static java.lang.String failIfEmpty(java.lang.String str, java.lang.String message)
          INTERNAL: Function will throw an exception with the given message if the string value is null or empty.
static java.lang.String ifEmptyThenElse(java.lang.String str, java.lang.String thenval, java.lang.String elseval)
          INTERNAL: Checks to see that the string is null or empty.
static java.lang.String ifEqualThenElse(java.lang.String str1, java.lang.String str2, java.lang.String thenval, java.lang.String elseval)
          INTERNAL: Compares the first two arguments.
static java.lang.String makePSI(java.lang.String str)
          INTERNAL: Turn a string into a suffix suitable for a PSI.
static java.lang.String stringReplaceAll(java.lang.String str, java.lang.String regex, java.lang.String toValue)
          INTERNAL: Replace all occurrences of a regex in a string with a new value.
static java.lang.String stripSpaces(java.lang.String str)
          INTERNAL: Returns the string minus all spaces.
static java.lang.String substring(java.lang.String str, java.lang.String beginIndex, java.lang.String endIndex)
          INTERNAL: Returns a substring of the given String.
static java.lang.String toLowerCase(java.lang.String str)
          INTERNAL: Lowercases the given String.
static java.lang.String toUpperCase(java.lang.String str)
          INTERNAL: Uppercases the given String.
static java.lang.String trim(java.lang.String str)
          INTERNAL: Trims the given String.
static java.lang.String useFirstIfDifferent(java.lang.String str1, java.lang.String str2)
          INTERNAL: Returns the first argument if the two arguments are different.
static java.lang.String useFirstIfEqual(java.lang.String str1, java.lang.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 java.lang.String asIs(java.lang.String str)
INTERNAL: Returns the string argument as-is. This is useful because parameters can be constructed as patterns.


toUpperCase

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


toLowerCase

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


trim

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


substring

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

Throws:
java.lang.NumberFormatException

ifEqualThenElse

public static java.lang.String ifEqualThenElse(java.lang.String str1,
                                               java.lang.String str2,
                                               java.lang.String thenval,
                                               java.lang.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 java.lang.String ifEmptyThenElse(java.lang.String str,
                                               java.lang.String thenval,
                                               java.lang.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 java.lang.String useFirstIfDifferent(java.lang.String str1,
                                                   java.lang.String str2)
INTERNAL: Returns the first argument if the two arguments are different. If they are equal null is returned.


useFirstIfEqual

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


coalesce

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


coalesce

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


coalesceThen

public static java.lang.String coalesceThen(java.lang.String str1,
                                            java.lang.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 java.lang.String coalesceThen(java.lang.String str1,
                                            java.lang.String then1,
                                            java.lang.String str2,
                                            java.lang.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 java.lang.String failIfEmpty(java.lang.String str,
                                           java.lang.String message)
INTERNAL: Function will throw an exception with the given message if the string value is null or empty.


convertDate

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

See Also:
SimpleDateFormat

stringReplaceAll

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


makePSI

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


stripSpaces

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



Copyright © 2000-2012 Ontopia.