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

How to use
Context2ObjectUtil
in
org.tinygroup.context2object.util

Best Java code snippets using org.tinygroup.context2object.util.Context2ObjectUtil (Showing top 11 results out of 315)

origin: org.tinygroup/context2object

public static Object getObject(Parameter p, Context context) {
  Object o = context.get(p.getName());
  if (o != null) {
    return o;
  }
  return getObjectByGenerator(p, context);
}
origin: org.tinygroup/org.tinygroup.context2object

public static Object convertBasicTypeCollection(String[] stringArray, String collectionClass, String className, ClassLoader loader) {
  Collection<Object> collection = Context2ObjectUtil.getCollectionInstance(collectionClass, loader);
  Object value = convertBasicTypeArray(stringArray, className);
  if (value == null) {
    return null;
  }
  Object[] tArray = (Object[]) value;
  for (Object t : tArray) {
    collection.add(t);
  }
  return collection;
}
origin: org.tinygroup/org.tinygroup.context2object

protected boolean isSimpleType(Class<?> clazz) {
  return Context2ObjectUtil.isSimpleType(clazz);
}
origin: org.tinygroup/org.tinygroup.cepcore

  private Object getArgument(Context context, Parameter param) {
    String paramName = param.getName();
    Object obj = Context2ObjectUtil.getObject(param, context, this
        .getClass().getClassLoader());
    if (obj == null) {
      if (param.isRequired()) { // 如果输入参数是必须的,则抛出异常
        LOGGER.logMessage(LogLevel.ERROR, "参数{paramName}未传递", paramName);
        throw new ParamIsNullException(paramName);
      } else { // 如果输出参数非必须,直接返回null
        return null;
      }
    }
    if (!(obj instanceof String)) {
      return obj;
    }
    return ValueUtil.getValue((String) obj, param.getType());
  }
}
origin: org.tinygroup/context2object

  public static Object getObjectByGenerator(Parameter parameter,
      Context context) {
    String collectionType = parameter.getCollectionType();// 集合类型
    String paramName = parameter.getName();
    String paramType = parameter.getType();
    ClassNameObjectGenerator generator = SpringUtil
        .getBean(GeneratorFileProcessor.CLASSNAME_OBJECT_GENERATOR_BEAN);
    if (!isNull(collectionType)) {// 如果集合类型非空
      return generator.getObjectCollection(paramName, collectionType,
          paramType, context);
    } else if (parameter.isArray()) {// 如果是数组
      return generator.getObjectArray(paramName, paramType, context);
    }
    // 否则就是对象
    return generator.getObject(paramName, paramName, paramType, context);
  }
}
origin: org.tinygroup/service

private Object getArgument(Context context, int i) {
  Parameter des = inputParameters.get(i);
  String paramName = des.getName();
  // =============20130619修改bengin================
  Object obj = Context2ObjectUtil.getObject(des, context);
  // =============20130619修改end================
  if (obj == null) {
    if (des.isRequired()) { // 如果输入参数是必须的,则抛出异常
      logger.logMessage(LogLevel.ERROR, "参数{paramName}未传递", paramName);
      throw new ParamIsNullException(paramName);
    } else { // 如果输出参数非必须,直接返回null
      return null;
    }
  }
  if (!(obj instanceof String)) {
    return obj;
  }
  return ValueUtil.getValue((String) obj, des.getType());
}
origin: org.tinygroup/org.tinygroup.service

private Object getArgument(Context context, int i) {
  Parameter des = inputParameters.get(i);
  String paramName = des.getName();
  // =============20130619修改bengin================
  Object obj = Context2ObjectUtil.getObject(des, context, loader);
  // =============20130619修改end================
  if (obj == null) {
    if (des.isRequired()) { // 如果输入参数是必须的,则抛出异常
      LOGGER.logMessage(LogLevel.ERROR, "参数{paramName}未传递", paramName);
      throw new ParamIsNullException(paramName);
    } else { // 如果输出参数非必须,直接返回null
      return null;
    }
  }
  if (!(obj instanceof String)) {
    return obj;
  }
  return ValueUtil.getValue((String) obj, des.getType());
}
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.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.cepcorebase

if (!oldContext.exist(inputName)) {
  return Context2ObjectUtil.getObject(input, oldContext, loader);
} else {
origin: org.tinygroup/org.tinygroup.cepcore

public static Context getContext(Event event, ServiceInfo info, ClassLoader loder) {
  Context c = new ContextImpl();
  Context oldContext = event.getServiceRequest().getContext();
  if (info.getParameters() == null) {
    return c;
  }
  for (Parameter p : info.getParameters()) {
    Object value = Context2ObjectUtil.getObject(p, oldContext, loder);
    if (value != null && !(value instanceof java.io.Serializable)) {
      throw new ParamNotSerializableException(event
          .getServiceRequest().getServiceId(), p.getName());
    }
    c.put(p.getName(), value);
  }
  return c;
}
org.tinygroup.context2object.utilContext2ObjectUtil

Most used methods

  • getObject
  • getObjectByGenerator
  • getCollectionInstance
  • isNull
  • isSimpleType

Popular in Java

  • Making http requests using okhttp
  • getContentResolver (Context)
  • getSystemService (Context)
  • findViewById (Activity)
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • Stack (java.util)
    Stack is a Last-In/First-Out(LIFO) data structure which represents a stack of objects. It enables u
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • Top Sublime Text 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