MinijaxApplication.java 文件源码

java
阅读 24 收藏 0 点赞 0 评论 0

项目:minijax 作者:
/**
 * Converts a parameter to a type.
 *
 * @param <T>         the supported Java type convertible to/from a {@code String} format.
 * @param str         The parameter string contents.
 * @param c           the raw type of the object to be converted.
 * @param annotations an array of the annotations associated with the convertible
 *                    parameter instance. E.g. if a string value is to be converted into a method parameter,
 *                    this would be the annotations on that parameter as returned by
 *                    {@link java.lang.reflect.Method#getParameterAnnotations}.
 * @return            the newly created instance of {@code T}.
 */
public <T> T convertParamToType(final String str, final Class<T> c, final Annotation[] annotations) {
    final ParamConverter<T> converter = providers.getParamConverter(c, null, annotations);
    if (converter != null) {
        return converter.fromString(str);
    }

    // Try default primitive converters
    return convertStringToType(str, c);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号