Package org.apache.ofbiz.minilang
Class MiniLangUtil
java.lang.Object
org.apache.ofbiz.minilang.MiniLangUtil
Mini-language utilities.
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
Returnstrue
if the Mini-language script engine has been configured to auto-correct version changes.static void
callMethod
(MethodOperation operation, MethodContext methodContext, List<MethodObject<?>> parameters, Class<?> methodClass, Object methodObject, String methodName, FlexibleMapAccessor<Object> retFieldFma) Calls an object method.static boolean
containsScript
(String str) Returnstrue
ifstr
contains a script.static Object
Returnsobj
converted to the type specified intargetClass
.static void
flagDocumentAsCorrected
(Element element) Flags a Mini-language XML document as corrected.static Class<?>
getObjectClassForConversion
(Object object) Returns aobject
-derivedClass
that is suitable for use with the conversion framework.static boolean
isConstantAttribute
(String attributeValue) Returnstrue
ifattributeValue
is a constant value (it does not contain an expression).static boolean
isConstantPlusExpressionAttribute
(String attributeValue) Returnstrue
ifattributeValue
is a constant value (it does not contain an expression) or a constant plus expression value.static boolean
isDocumentAutoCorrected
(Document document) Returnstrue
ifdocument
contains corrections.static void
writeMiniLangDocument
(URL xmlURL, Document document) Writes a Mini-languageDocument
to disk.
-
Method Details
-
containsScript
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, List<MethodObject<?>> parameters, Class<?> methodClass, Object methodObject, String methodName, FlexibleMapAccessor<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 Object convertType(Object obj, Class<?> targetClass, Locale locale, TimeZone timeZone, String format) throws Exception Returnsobj
converted to the type specified intargetClass
.- Parameters:
obj
-targetClass
-locale
-timeZone
-format
-- Returns:
- The converted object
- Throws:
Exception
-
flagDocumentAsCorrected
Flags a Mini-language XML document as corrected.- Parameters:
element
-
-
getObjectClassForConversion
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
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
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
Returnstrue
ifdocument
contains corrections.- Parameters:
document
- The document to test- Returns:
true
ifdocument
contains corrections
-
writeMiniLangDocument
Writes a Mini-languageDocument
to disk. The XML file is styled by the config/MiniLang.xslt style sheet.- Parameters:
xmlURL
-document
-
-