org.apache.commons.jexl2.MapContext.set()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(3.0k)|赞(0)|评价(0)|浏览(269)

本文整理了Java中org.apache.commons.jexl2.MapContext.set()方法的一些代码示例,展示了MapContext.set()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MapContext.set()方法的具体详情如下:
包路径:org.apache.commons.jexl2.MapContext
类名称:MapContext
方法名:set

MapContext.set介绍

暂无

代码示例

代码示例来源:origin: azkaban/azkaban

  1. private void setCheckers(final Map<String, ConditionChecker> checkers) {
  2. this.checkers = checkers;
  3. for (final ConditionChecker checker : checkers.values()) {
  4. this.context.set(checker.getId(), checker);
  5. }
  6. updateNextCheckTime();
  7. }

代码示例来源:origin: traccar/traccar

  1. private MapContext prepareContext(Position position) {
  2. MapContext result = new MapContext();
  3. if (mapDeviceAttributes) {
  4. Device device = Context.getIdentityManager().getById(position.getDeviceId());
  5. if (device != null) {
  6. for (Object key : device.getAttributes().keySet()) {
  7. result.set((String) key, device.getAttributes().get(key));
  8. }
  9. }
  10. }
  11. Set<Method> methods = new HashSet<>(Arrays.asList(position.getClass().getMethods()));
  12. methods.removeAll(Arrays.asList(Object.class.getMethods()));
  13. for (Method method : methods) {
  14. if (method.getName().startsWith("get") && method.getParameterTypes().length == 0) {
  15. String name = Character.toLowerCase(method.getName().charAt(3)) + method.getName().substring(4);
  16. try {
  17. if (!method.getReturnType().equals(Map.class)) {
  18. result.set(name, method.invoke(position));
  19. } else {
  20. for (Object key : ((Map) method.invoke(position)).keySet()) {
  21. result.set((String) key, ((Map) method.invoke(position)).get(key));
  22. }
  23. }
  24. } catch (IllegalAccessException | InvocationTargetException error) {
  25. LOGGER.warn("Attribute reflection error", error);
  26. }
  27. }
  28. }
  29. return result;
  30. }

代码示例来源:origin: NationalSecurityAgency/datawave

  1. @Override
  2. public void set(final String name, Object value) {
  3. this.parent.set(name, value);
  4. }

代码示例来源:origin: NationalSecurityAgency/datawave

  1. @Override
  2. public void set(String name, Object value) {
  3. if (valueComparator != null) {
  4. if (value instanceof FunctionalSet) {
  5. value = new FunctionalSet((FunctionalSet) value, valueComparator);
  6. } else if (value instanceof Collection) {
  7. TreeSet set = new TreeSet(valueComparator);
  8. set.addAll((Collection) value);
  9. value = set;
  10. }
  11. }
  12. super.set(name, value);
  13. }

代码示例来源:origin: stackoverflow.com

  1. JexlEngine jexl = new JexlEngine();
  2. Expression func = jexl.createExpression("x1*x2-x3");
  3. MapContext mc = new MapContext();
  4. mc.set("x1", 5);
  5. mc.set("x2", 3);
  6. mc.set("x3", 2);
  7. System.out.println(func.evaluate(mc));

代码示例来源:origin: com.linkedin.azkaban/azkaban

  1. public void setCheckers(Map<String, ConditionChecker> checkers){
  2. this.checkers = checkers;
  3. for(ConditionChecker checker : checkers.values()) {
  4. this.context.set(checker.getId(), checker);
  5. // checker.setCondition(this);
  6. }
  7. updateNextCheckTime();
  8. }

代码示例来源:origin: com.linkedin.azkaban/azkaban-common

  1. private void setCheckers(final Map<String, ConditionChecker> checkers) {
  2. this.checkers = checkers;
  3. for (final ConditionChecker checker : checkers.values()) {
  4. this.context.set(checker.getId(), checker);
  5. }
  6. updateNextCheckTime();
  7. }

代码示例来源:origin: com.linkedin.azkaban/azkaban

  1. protected void registerChecker(ConditionChecker checker) {
  2. checkers.put(checker.getId(), checker);
  3. context.set(checker.getId(), checker);
  4. updateNextCheckTime();
  5. }

相关文章