本文整理了Java中org.apache.commons.jexl2.MapContext.set()
方法的一些代码示例,展示了MapContext.set()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MapContext.set()
方法的具体详情如下:
包路径:org.apache.commons.jexl2.MapContext
类名称:MapContext
方法名:set
暂无
代码示例来源:origin: azkaban/azkaban
private void setCheckers(final Map<String, ConditionChecker> checkers) {
this.checkers = checkers;
for (final ConditionChecker checker : checkers.values()) {
this.context.set(checker.getId(), checker);
}
updateNextCheckTime();
}
代码示例来源:origin: traccar/traccar
private MapContext prepareContext(Position position) {
MapContext result = new MapContext();
if (mapDeviceAttributes) {
Device device = Context.getIdentityManager().getById(position.getDeviceId());
if (device != null) {
for (Object key : device.getAttributes().keySet()) {
result.set((String) key, device.getAttributes().get(key));
}
}
}
Set<Method> methods = new HashSet<>(Arrays.asList(position.getClass().getMethods()));
methods.removeAll(Arrays.asList(Object.class.getMethods()));
for (Method method : methods) {
if (method.getName().startsWith("get") && method.getParameterTypes().length == 0) {
String name = Character.toLowerCase(method.getName().charAt(3)) + method.getName().substring(4);
try {
if (!method.getReturnType().equals(Map.class)) {
result.set(name, method.invoke(position));
} else {
for (Object key : ((Map) method.invoke(position)).keySet()) {
result.set((String) key, ((Map) method.invoke(position)).get(key));
}
}
} catch (IllegalAccessException | InvocationTargetException error) {
LOGGER.warn("Attribute reflection error", error);
}
}
}
return result;
}
代码示例来源:origin: NationalSecurityAgency/datawave
@Override
public void set(final String name, Object value) {
this.parent.set(name, value);
}
代码示例来源:origin: NationalSecurityAgency/datawave
@Override
public void set(String name, Object value) {
if (valueComparator != null) {
if (value instanceof FunctionalSet) {
value = new FunctionalSet((FunctionalSet) value, valueComparator);
} else if (value instanceof Collection) {
TreeSet set = new TreeSet(valueComparator);
set.addAll((Collection) value);
value = set;
}
}
super.set(name, value);
}
代码示例来源:origin: stackoverflow.com
JexlEngine jexl = new JexlEngine();
Expression func = jexl.createExpression("x1*x2-x3");
MapContext mc = new MapContext();
mc.set("x1", 5);
mc.set("x2", 3);
mc.set("x3", 2);
System.out.println(func.evaluate(mc));
代码示例来源:origin: com.linkedin.azkaban/azkaban
public void setCheckers(Map<String, ConditionChecker> checkers){
this.checkers = checkers;
for(ConditionChecker checker : checkers.values()) {
this.context.set(checker.getId(), checker);
// checker.setCondition(this);
}
updateNextCheckTime();
}
代码示例来源:origin: com.linkedin.azkaban/azkaban-common
private void setCheckers(final Map<String, ConditionChecker> checkers) {
this.checkers = checkers;
for (final ConditionChecker checker : checkers.values()) {
this.context.set(checker.getId(), checker);
}
updateNextCheckTime();
}
代码示例来源:origin: com.linkedin.azkaban/azkaban
protected void registerChecker(ConditionChecker checker) {
checkers.put(checker.getId(), checker);
context.set(checker.getId(), checker);
updateNextCheckTime();
}
内容来源于网络,如有侵权,请联系作者删除!