Tabnine Logo
Msg
Code IndexAdd Tabnine to your IDE (free)

How to use
Msg
in
org.kie.dmn.feel.util

Best Java code snippets using org.kie.dmn.feel.util.Msg (Showing top 20 results out of 315)

origin: org.kie/kie-dmn-feel

public static Boolean coerceToBoolean(EvaluationContext ctx, Object value) {
  if (value == null || value instanceof Boolean) {
    return (Boolean) value;
  }
  ctx.notifyEvt(() -> new ASTEventBase(
      FEELEvent.Severity.ERROR,
      Msg.createMessage(
          Msg.X_TYPE_INCOMPATIBLE_WITH_Y_TYPE,
          value == null ? "null" : value.getClass(),
          "Boolean"),
      null));
  return null;
}
origin: org.kie/kie-dmn-feel

public static String createMessage( Message1 message, Object p1) {
  return Msg.buildMessage(message, p1);
}
public static String createMessage( Message2 message, Object p1, Object p2) {
origin: org.kie/kie-dmn-feel

  private Object withIndex(Object filterIndex) {
    if (value == null) {
      return null;
    }
    List list = value instanceof List ? (List) value : Arrays.asList(value);
    if (filterIndex instanceof Number) {
      int i = ((Number) filterIndex).intValue();
      if (i > 0 && i <= list.size()) {
        return list.get(i - 1);
      } else if (i < 0 && Math.abs(i) <= list.size()) {
        return list.get(list.size() + i);
      } else {
        ctx.notifyEvt(() -> new ASTEventBase(Severity.ERROR, Msg.createMessage(Msg.INDEX_OUT_OF_BOUND), null));
        return null;
      }
    } else if (filterIndex == null) {
      return Collections.emptyList();
    } else {
      ctx.notifyEvt(() -> new ASTEventBase(Severity.ERROR, Msg.createMessage(Msg.ERROR_EXECUTING_LIST_FILTER, filterIndex), null));
      return null;
    }
  }
}
origin: org.kie/kie-dmn-feel

public static String createMessage( Message0 message) {
  return Msg.buildMessage(message);
}
public static String createMessage( Message1 message, Object p1) {
origin: org.kie/kie-dmn-feel

@Override
public Object evaluate(EvaluationContext ctx) {
  ctx.notifyEvt( astEvent(Severity.ERROR, Msg.createMessage(Msg.BASE_NODE_EVALUATE_CALLED) ) );
  return null;
}
origin: org.kie/kie-dmn-feel

public static String createMessage( Message3 message, Object p1, Object p2, Object p3) {
  return Msg.buildMessage(message, p1, p2, p3);
}
public static String createMessage( Message4 message, Object p1, Object p2, Object p3, Object p4) {
origin: org.kie/kie-dmn-feel

private static UnaryTest toUnaryTest(EvaluationContext ctx, Object o) {
  if ( o instanceof UnaryTest ) {
    return (UnaryTest) o;
  } else if ( o instanceof Range ) {
    return (c, x) -> {
      try {
        return ((Range) o).includes( x );
      } catch ( Exception e ) {
        ctx.notifyEvt( () -> new FEELEventBase( FEELEvent.Severity.ERROR,
                            Msg.createMessage( Msg.EXPRESSION_IS_RANGE_BUT_VALUE_IS_NOT_COMPARABLE, o.toString(), x.toString() ),
                            e ) );
        throw e;
      }
    };
  } else if ( o instanceof List ) {
    return (c, x) -> ((List<?>) o).contains( x );
  } else {
    return (c, x) -> x.equals( o );
  }
}
origin: org.kie/kie-dmn-feel

public static String createMessage( Message2 message, Object p1, Object p2) {
  return Msg.buildMessage(message, p1, p2);
}
public static String createMessage( Message3 message, Object p1, Object p2, Object p3) {
origin: org.kie/kie-dmn-feel

private Comparable convertToComparable(EvaluationContext ctx, Object s) {
  Comparable start;
  if( s instanceof Comparable ) {
    start = (Comparable) s;
  } else if( s instanceof Period ) {
    // period has special semantics
    start = new ComparablePeriod( (Period) s );
  } else {
    ctx.notifyEvt( astEvent(Severity.ERROR, Msg.createMessage(Msg.INCOMPATIBLE_TYPE_FOR_RANGE, s.getClass().getSimpleName() )));
    start = null;
  }
  return start;
}
origin: org.kie/kie-dmn-feel

public static String createMessage( Message4 message, Object p1, Object p2, Object p3, Object p4) {
  return Msg.buildMessage(message, p1, p2, p3, p4);
}

origin: org.kie/kie-dmn-feel

@Override
public Object evaluate(EvaluationContext ctx) {
  if (expression == null) return null;
  BigDecimal result = EvalHelper.getBigDecimalOrNull( expression.evaluate( ctx ) );
  if ( result == null ) {
    ctx.notifyEvt( astEvent(Severity.WARN, Msg.createMessage(Msg.NEGATING_A_NULL)));
    return null;
  } else if ( Sign.NEGATIVE == sign ) {
    return BigDecimal.valueOf( -1 ).multiply( result );
  } else {
    return result;
  }
}
origin: org.kie/kie-dmn-feel

public static Expression external(List<String> paramNames, BaseNode body) {
  EvaluationContextImpl emptyEvalCtx =
      new EvaluationContextImpl(Functions.class.getClassLoader(), new FEELEventListenersManager());
  Map<String, Object> conf = (Map<String, Object>) body.evaluate(emptyEvalCtx);
  Map<String, String> java = (Map<String, String>) conf.get( "java" );
  if (java != null) {
    String className = java.get("class");
    String methodSignature = java.get("method signature");
    if (className == null || methodSignature == null) {
      throw new FEELCompilationError(
          Msg.createMessage(Msg.UNABLE_TO_FIND_EXTERNAL_FUNCTION_AS_DEFINED_BY, methodSignature));
    }
    return FunctionDefs.asMethodCall(className, methodSignature, paramNames);
  } else {
    throw new FEELCompilationError(Msg.createMessage(Msg.UNABLE_TO_FIND_EXTERNAL_FUNCTION_AS_DEFINED_BY, null));
  }
}
origin: org.kie/kie-dmn-feel

public static Boolean between(EvaluationContext ctx,
               Object value, Object start, Object end) {
  if (value == null) {
    ctx.notifyEvt(() -> new ASTEventBase(FEELEvent.Severity.ERROR, Msg.createMessage(Msg.IS_NULL, "value"), null));
    return null;
  }
  if (start == null) {
    ctx.notifyEvt(() -> new ASTEventBase(FEELEvent.Severity.ERROR, Msg.createMessage(Msg.IS_NULL, "start"), null));
    return null;
  }
  if (end == null) {
    ctx.notifyEvt(() -> new ASTEventBase(FEELEvent.Severity.ERROR, Msg.createMessage(Msg.IS_NULL, "end"), null));
    return null;
  }
  if (!value.getClass().isAssignableFrom(start.getClass())) {
    ctx.notifyEvt(() -> new ASTEventBase(FEELEvent.Severity.ERROR, Msg.createMessage(Msg.X_TYPE_INCOMPATIBLE_WITH_Y_TYPE, "value", "start"), null));
    return null;
  }
  if (!value.getClass().isAssignableFrom(end.getClass())) {
    ctx.notifyEvt(() -> new ASTEventBase(FEELEvent.Severity.ERROR, Msg.createMessage(Msg.X_TYPE_INCOMPATIBLE_WITH_Y_TYPE, "value", "end"), null));
    return null;
  }
  return gte(value, start) && lte(value, end);
}
origin: org.kie/kie-dmn-feel

private UnaryTest createInUnaryTest() {
  return (c, o) -> {
    if (o == null) {
      return false;
    }
    Object val = value.evaluate( c );
    if (val instanceof Range) {
      try {
        return ((Range) val).includes(o);
      } catch (Exception e) {
        c.notifyEvt(astEvent(Severity.ERROR, Msg.createMessage(Msg.EXPRESSION_IS_RANGE_BUT_VALUE_IS_NOT_COMPARABLE, o.toString(), val.toString())));
        throw e;
      }
    } else if (val instanceof Collection) {
      return ((Collection) val).contains(o);
    } else {
      return false; // make consistent with #createNotUnaryTest()
    }
  };
}
origin: org.kie/kie-dmn-feel

private Boolean in(EvaluationContext ctx, Object value, Object expr) {
  // need to improve this to work with unary tests
  if ( expr == null ) {
    return value == expr;
  } else if ( expr instanceof UnaryTest ) {
    return ((UnaryTest) expr).apply( ctx, value );
  } else if ( expr instanceof Range ) {
    try {
      return ((Range) expr).includes( value );
    } catch ( Exception e ) {
      ctx.notifyEvt( astEvent(Severity.ERROR, Msg.createMessage(Msg.EXPRESSION_IS_RANGE_BUT_VALUE_IS_NOT_COMPARABLE, value.toString(), expr.toString() ), e ) );
      return null;
    }
  } else if ( value != null ) {
    return value.equals( expr );
  } else {
    // value == null, expr != null
    return Boolean.FALSE;
  }
}
origin: org.kie/kie-dmn-feel

private void valueMustBeANumber(EvaluationContext ctx, Object value) {
  if (!(value instanceof BigDecimal)) {
    ctx.notifyEvt(() -> new ASTEventBase(Severity.ERROR, Msg.createMessage(Msg.VALUE_X_NOT_A_VALID_ENDPOINT_FOR_RANGE_BECAUSE_NOT_A_NUMBER, value), null));
    throw new EndpointOfRangeNotOfNumberException();
  }
}
origin: org.kie/kie-dmn-feel

private void valueMustBeANumber(EvaluationContext ctx, Object value) {
  if (!(value instanceof BigDecimal)) {
    ctx.notifyEvt(astEvent(Severity.ERROR, Msg.createMessage(Msg.VALUE_X_NOT_A_VALID_ENDPOINT_FOR_RANGE_BECAUSE_NOT_A_NUMBER, value), null));
    throw new EndpointOfRangeNotOfNumberException();
  }
}
origin: org.kie/kie-dmn-feel

private UnaryTest createBooleanUnaryTest( ) {
  return (context, left) -> {
    Object right = value.evaluate( context );
    if( right instanceof Boolean ) {
      return (Boolean) right;
    } else {
      context.notifyEvt( astEvent(Severity.ERROR, Msg.createMessage(Msg.EXTENDED_UNARY_TEST_MUST_BE_BOOLEAN, left.toString(), value.toString() ) ) );
      return Boolean.FALSE;
    }
  };
}
origin: org.kie/kie-dmn-feel

public Object satisfies(Function<EvaluationContext, Object> expression) {
  if (quantOp == Quantifier.SOME || quantOp == Quantifier.EVERY) {
    return iterateContexts(ctx, iterationContexts, expression, quantOp);
  }
  // can never happen, but anyway:
  ctx.notifyEvt(() -> new ASTEventBase(Severity.ERROR, Msg.createMessage(Msg.IS_NULL, "Quantifier"), null));
  return null;
}
origin: org.kie/kie-dmn-feel

@Override
public Boolean evaluate(EvaluationContext ctx) {
  if( quantifier == Quantifier.SOME || quantifier == Quantifier.EVERY ) {
    return iterateContexts( ctx, iterationContexts, expression, quantifier );
  }
  ctx.notifyEvt( astEvent(Severity.ERROR, Msg.createMessage(Msg.IS_NULL, "Quantifier")) );
  return null;
}
org.kie.dmn.feel.utilMsg

Javadoc

Utility class for I18N messages.

Most used methods

  • createMessage
  • buildMessage

Popular in Java

  • Reading from database using SQL prepared statement
  • setRequestProperty (URLConnection)
  • setScale (BigDecimal)
  • getExternalFilesDir (Context)
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • Dictionary (java.util)
    Note: Do not use this class since it is obsolete. Please use the Map interface for new implementatio
  • ConcurrentHashMap (java.util.concurrent)
    A plug-in replacement for JDK1.5 java.util.concurrent.ConcurrentHashMap. This version is based on or
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.> This module, both source code and documentation, is in t
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now