获取请求内容的JavaBean对象

@param <T>  泛型
@param type 类型

@return 内容
767484
public <T> T getBodyJson(java.lang.reflect.Type type) {
        String str = array.toString(StandardCharsets.UTF_8);
        if (str == null || str.isEmpty()) return null;
        return context.getJsonConvert().convertFrom(type, str);
    }
675153
public static <T> Query<T> query(Class<T> entityType) {
        Assert.notNull(entityType, "entityType must not null");
        return Ebean.find(entityType);
    }
836987
@Nullable
    public <P> P getListener(Class<P> type) {
        if (mListener != null) {
            return type.cast(mListener);
        }
        return null;
    }
955063
public static <T> T get(Class<T> type) {
        FactoryBuilder factoryBuilder = REPOSITORY.get(type);
        return (T) factoryBuilder.get();
    }
299988
public final static boolean isClassType(final Type type) {
        if (type instanceof Class) return true;
        if (type instanceof WildcardType) return false;
        if (type instanceof TypeVariable) return false;
        if (type instanceof GenericArrayType) return isClassType(((GenericArrayType) type).getGenericComponentType());
        if (!(type instanceof ParameterizedType)) return false; //只能是null了
        final ParameterizedType ptype = (ParameterizedType) type;
        if (ptype.getOwnerType() != null && !isClassType(ptype.getOwnerType())) return false;
        if (!isClassType(ptype.getRawType())) return false;
        for (Type t : ptype.getActualTypeArguments()) {
            if (!isClassType(t)) return false;
        }
        return true;
    }
1248792
public <A extends Annotation> A findAnnotationOnBean(Class<A> annotationType) {
        return applicationContext.findAnnotationOnBean(beanName, annotationType);
    }
613941
private static List<Field> getAllFields(Class type) {
		final List<Field> fields = new ArrayList<>();
		for (Class<?> c = type; c != null; c = c.getSuperclass()) {
			fields.addAll(Arrays.asList(c.getDeclaredFields()));
		}
		return fields;
	}
674327
public static <T> T instantiate(Class<T> type) {
        try {
            return BeanIntrospector.SHARED.findIntrospection(type).map(BeanIntrospection::instantiate).orElseGet(() -> {
                try {
                    Logger log = ClassUtils.REFLECTION_LOGGER;
                    if (log.isDebugEnabled()) {
                        log.debug("Reflectively instantiating type: " + type);
                    }
                    return type.newInstance();
                } catch (Throwable e) {
                    throw new InstantiationException("Could not instantiate type [" + type.getName() + "]: " + e.getMessage(), e);
                }
            });
        } catch (Throwable e) {
            throw new InstantiationException("Could not instantiate type [" + type.getName() + "]: " + e.getMessage(), e);
        }
    }
473865
public static <T> SessionBean<T> of(BeanAttributes<T> attributes, InternalEjbDescriptor<T> ejbDescriptor, BeanManagerImpl beanManager, EnhancedAnnotatedType<T> type) {
        return new SessionBeanImpl<T>(attributes, type, ejbDescriptor, new StringBeanIdentifier(SessionBeans.createIdentifier(type, ejbDescriptor)), beanManager);
    }
384942
public String getTypeNameForCast(Class<?> type) {
        Integer jdbcType = jdbcTypeMapping.get(type);
        if (jdbcType == null) {
            jdbcType = javaTypeMapping.getType(type).getSQLTypes()[0];
        }
        return templates.getCastTypeNameForCode(jdbcType);
    }
1166034
public T orElseCreate(Class<? extends T> type) {
		Assert.notNull(type, "Type must not be null");
		return (this.value != null) ? this.value : BeanUtils.instantiateClass(type);
	}
991269
protected List<BindInfo> getBeanBinders(@NotNull Class<?> type) {
        List<BindInfo> bindings = beanInfoByClass.get(type);
        if (bindings != null) {
            return bindings;
        }
        bindings = new ArrayList<>();

        // check all public fields
        for (Field f : type.getFields()) {
            int modifiers = f.getModifiers();
            if (!isPublic(modifiers) || isStatic(modifiers) || isTransient(modifiers)) {
                continue; //ignore
            }
            DbBinder binder = findBinderByType(f.getType(), null);
            if (binder != null) {
                bindings.add(new BindInfo(f.getName(), binder, 0, f, null));
            }
        }

        // check all public get/is methods
        for (Method m : type.getMethods()) {
            int modifiers = m.getModifiers();
            String methodName = m.getName();
            if (!isPublic(modifiers) || isStatic(modifiers) || m.getParameterCount() != 0 || !(methodName.startsWith("get") || methodName.startsWith("is"))) {
                continue; //ignore
            }
            String suffix = methodName.startsWith("is") ? methodName.substring(2) : methodName.substring(3);
            String propertyName = Character.toLowerCase(suffix.charAt(0)) + suffix.substring(1);
            if (bindings.stream().filter(b -> b.mappedName.equals(propertyName)).findAny().orElse(null) != null) { // field has higher priority.
                continue;
            }
            DbBinder binder = findBinderByType(m.getReturnType(), null);
            if (binder != null) {
                bindings.add(new BindInfo(propertyName, binder, 0, null, m));
            }
        }
        beanInfoByClass.put(type, bindings);
        return bindings;
    }
650171
@SuppressWarnings("unchecked")
    public <T> T readAsObject(String content, Class<T> type) {
        Assert.notNull(type);
        try {
            if (StringUtils.isEmpty(content)) {
                log.debug("content为空，返回null", content, type);
                return null;
            } else if (type.equals(String.class)) {
                return (T) content;
            }
            return MAPPER.readValue(content, type);
        } catch (Exception e) {
            log.error("json解析失败，失败原因：", e);
            return null;
        }
    }
158231
@SuppressWarnings("unchecked")
   public <T> T getComponent(Class<T> type) {
      String className = type.getName();
      return (T) getComponent(type, className);
   }
369842
public <T> T read(final Class<T> type) throws DevFailed {
        update();
        return extract(type);
    }
713775
public <T> TypeAdapter<T> getAdapter(Class<T> type) {
    return getAdapter(TypeToken.get(type));
  }
54471
public String getTypeName(Class<?> type) {
        Integer jdbcType = jdbcTypeMapping.get(type);
        if (jdbcType == null) {
            jdbcType = javaTypeMapping.getType(type).getSQLTypes()[0];
        }
        return templates.getTypeNameForCode(jdbcType);
    }