Class UelFunctions
java.lang.Object
org.apache.ofbiz.base.util.string.UelFunctions
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:localizedDateStr(Timestamp, TimeZone, Locale) | Returns Timestamp as a date String
formatted according to the supplied locale. |
date:dateTimeStr(Timestamp, TimeZone, Locale) | Returns Timestamp as a date-time String
(yyyy-mm-dd hh:mm). |
date:localizedDateTimeStr(Timestamp, TimeZone, Locale) | Returns Timestamp as a date-time
String formatted according to the supplied locale. |
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 (x , y ) 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:toLowerCase(String) | Converts all of the characters in this String to lower case using the rules of the default locale. |
str:toString(Object) | Converts Object to a String - bypassing localization. |
str:toUpperCase(String) | Converts all of the characters in this String to upper case using the rules of the default locale. |
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:label(String, String, Locale) | Return the label present in ressource on the given locale. |
util:size(Object) | Returns the size of Maps ,
|
screen:id(ScreenStack) | Returns the id of the current screen,
Collections , and Strings . Invalid Object types return -1. |
dom: contains org.w3c.dom.* functions | |
dom:readHtmlDocument(String) | Reads an HTML file and returns a org.w3c.dom.Document instance. |
dom:readXmlDocument(String) | Reads an XML file and returns a org.w3c.dom.Document instance. |
dom:toHtmlString(Node, String encoding, boolean indent, int indentAmount) | Returns a org.w3c.dom.Node
as an HTML String . |
dom:toXmlString(Node, String encoding, boolean omitXmlDeclaration, boolean indent, int indentAmount) | Returns a
org.w3c.dom.Node as an XML String . |
dom:writeXmlDocument(String, Node, String encoding, boolean omitXmlDeclaration, boolean indent, int indentAmount)
| Writes a org.w3c.dom.Node to an XML file and returns true if successful. |
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final UelFunctions.Functions
static final String
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
dateString
(Timestamp stamp, TimeZone timeZone, Locale locale) static String
dateTimeString
(Timestamp stamp, TimeZone timeZone, Locale locale) static String
static boolean
static javax.el.FunctionMapper
Returns aFunctionMapper
instance.static int
static int
static String
static int
lastIndexOf
(String str1, String str2) static int
static String
localizedDateString
(Timestamp stamp, TimeZone timeZone, Locale locale) static String
localizedDateTimeString
(Timestamp stamp, TimeZone timeZone, Locale locale) static Document
readHtmlDocument
(String str) static Document
readXmlDocument
(String str) static String
static String
replaceAll
(String str1, String str2, String str3) static String
replaceFirst
(String str1, String str2, String str3) static String
resolveCurrentScreenId
(ScreenRenderer.ScreenStack screenStack) Returns the id of the current screen identified on the screen stackstatic void
setFunction
(String prefix, String localName, Method method) Add a function to OFBiz's built-in UEL functions.static boolean
startsWith
(String str1, String str2) static String
static String
static String
sysGetProp
(String str) static String
timeString
(Timestamp stamp, TimeZone timeZone, Locale locale) static String
toHtmlString
(Node node, String encoding, boolean indent, int indentAmount) static String
toLowerCase
(String str) static String
static String
toUpperCase
(String str) static String
toXmlString
(Node node, String encoding, boolean omitXmlDeclaration, boolean indent, int indentAmount) static String
static boolean
writeXmlDocument
(String str, Node node, String encoding, boolean omitXmlDeclaration, boolean indent, int indentAmount)
-
Field Details
-
FUNCTION_MAPPER
-
MODULE
-
-
Constructor Details
-
UelFunctions
public UelFunctions()
-
-
Method Details
-
getFunctionMapper
public static javax.el.FunctionMapper getFunctionMapper()Returns aFunctionMapper
instance.- Returns:
FunctionMapper
instance
-
setFunction
Add a function to OFBiz's built-in UEL functions. -
dateString
-
localizedDateString
-
dateTimeString
-
localizedDateTimeString
-
timeString
-
getSize
-
endsWith
-
indexOf
-
lastIndexOf
-
length
-
replace
-
replaceAll
-
replaceFirst
-
startsWith
-
endString
-
subString
-
trim
-
toLowerCase
-
toUpperCase
-
toString
-
sysGetEnv
-
sysGetProp
-
label
-
resolveCurrentScreenId
Returns the id of the current screen identified on the screen stack- Parameters:
screenStack
-- Returns:
-
readHtmlDocument
-
readXmlDocument
-
writeXmlDocument
-
toHtmlString
-
toXmlString
-