Class MiniLangUtil

java.lang.Object
org.apache.ofbiz.minilang.MiniLangUtil

public final class MiniLangUtil extends Object
Mini-language utilities.
  • Method Details

    • containsScript

      public static boolean containsScript(String str)
      Returns true if str contains a script.
      Parameters:
      str - The string to test
      Returns:
      true if str contains a script
    • autoCorrectOn

      public static boolean autoCorrectOn()
      Returns true 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 the MethodOperation calling this method
      methodContext -
      parameters -
      methodClass -
      methodObject -
      methodName -
      retFieldFma -
      Throws:
      MiniLangRuntimeException
    • convertType

      public static Object convertType(Object obj, Class<?> targetClass, Locale locale, TimeZone timeZone, String format) throws Exception
      Returns obj converted to the type specified in targetClass.
      Parameters:
      obj -
      targetClass -
      locale -
      timeZone -
      format -
      Returns:
      The converted object
      Throws:
      Exception
    • flagDocumentAsCorrected

      public static void flagDocumentAsCorrected(Element element)
      Flags a Mini-language XML document as corrected.
      Parameters:
      element -
    • getObjectClassForConversion

      public static Class<?> getObjectClassForConversion(Object object)
      Returns a object-derived Class that is suitable for use with the conversion framework. If the argument is null or a String, the method returns the MiniLangUtil.PlainString class.
      Parameters:
      object -
      Returns:
      A Class that is suitable for use with the conversion framework
    • isConstantAttribute

      public static boolean isConstantAttribute(String attributeValue)
      Returns true if attributeValue is a constant value (it does not contain an expression).
      Parameters:
      attributeValue - The value to test
      Returns:
      true if attributeValue is a constant value
    • isConstantPlusExpressionAttribute

      public static boolean isConstantPlusExpressionAttribute(String attributeValue)
      Returns true if attributeValue is a constant value (it does not contain an expression) or a constant plus expression value.
      Parameters:
      attributeValue - The value to test
      Returns:
      true if attributeValue is a constant value or a constant plus expression value
    • isDocumentAutoCorrected

      public static boolean isDocumentAutoCorrected(Document document)
      Returns true if document contains corrections.
      Parameters:
      document - The document to test
      Returns:
      true if document contains corrections
    • writeMiniLangDocument

      public static void writeMiniLangDocument(URL xmlURL, Document document)
      Writes a Mini-language Document to disk. The XML file is styled by the config/MiniLang.xslt style sheet.
      Parameters:
      xmlURL -
      document -