org.ofbiz.base.util.string
Class UelFunctions

java.lang.Object
  extended by org.ofbiz.base.util.string.UelFunctions

public class UelFunctions
extends java.lang.Object

Implements Unified Expression Language functions.

Built-in functions are divided into a number of namespace prefixes:

date: contains miscellaneous date/time functions
date:second(Timestamp, TimeZone, Locale)Returns the second value of Timestamp (0 - 59).
date:minute(Timestamp, TimeZone, Locale)Returns the minute value of Timestamp (0 - 59).
date:hour(Timestamp, TimeZone, Locale)Returns the hour value of Timestamp (0 - 23).
date:dayOfMonth(Timestamp, TimeZone, Locale)Returns the day of month value of Timestamp (1 - 31).
date:dayOfWeek(Timestamp, TimeZone, Locale)Returns the day of week value of Timestamp (Sunday = 1, Saturday = 7).
date:dayOfYear(Timestamp, TimeZone, Locale)Returns the day of year value of Timestamp.
date:week(Timestamp, TimeZone, Locale)Returns the week value of Timestamp.
date:month(Timestamp, TimeZone, Locale)Returns the month value of Timestamp (January = 0, December = 11).
date:year(Timestamp, TimeZone, Locale)Returns the year value of Timestamp.
date:dayStart(Timestamp, TimeZone, Locale)Returns Timestamp set to start of day.
date:dayEnd(Timestamp, TimeZone, Locale)Returns Timestamp set to end of day.
date:weekStart(Timestamp, TimeZone, Locale)Returns Timestamp set to start of week.
date:weekEnd(Timestamp, TimeZone, Locale)Returns Timestamp set to end of week.
date:monthStart(Timestamp, TimeZone, Locale)Returns Timestamp set to start of month.
date:monthEnd(Timestamp, TimeZone, Locale)Returns Timestamp set to end of month.
date:yearStart(Timestamp, TimeZone, Locale)Returns Timestamp set to start of year.
date:yearEnd(Timestamp, TimeZone, Locale)Returns Timestamp set to end of year.
date:dateStr(Timestamp, TimeZone, Locale)Returns Timestamp as a date String (yyyy-mm-dd).
date:dateTimeStr(Timestamp, TimeZone, Locale)Returns Timestamp as a date-time String (yyyy-mm-dd hh:mm).
date:timeStr(Timestamp, TimeZone, Locale)Returns Timestamp as a time String (hh:mm).
date:nowTimestamp()Returns Timestamp for right now.
math: maps to java.lang.Math
math:absDouble(double)Returns the absolute value of a double value.
math:absFloat(float)Returns the absolute value of a float value.
math:absInt(int)Returns the absolute value of an int value.
math:absLong(long)Returns the absolute value of a long value.
math:acos(double)Returns the arc cosine of an angle, in the range of 0.0 through pi.
math:asin(double)Returns the arc sine of an angle, in the range of -pi/2 through pi/2.
math:atan(double)Returns the arc tangent of an angle, in the range of -pi/2 through pi/2.
math:atan2(double, double)Converts rectangular coordinates (xy) to polar (r, theta).
math:cbrt(double)Returns the cube root of a double value.
math:ceil(double)Returns the smallest (closest to negative infinity) double value that is greater than or equal to the argument and is equal to a mathematical integer.
math:cos(double)Returns the trigonometric cosine of an angle.
math:cosh(double)Returns the hyperbolic cosine of a double value.
math:exp(double)Returns Euler's number e raised to the power of a double value.
math:expm1(double)Returns ex -1.
math:floor(double)Returns the largest (closest to positive infinity) double value that is less than or equal to the argument and is equal to a mathematical integer.
math:hypot(double, double)Returns sqrt(x2 +y2) without intermediate overflow or underflow.
math:IEEEremainder(double, double)Computes the remainder operation on two arguments as prescribed by the IEEE 754 standard.
math:log(double)Returns the natural logarithm (base e) of a double value.
math:log10(double)Returns the base 10 logarithm of a double value.
math:log1p(double)Returns the natural logarithm of the sum of the argument and 1.
math:maxDouble(double, double)Returns the greater of two double values.
math:maxFloat(float, float)Returns the greater of two float values.
math:maxInt(int, int)Returns the greater of two int values.
math:maxLong(long, long)Returns the greater of two long values.
math:minDouble(double, double)Returns the smaller of two double values.
math:minFloat(float, float)Returns the smaller of two float values.
math:minInt(int, int)Returns the smaller of two int values.
math:minLong(long, long)Returns the smaller of two long values.
math:pow(double, double)Returns the value of the first argument raised to the power of the second argument.
math:random()Returns a double value with a positive sign, greater than or equal to 0.0 and less than 1.0.
math:rint(double)Returns the double value that is closest in value to the argument and is equal to a mathematical integer.
math:roundDouble(double)Returns the closest long to the argument.
math:roundFloat(float)Returns the closest int to the argument.
math:signumDouble(double)Returns the signum function of the argument; zero if the argument is zero, 1.0 if the argument is greater than zero, -1.0 if the argument is less than zero.
math:signumFloat(float)Returns the signum function of the argument; zero if the argument is zero, 1.0f if the argument is greater than zero, -1.0f if the argument is less than zero.
math:sin(double)Returns the trigonometric sine of an angle.
math:sinh(double)Returns the hyperbolic sine of a double value.
math:sqrt(double)Returns the correctly rounded positive square root of a double value.
math:tan(double)Returns the trigonometric tangent of an angle.
math:tanh(double)Returns the hyperbolic tangent of a double value.
math:toDegrees(double)Converts an angle measured in radians to an approximately equivalent angle measured in degrees.
math:toRadians(double)Converts an angle measured in degrees to an approximately equivalent angle measured in radians.
math:ulpDouble(double)Returns the size of an ulp (units in the last place) of the argument.
math:ulpFloat(float)Returns the size of an ulp (units in the last place) of the argument.
str: maps to java.lang.String
str:endsWith(String, String)Returns true if this string ends with the specified suffix.
str:indexOf(String, String)Returns the index within this string of the first occurrence of the specified substring.
str:lastIndexOf(String, String)Returns the index within this string of the last occurrence of the specified character.
str:length(String)Returns the length of this string.
str:replace(String, String, String)Replaces each substring of this string that matches the literal target sequence with the specified literal replacement sequence.
str:replaceAll(String, String, String)Replaces each substring of this string that matches the given regular expression with the given replacement.
str:replaceFirst(String, String, String)Replaces the first substring of this string that matches the given regular expression with the given replacement.
str:startsWith(String, String)Returns true if this string starts with the specified prefix.
str:endstring(String, int)Returns a new string that is a substring of this string. The substring begins with the character at the specified index and extends to the end of this string.
str:substring(String, int, int)Returns a new string that is a substring of this string. The substring begins at the specified beginIndex and extends to the character at index endIndex - 1. Thus the length of the substring is endIndex-beginIndex.
str:toString(Object)Converts Object to a String - bypassing localization.
str:trim(String)Returns a copy of the string, with leading and trailing whitespace omitted.
sys: maps to java.lang.System
sys:getenv(String)Gets the value of the specified environment variable.
sys:getProperty(String)Gets the system property indicated by the specified key.
util: contains miscellaneous utility functions
util:defaultLocale()Returns the default Locale.
util:defaultTimeZone()Returns the default TimeZone.
util:size(Object)Returns the size of Maps, Collections, and Strings. Invalid Object types return -1.
util:urlExists(String)Returns true if the specified URL exists.


Nested Class Summary
protected static class UelFunctions.Functions
           
 
Field Summary
protected static FunctionMapper functionMapper
           
static java.lang.String module
           
 
Constructor Summary
UelFunctions()
           
 
Method Summary
static java.lang.String dateString(java.sql.Timestamp stamp, java.util.TimeZone timeZone, java.util.Locale locale)
           
static java.lang.String dateTimeString(java.sql.Timestamp stamp, java.util.TimeZone timeZone, java.util.Locale locale)
           
static java.lang.String endString(java.lang.String str, int index)
           
static boolean endsWith(java.lang.String str1, java.lang.String str2)
           
static FunctionMapper getFunctionMapper()
          Returns a FunctionMapper instance.
static int getSize(java.lang.Object obj)
           
static int indexOf(java.lang.String str1, java.lang.String str2)
           
static int lastIndexOf(java.lang.String str1, java.lang.String str2)
           
static int length(java.lang.String str1)
           
static java.lang.String replace(java.lang.String str1, java.lang.String str2, java.lang.String str3)
           
static java.lang.String replaceAll(java.lang.String str1, java.lang.String str2, java.lang.String str3)
           
static java.lang.String replaceFirst(java.lang.String str1, java.lang.String str2, java.lang.String str3)
           
static boolean startsWith(java.lang.String str1, java.lang.String str2)
           
static java.lang.String subString(java.lang.String str, int beginIndex, int endIndex)
           
static java.lang.String sysGetEnv(java.lang.String str)
           
static java.lang.String sysGetProp(java.lang.String str)
           
static java.lang.String timeString(java.sql.Timestamp stamp, java.util.TimeZone timeZone, java.util.Locale locale)
           
static java.lang.String toString(java.lang.Object obj)
           
static java.lang.String trim(java.lang.String str)
           
static boolean urlExists(java.lang.String str)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

module

public static final java.lang.String module

functionMapper

protected static final FunctionMapper functionMapper
Constructor Detail

UelFunctions

public UelFunctions()
Method Detail

getFunctionMapper

public static FunctionMapper getFunctionMapper()
Returns a FunctionMapper instance.

Returns:
FunctionMapper instance

dateString

public static java.lang.String dateString(java.sql.Timestamp stamp,
                                          java.util.TimeZone timeZone,
                                          java.util.Locale locale)

dateTimeString

public static java.lang.String dateTimeString(java.sql.Timestamp stamp,
                                              java.util.TimeZone timeZone,
                                              java.util.Locale locale)

timeString

public static java.lang.String timeString(java.sql.Timestamp stamp,
                                          java.util.TimeZone timeZone,
                                          java.util.Locale locale)

getSize

public static int getSize(java.lang.Object obj)

endsWith

public static boolean endsWith(java.lang.String str1,
                               java.lang.String str2)

indexOf

public static int indexOf(java.lang.String str1,
                          java.lang.String str2)

lastIndexOf

public static int lastIndexOf(java.lang.String str1,
                              java.lang.String str2)

length

public static int length(java.lang.String str1)

replace

public static java.lang.String replace(java.lang.String str1,
                                       java.lang.String str2,
                                       java.lang.String str3)

replaceAll

public static java.lang.String replaceAll(java.lang.String str1,
                                          java.lang.String str2,
                                          java.lang.String str3)

replaceFirst

public static java.lang.String replaceFirst(java.lang.String str1,
                                            java.lang.String str2,
                                            java.lang.String str3)

startsWith

public static boolean startsWith(java.lang.String str1,
                                 java.lang.String str2)

endString

public static java.lang.String endString(java.lang.String str,
                                         int index)

subString

public static java.lang.String subString(java.lang.String str,
                                         int beginIndex,
                                         int endIndex)

trim

public static java.lang.String trim(java.lang.String str)

toString

public static java.lang.String toString(java.lang.Object obj)

sysGetEnv

public static java.lang.String sysGetEnv(java.lang.String str)

sysGetProp

public static java.lang.String sysGetProp(java.lang.String str)

urlExists

public static boolean urlExists(java.lang.String str)