Package org.apache.ofbiz.minilang
Class MiniLangUtil
- java.lang.Object
-
- org.apache.ofbiz.minilang.MiniLangUtil
-
public final class MiniLangUtil extends java.lang.Object
Mini-language utilities.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MiniLangUtil.PlainString
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
module
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
autoCorrectOn()
Returnstrue
if the Mini-language script engine has been configured to auto-correct version changes.static void
callMethod(MethodOperation operation, MethodContext methodContext, java.util.List<MethodObject<?>> parameters, java.lang.Class<?> methodClass, java.lang.Object methodObject, java.lang.String methodName, FlexibleMapAccessor<java.lang.Object> retFieldFma)
Calls an object method.static boolean
containsScript(java.lang.String str)
Returnstrue
ifstr
contains a script.static java.lang.Object
convertType(java.lang.Object obj, java.lang.Class<?> targetClass, java.util.Locale locale, java.util.TimeZone timeZone, java.lang.String format)
Returnsobj
converted to the type specified intargetClass
.static void
flagDocumentAsCorrected(org.w3c.dom.Element element)
Flags a Mini-language XML document as corrected.static java.lang.Class<?>
getObjectClassForConversion(java.lang.Object object)
Returns aobject
-derivedClass
that is suitable for use with the conversion framework.static boolean
isConstantAttribute(java.lang.String attributeValue)
Returnstrue
ifattributeValue
is a constant value (it does not contain an expression).static boolean
isConstantPlusExpressionAttribute(java.lang.String attributeValue)
Returnstrue
ifattributeValue
is a constant value (it does not contain an expression) or a constant plus expression value.static boolean
isDocumentAutoCorrected(org.w3c.dom.Document document)
Returnstrue
ifdocument
contains corrections.static void
writeMiniLangDocument(java.net.URL xmlURL, org.w3c.dom.Document document)
Writes a Mini-languageDocument
to disk.
-
-
-
Method Detail
-
containsScript
public static boolean containsScript(java.lang.String str)
Returnstrue
ifstr
contains a script.- Parameters:
str
- The string to test- Returns:
true
ifstr
contains a script
-
autoCorrectOn
public static boolean autoCorrectOn()
Returnstrue
if the Mini-language script engine has been configured to auto-correct version changes.- Returns:
true
if the Mini-language script engine has been configured to auto-correct version changes
-
callMethod
public static void callMethod(MethodOperation operation, MethodContext methodContext, java.util.List<MethodObject<?>> parameters, java.lang.Class<?> methodClass, java.lang.Object methodObject, java.lang.String methodName, FlexibleMapAccessor<java.lang.Object> retFieldFma) throws MiniLangRuntimeException
Calls an object method.- Parameters:
operation
- A reference to theMethodOperation
calling this methodmethodContext
-parameters
-methodClass
-methodObject
-methodName
-retFieldFma
-- Throws:
MiniLangRuntimeException
-
convertType
public static java.lang.Object convertType(java.lang.Object obj, java.lang.Class<?> targetClass, java.util.Locale locale, java.util.TimeZone timeZone, java.lang.String format) throws java.lang.Exception
Returnsobj
converted to the type specified intargetClass
.- Parameters:
obj
-targetClass
-locale
-timeZone
-format
-- Returns:
- The converted object
- Throws:
java.lang.Exception
-
flagDocumentAsCorrected
public static void flagDocumentAsCorrected(org.w3c.dom.Element element)
Flags a Mini-language XML document as corrected.- Parameters:
element
-
-
getObjectClassForConversion
public static java.lang.Class<?> getObjectClassForConversion(java.lang.Object object)
Returns aobject
-derivedClass
that is suitable for use with the conversion framework. If the argument isnull
or aString
, the method returns theMiniLangUtil.PlainString
class.- Parameters:
object
-- Returns:
- A
Class
that is suitable for use with the conversion framework
-
isConstantAttribute
public static boolean isConstantAttribute(java.lang.String attributeValue)
Returnstrue
ifattributeValue
is a constant value (it does not contain an expression).- Parameters:
attributeValue
- The value to test- Returns:
true
ifattributeValue
is a constant value
-
isConstantPlusExpressionAttribute
public static boolean isConstantPlusExpressionAttribute(java.lang.String attributeValue)
Returnstrue
ifattributeValue
is a constant value (it does not contain an expression) or a constant plus expression value.- Parameters:
attributeValue
- The value to test- Returns:
true
ifattributeValue
is a constant value or a constant plus expression value
-
isDocumentAutoCorrected
public static boolean isDocumentAutoCorrected(org.w3c.dom.Document document)
Returnstrue
ifdocument
contains corrections.- Parameters:
document
- The document to test- Returns:
true
ifdocument
contains corrections
-
writeMiniLangDocument
public static void writeMiniLangDocument(java.net.URL xmlURL, org.w3c.dom.Document document)
Writes a Mini-languageDocument
to disk. The XML file is styled by the config/MiniLang.xslt style sheet.- Parameters:
xmlURL
-document
-
-
-