Package org.eweb4j.util

Examples of org.eweb4j.util.ReflectUtil


    Class<?>[] paramTypes = m.getParameterTypes();
    Annotation[][] paramAnns = m.getParameterAnnotations();
    loadParam(paramTypes, paramAnns, paramNames, paramClasses);

    // Action类实例属性变量
    ReflectUtil ru = null;
    try {
      ru = new ReflectUtil(cls);
    } catch (Error e) {
      return null;
    } catch (Exception e) {
      return null;
    }

    Field[] fields = ru.getFields();
    loadParam(fields, paramNames, paramClasses);

    if (paramClasses != null && paramClasses.size() > 0)
      actionName = urlParamToRegex(actionName, paramNames, paramClasses);
View Full Code Here


  }

  private static void pojoFieldToUrlParam(List<String> paramNames,
      List<Class<?>> paramClasses, Class<?> cls)
      throws InstantiationException, IllegalAccessException {
    ReflectUtil _ru = new ReflectUtil(cls);
    String[] fieldNames = _ru.getFieldsName();
    Field[] fields = _ru.getFields();
    paramNames.addAll(Arrays.asList(fieldNames));
    for (java.lang.reflect.Field f : fields) {
      paramClasses.add(f.getType());
    }
  }
View Full Code Here

        if (!hasCls.contains(f.getType())) {
          hasCls.add(f.getType());
          scopeName = f.getName();
          try {
            readValidator(scopeName, new ReflectUtil(f.getType()),
                vList, hasCls);
            scopeName = null;
          } catch (Exception e) {
            continue;
          }
View Full Code Here

      } catch (Exception e) {
        log.debug("the action class new instance failued -> " + clsName + " | " + e.toString());
        return false;
      }

      ReflectUtil ru = new ReflectUtil(obj);
      Method[] ms = ru.getMethods();
      if (ms == null)
        return false;

      // 扫描方法的注解信息
      for (Method m : ms) {
        if (m.getModifiers() != 1)
          continue;

        Path path = m.getAnnotation(Path.class);

        if (path == null) {
          String methodName = m.getName();
          Method getter = ru.getGetter(methodName.replace("get", ""));
          Method setter = ru.getSetter(methodName.replace("set", ""));
          // 默认下setter和getter不作为action方法
          if (getter != null || setter != null)
            continue;
        }
View Full Code Here

            sb.append("当前您填写的( class=").append(mvc.getClazz())
                .append(" )是错误的!它必须是一个有效的类 ;\n");
          } else {
            if (mvc.getMethod() != null
                && !"".equals(mvc.getMethod())) {
              Method m = new ReflectUtil(clazz.newInstance())
                  .getMethod(mvc.getMethod());
              if (m == null) {
                sb.append("当前您填写的( method=")
                    .append(mvc.getMethod())
                    .append(" )是错误的!它必须是一个有效的方法 ;\n");
View Full Code Here

    // 通过反射将配置信息注入到数据源对象中
    for (Property property : properties) {
      String name = property.getKey();
      String value = property.getValue();
      ReflectUtil ru2 = new ReflectUtil(ds);
      Method m2 = ru2.getSetter(name);
      if (m2 == null)
        continue;

      Class<?> clazz = m2.getParameterTypes()[0];
      if (int.class.isAssignableFrom(clazz)
View Full Code Here

    Class<?>[] paramTypes = m.getParameterTypes();
    Annotation[][] paramAnns = m.getParameterAnnotations();
    loadParam(paramTypes, paramAnns, paramNames, paramClasses);

    // Action类实例属性变量
    ReflectUtil ru = null;
    try {
      ru = new ReflectUtil(cls);
    } catch (Error e) {
      return null;
    } catch (Exception e) {
      return null;
    }

    Field[] fields = ru.getFields();
    loadParam(fields, paramNames, paramClasses);

    if (paramClasses != null && paramClasses.size() > 0)
      actionName = urlParamToRegex(actionName, paramNames, paramClasses);
View Full Code Here

  }

  private static void pojoFieldToUrlParam(List<String> paramNames,
      List<Class<?>> paramClasses, Class<?> cls)
      throws InstantiationException, IllegalAccessException {
    ReflectUtil _ru = new ReflectUtil(cls);
    String[] fieldNames = _ru.getFieldsName();
    Field[] fields = _ru.getFields();
    paramNames.addAll(Arrays.asList(fieldNames));
    for (java.lang.reflect.Field f : fields) {
      paramClasses.add(f.getType());
    }
  }
View Full Code Here

    return doc;
  }

  private <T> void writeRecursion(final Element bean, T t) throws Exception {
    ReflectUtil ru = new ReflectUtil(t);
    Field[] fields = ru.getFields();
    for (Field f : fields) {
      String n = f.getName();
      Method m = ru.getGetter(n);
      if (m == null)
        continue;

      if ("clazz".equals(n))
        n = "class";
View Full Code Here

   * @throws DAOException
   */
  public void init(Object t, List<Field> fields) throws DAOException {
    this.t = t;
    this.fields = fields;
    this.ru = new ReflectUtil(this.t);
    this.table = ORMConfigBeanUtil.getTable(this.t.getClass());
    // 主类的ID属性名
    this.idField = ORMConfigBeanUtil.getIdField(this.t.getClass());
    this.idGetter = ru.getGetter(idField);
    if (idGetter == null)
View Full Code Here

TOP

Related Classes of org.eweb4j.util.ReflectUtil

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.