@Override
@SuppressWarnings("unchecked")
public <T> ParamConverter<T> getConverter(final Class<T> rawType, final Type genericType, final Annotation[] annotations) {
return rawType == UUID.class ? ((ParamConverter<T>) getConverter()) : null;
}
java类javax.ws.rs.ext.ParamConverter的实例源码
UuidParamConverterProvider.java 文件源码
项目:minijax
阅读 19
收藏 0
点赞 0
评论 0
MultiTypedProvider.java 文件源码
项目:microprofile-rest-client
阅读 19
收藏 0
点赞 0
评论 0
@Override
public <T> ParamConverter<T> getConverter(Class<T> rawType, Type genericType, Annotation[] annotations) {
return null;
}
ToTransactionId.java 文件源码
项目:openNaEF
阅读 20
收藏 0
点赞 0
评论 0
@Override
public <T> ParamConverter<T> getConverter(Class<T> rawType, Type genericType, Annotation[] annotations) {
return TransactionId.W.class.isAssignableFrom(rawType) ? (ParamConverter<T>) INSTANCE : null;
}
ToDateTime.java 文件源码
项目:openNaEF
阅读 19
收藏 0
点赞 0
评论 0
@Override
public <T> ParamConverter<T> getConverter(Class<T> rawType, Type genericType, Annotation[] annotations) {
return Date.class.isAssignableFrom(rawType) ? (ParamConverter<T>) INSTANCE : null;
}
ConvertersProvider.java 文件源码
项目:hawkular-client-java
阅读 21
收藏 0
点赞 0
评论 0
@Override
@SuppressWarnings("unchecked")
public <T> ParamConverter<T> getConverter(Class<T> rawType, Type genericType, Annotation[] annotations) {
return (ParamConverter<T>) paramConverters.get(rawType);
}
TinyTypesParamProviderTest.java 文件源码
项目:tinytypes
阅读 19
收藏 0
点赞 0
评论 0
@Test
public void yieldsNullWhenTypeIsNotATinyType() {
final Class<?> type = null;
final ParamConverter<?> got = new TinyTypesParamProvider().getConverter(type, null, null);
Assert.assertNull(got);
}
TinyTypesParamProviderTest.java 文件源码
项目:tinytypes
阅读 17
收藏 0
点赞 0
评论 0
@Theory
public void yieldsParamConverterForAnyKindOfTinyType(Class<?> tinyType) {
final ParamConverter<?> got = new TinyTypesParamProvider().getConverter(tinyType, null, null);
Assert.assertNotNull(got);
}
ConvertersProvider.java 文件源码
项目:hawkular-metrics
阅读 21
收藏 0
点赞 0
评论 0
@Override
@SuppressWarnings("unchecked")
public <T> ParamConverter<T> getConverter(Class<T> rawType, Type genericType, Annotation[] annotations) {
return (ParamConverter<T>) paramConverters.get(rawType);
}
MinijaxApplication.java 文件源码
项目:minijax
阅读 24
收藏 0
点赞 0
评论 0
/**
* 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);
}