List of usage examples for com.fasterxml.jackson.databind JavaType getRawClass
public final Class<?> getRawClass()
From source file:io.swagger.test.SerializableParamExtractionTest.java
@Test public void getIntegerParameterClassTest() throws Exception { JavaType jt = utils.getTypeFromParameter(new QueryParameter().property(new IntegerProperty()), null); assertEquals(jt.getRawClass(), Integer.class); }
From source file:io.swagger.test.SerializableParamExtractionTest.java
@Test public void getBooleanParameterClassTest() throws Exception { JavaType jt = utils.getTypeFromParameter(new QueryParameter().property(new BooleanProperty()), null); assertEquals(jt.getRawClass(), Boolean.class); }
From source file:io.swagger.test.SerializableParamExtractionTest.java
@Test public void getDateTimeParameterClassTest() throws Exception { JavaType jt = utils.getTypeFromParameter(new QueryParameter().property(new DateTimeProperty()), null); assertEquals(jt.getRawClass(), DateTime.class); }
From source file:java2typescript.jackson.module.visitors.TSJsonFormatVisitorWrapper.java
@Override public JsonAnyFormatVisitor expectAnyFormat(JavaType type) throws JsonMappingException { if ("java.lang.Object".equals(type.getRawClass().getName())) { return setTypeAndReturn(new TSJsonAnyFormatVisitor(this, conf)); }/*from ww w . j a v a 2 s. c om*/ // probably just a class without fields/properties useNamedClassOrParse(type); return null; }
From source file:io.swagger.test.SerializableParamExtractionTest.java
@Test public void getStringFallbackParameterClassTest() throws Exception { JavaType jt = utils.getTypeFromParameter(new QueryParameter().property(new StringProperty("url")), null); assertEquals(jt.getRawClass(), String.class); }
From source file:org.apache.activemq.apollo.dto.ApolloTypeIdResolver.java
public void init(JavaType baseType) { this.baseType = baseType; ArrayList<Class<?>> classes = new ArrayList<Class<?>>(); classes.add(baseType.getRawClass()); classes.addAll(Arrays.asList(DtoModules.extensionClasses())); for (Class<?> c : classes) { if (baseType.getRawClass().isAssignableFrom(c)) { JsonTypeName jsonAnnoation = c.getAnnotation(JsonTypeName.class); if (jsonAnnoation != null && jsonAnnoation.value() != null) { typeToId.put(c, jsonAnnoation.value()); idToType.put(jsonAnnoation.value(), TypeFactory.defaultInstance().constructSpecializedType(baseType, c)); idToType.put(c.getName(), TypeFactory.defaultInstance().constructSpecializedType(baseType, c)); } else { XmlRootElement xmlAnnoation = c.getAnnotation(XmlRootElement.class); if (xmlAnnoation != null && xmlAnnoation.name() != null) { typeToId.put(c, xmlAnnoation.name()); idToType.put(xmlAnnoation.name(), TypeFactory.defaultInstance().constructSpecializedType(baseType, c)); idToType.put(c.getName(), TypeFactory.defaultInstance().constructSpecializedType(baseType, c)); }/*w w w.j ava 2 s. co m*/ } } } }
From source file:org.brutusin.json.impl.JacksonFactoryWrapper.java
@Override public JsonStringFormatVisitor expectStringFormat(JavaType convertedType) { StringSchema s = (StringSchema) schemaProvider.stringSchema(); schema = s;//from w w w.j ava 2s. c om String format = getFormat(convertedType.getRawClass()); if (format != null) { s.setStringFormat(format); } return visitorFactory.stringFormatVisitor(s); }
From source file:java2typescript.jackson.module.visitors.TSJsonObjectFormatVisitor.java
private AbstractType getTSTypeForClass(AnnotatedMember member) { TypeBindings bindings = new TypeBindings(TypeFactory.defaultInstance(), member.getDeclaringClass()); JavaType javaType = member.getType(bindings); if (javaType.getRawClass().getSimpleName().equals("Observable")) { javaType = javaType.containedType(0); }/*w w w . java 2 s.c o m*/ BeanProperty prop = new BeanProperty.Std(member.getName(), javaType, NO_NAME, new AnnotationMap(), member, false); try { return getTSTypeForProperty(prop); } catch (JsonMappingException e) { throw new RuntimeException(e); } }
From source file:java2typescript.jackson.module.visitors.TSJsonObjectFormatVisitor.java
protected AbstractType getTSTypeForProperty(BeanProperty writer) throws JsonMappingException { if (writer == null) { throw new IllegalArgumentException("Null writer"); }/*from ww w. j a va2s .c om*/ JavaType type = writer.getType(); if (type.getRawClass().equals(Void.TYPE)) { return VoidType.getInstance(); } AbstractType customType = conf.getCustomTypes().get(type.getRawClass().getName()); if (customType != null) { return customType; } try { JsonSerializer<Object> ser = getSer(writer); if (ser != null) { if (type == null) { throw new IllegalStateException("Missing type for property '" + writer.getName() + "'"); } return getTSTypeForHandler(this, ser, type, conf); } else { return AnyType.getInstance(); } } catch (Exception e) { throw new RuntimeException(String.format(// "Error when serializing %s, you should add a custom mapping for it", type.getRawClass()), e); } }
From source file:io.swagger.test.SerializableParamExtractionTest.java
@Test public void getLongFallbackParameterClassTest() throws Exception { JavaType jt = utils.getTypeFromParameter(new QueryParameter().property(new BaseIntegerProperty("abc123")), null);//w w w .jav a 2s . co m assertEquals(jt.getRawClass(), Long.class); }