use of com.fasterxml.jackson.databind.type.TypeFactory in project jackson-databind by FasterXML.
the class TestJDKSerialization method testTypeFactory.
public void testTypeFactory() throws Exception {
TypeFactory orig = TypeFactory.defaultInstance();
JavaType t = orig.constructType(JavaType.class);
assertNotNull(t);
byte[] bytes = jdkSerialize(orig);
TypeFactory result = jdkDeserialize(bytes);
assertNotNull(result);
t = orig.constructType(JavaType.class);
assertEquals(JavaType.class, t.getRawClass());
}
use of com.fasterxml.jackson.databind.type.TypeFactory in project jackson-databind by FasterXML.
the class TestCoreXMLTypes method testDeserializerLoading.
/*
/**********************************************************
/* Deserializer tests
/**********************************************************
*/
// First things first: must be able to load the deserializers...
public void testDeserializerLoading() {
CoreXMLDeserializers sers = new CoreXMLDeserializers();
TypeFactory f = TypeFactory.defaultInstance();
sers.findBeanDeserializer(f.constructType(Duration.class), null, null);
sers.findBeanDeserializer(f.constructType(XMLGregorianCalendar.class), null, null);
sers.findBeanDeserializer(f.constructType(QName.class), null, null);
}
use of com.fasterxml.jackson.databind.type.TypeFactory in project jackson-databind by FasterXML.
the class TestTypeResolution method testListViaTypeRef.
public void testListViaTypeRef() {
TypeFactory tf = TypeFactory.defaultInstance();
JavaType t = tf.constructType(new TypeReference<MyLongList<Integer>>() {
});
CollectionType type = (CollectionType) t;
assertSame(MyLongList.class, type.getRawClass());
assertEquals(tf.constructType(Long.class), type.getContentType());
}
use of com.fasterxml.jackson.databind.type.TypeFactory in project jackson-databind by FasterXML.
the class TestTypeResolution method testMaps.
/*
/**********************************************************
/* Test methods
/**********************************************************
*/
public void testMaps() {
TypeFactory tf = TypeFactory.defaultInstance();
JavaType t = tf.constructType(new TypeReference<LongValuedMap<String>>() {
});
MapType type = (MapType) t;
assertSame(LongValuedMap.class, type.getRawClass());
assertEquals(tf.constructType(String.class), type.getKeyType());
assertEquals(tf.constructType(Long.class), type.getContentType());
}
use of com.fasterxml.jackson.databind.type.TypeFactory in project jackson-databind by FasterXML.
the class TestTypeResolution method testListViaClass.
public void testListViaClass() {
TypeFactory tf = TypeFactory.defaultInstance();
JavaType t = tf.constructType(LongList.class);
JavaType type = (CollectionType) t;
assertSame(LongList.class, type.getRawClass());
assertEquals(tf.constructType(Long.class), type.getContentType());
}
Aggregations