org.tinygroup.context.Context.exist()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(6.5k)|赞(0)|评价(0)|浏览(183)

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

Context.exist介绍

暂无

代码示例

代码示例来源:origin: org.tinygroup/org.tinygroup.beancontext

public boolean exist(String name) {
  return context.exist(name);
}

代码示例来源:origin: org.tinygroup/org.tinygroup.velocity

public boolean containsKey(Object key) {
  return context.exist(key.toString());
}

代码示例来源:origin: org.tinygroup/org.tinygroup.context

public boolean containsKey(Object key) {
  return context.exist(key.toString());
}

代码示例来源:origin: org.tinygroup/velocity

public boolean containsKey(Object key) {
  return context.exist(key.toString());
}

代码示例来源:origin: org.tinygroup/org.tinygroup.cepcore

/**
   * 从上下文中解出THREAD_CONTEXT_KEY,并设置为线程变量
   *
   * @param mainContext
   */
  public static void parseCurrentThreadContext(Context mainContext) {
    if (!mainContext.exist(THREAD_CONTEXT_KEY)) {
      return;
    }
    Map<String, Object> currentContext = mainContext.remove(THREAD_CONTEXT_KEY);
//        Context currentContext = mainContext.getSubContext(THREAD_CONTEXT_KEY);
    if (currentContext != null) {
      threadVariableMap.set(currentContext);
    }
  }
}

代码示例来源:origin: org.tinygroup/org.tinygroup.tinyscriptbase

public boolean exist(String name) {
  boolean exist = super.exist(name);
  if (exist) {
    return true;
  }
  Context parentContext = getParent();
  if (parentContext != null) {
    return parentContext.exist(name);
  }
  return false;
}

代码示例来源:origin: org.tinygroup/org.tinygroup.tinyscriptbase

/**
 * 获得标识变量的值
 * 
 * @param context
 * @param key
 * @return
 */
public static Object getVariableValue(Context context, Object key) {
  String name = key.toString();
  if(context.exist(name)){
    return context.get(name);
  }else{
    return getValueFromBean(name);
  }
}

代码示例来源:origin: org.tinygroup/org.tinygroup.templateengine

public boolean exist(String name) {
  boolean exist = super.exist(name);
  if (exist) {
    return true;
  }
  Context parentContext = getParent();
  if (parentContext != null) {
    return parentContext.exist(name);
  }
  return false;
}

代码示例来源:origin: org.tinygroup/org.tinygroup.beancontext

public <T> T get(String name) {
  if (context.exist(name)) {
    return (T) context.get(name);
  } else {
    //必须保存到上下文,否则每次返回不一定是同一个对象(scope可能是属性)
    T t = (T) beanContainer.getBean(name);
    context.put(name, t);
    return t;
  }
}

代码示例来源:origin: org.tinygroup/org.tinygroup.beancontext

public <T> T get(String name) {
    if (context.exist(name)) {
      return (T) context.get(name);
    } else {
      try {
        // 如果没有,则返回null
        T t = (T) beanContainer.getBean(name);
        context.put(name, t);
        return t;
      } catch (Exception e) {
        return null;
      }

    }
  }
}

代码示例来源:origin: org.tinygroup/org.tinygroup.context2object

public static Object getObject(Parameter p, Context context,
                ClassLoader loader) {
  if (context.exist(p.getName()))
    return context.get(p.getName());
  return getObjectByGenerator(p, context, loader);
}

代码示例来源:origin: org.tinygroup/org.tinygroup.tinyscriptbase

public boolean exist(String name) {
  boolean exist = super.exist(name);
  if (exist) {
    return true;
  }
  Context parentContext = getParent();
  if (parentContext != null) {
    exist = parentContext.exist(name);
    if(exist){
      return true;
    }
  }
  if(!name.startsWith("$")){ //避免无限递归
    ScriptClassInstance object = getScriptClassInstance();
    if(object!=null){
      return object.existField(name);
    }
  }
  
  return false;
}

代码示例来源:origin: org.tinygroup/org.tinygroup.cepcorebase

private static Object getParameterValue(ClassLoader loader,
                    Context oldContext, Parameter input) {
  String inputName = input.getName();
  if (!oldContext.exist(inputName)) {

代码示例来源:origin: org.tinygroup/org.tinygroup.context2object

public static Object getObjectByGenerator(Parameter parameter,
                     Context context, ClassLoader loader) {
  String collectionType = parameter.getCollectionType();// 集合类型
  String paramName = parameter.getName();
  String paramType = parameter.getType();
  ClassNameObjectGenerator generator = BeanContainerFactory
      .getBeanContainer(Context2ObjectUtil.class.getClassLoader())
      .getBean(GeneratorFileProcessor.CLASSNAME_OBJECT_GENERATOR_BEAN);
  if (!StringUtil.isBlank(collectionType)) {// 如果集合类型非空
    return generator.getObjectCollection(paramName, collectionType,
        paramType, loader, context);
  } else if (parameter.isArray()) {// 如果是数组
    return generator.getObjectArray(paramName, paramType, loader, context);
  }
  // 否则就是对象
  if (isSimpleType(paramType) && !context.exist(paramName)) {
    return null;
  }
  return generator.getObject(paramName, paramName, paramType, loader, context);
}

代码示例来源:origin: org.tinygroup/org.tinygroup.sqlexecutor

public boolean visit(final SQLUpdateSetItem x) {
  SQLExpr value = x.getValue();
  if (value instanceof SQLVariantRefExpr) {
    SQLVariantRefExpr refExpr = (SQLVariantRefExpr) value;
    String refName = refExpr.getName();
    boolean exist = getContext().exist(StringUtil.substringAfter(refName, "@"));
    if (itemIndex != 0 && exist) {
      print(", ");
    }
    if (!exist) {
      processNum++;
      print(" ");
      return false;
    }
  }else{
    if(itemIndex!=0){
      print(", ");
    }
  }
  super.visit(x);
  itemIndex++;
  return false;
}

代码示例来源:origin: org.tinygroup/org.tinygroup.cepcorebase

public static void resetEventContext(Event event, CEPCore core,
                     Context oldContext) {
    oldContext.remove(IS_CHANGED);
    String serviceId = event.getServiceRequest().getServiceId();
    Context context = event.getServiceRequest().getContext();
    ServiceInfo service = core.getServiceInfo(serviceId);
    List<Parameter> outputs = service.getResults();
    if (outputs != null) {
      for (Parameter output : outputs) {
        String name = output.getName();
        if (context.exist(name)) {
          oldContext.put(name, context.get(name));
        }
      }
    }
    event.getServiceRequest().setContext(oldContext);
  }
}

代码示例来源:origin: org.tinygroup/org.tinygroup.tinydb

public static Bean context2Bean(Context c, Bean bean,
                List<String> properties) {
  for (String property : properties) {
    if (c.exist(property)) {
      bean.put(property, c.get(property));
    }
  }
  bean.put(Bean.SELECT_ITEMS_KEY, c.get(Bean.SELECT_ITEMS_KEY));
  bean.put(Bean.CONDITION_FIELD_KEY, c.get(Bean.CONDITION_FIELD_KEY));
  bean.put(Bean.CONDITION_MODE_KEY, c.get(Bean.CONDITION_MODE_KEY));
  bean.put(Bean.ORDER_BY_KEY, c.get(Bean.ORDER_BY_KEY));
  bean.put(Bean.SORT_DIRECTION_KEY, c.get(Bean.SORT_DIRECTION_KEY));
  bean.put(Bean.GROUP_BY_KEY, c.get(Bean.GROUP_BY_KEY));
  return bean;
}

代码示例来源:origin: org.tinygroup/org.tinygroup.cepcorebase

public static void changeEventContext(Event event, CEPCore core,
                   ClassLoader loader) {
  Context oldContext = event.getServiceRequest().getContext();
  if (oldContext.exist(IS_CHANGED)) {
    return;
  }
  Context newContext = ContextFactory.getContext();
  newContext.put(IS_CHANGED, true);
  String serviceId = event.getServiceRequest().getServiceId();
  ServiceInfo service = core.getServiceInfo(serviceId);
  List<Parameter> inputs = service.getParameters();
  if (inputs != null) {
    for (Parameter input : inputs) {
      Object value = getParameterValue(loader, oldContext, input);
      newContext.put(input.getName(), value);
    }
  }
  event.getServiceRequest().setContext(newContext);
}

相关文章