@Test public void shouldMapInt() { Assert.assertEquals(IntNode.valueOf(42), this.mapper.map(42)); Assert.assertEquals(IntNode.valueOf(42), this.mapper.map((short) 42)); Assert.assertEquals(IntNode.valueOf(42), this.mapper.map((byte) 42)); Assert.assertEquals(IntNode.valueOf(42), this.mapper.map(42, null, IntNode.class)); Assert.assertEquals(IntNode.valueOf(42), this.mapper.map(42d, null, IntNode.class)); Assert.assertEquals(IntNode.valueOf(42), this.mapper.map(42L, null, IntNode.class)); Assert.assertEquals(IntNode.valueOf(42), this.mapper.map(42, null, INumericNode.class)); Assert.assertEquals(IntNode.valueOf(42), this.mapper.map(42, null, AbstractNumericNode.class)); Assert.assertEquals(IntNode.valueOf(42), this.mapper.map(42, null, IPrimitiveNode.class)); Assert.assertEquals(IntNode.valueOf(42), this.mapper.map(42, null, IJsonNode.class)); Assert.assertEquals(IntNode.valueOf(42), this.mapper.map(42, null, AbstractJsonNode.class)); Assert.assertEquals(IntNode.valueOf(42), this.mapper.map(42, null, Object.class)); Assert.assertSame(IntNode.class, this.mapper.getDefaultMappingType(Integer.TYPE)); Assert.assertSame(IntNode.class, this.mapper.getDefaultMappingType(Integer.class)); Assert.assertSame(IntNode.class, this.mapper.getDefaultMappingType(Byte.TYPE)); Assert.assertSame(IntNode.class, this.mapper.getDefaultMappingType(Byte.class)); Assert.assertSame(IntNode.class, this.mapper.getDefaultMappingType(Short.TYPE)); Assert.assertSame(IntNode.class, this.mapper.getDefaultMappingType(Short.class)); }
public IJsonNode map(final Object value) { if (value == null) return NullNode.getInstance(); final Type type = this.getDefaultMappingType(value.getClass()); if (type == null) throw new IllegalArgumentException("Cannot find appropriate json type for " + value); return this.map(value, null, type); }
JavaToJsonMapper extends AbstractTypeMapper<TypeMapper<?, ?>> { public IJsonNode map(final Object value) { if (value == null) return NullNode.getInstance(); final Type type = this.getDefaultMappingType(value.getClass()); if (type == null) throw new IllegalArgumentException("Cannot find appropriate json type for " + value); return this.map(value, null, type); } }
JavaToJsonMapper extends AbstractTypeMapper<TypeMapper<?, ?>> { public IJsonNode map(final Object value) { if (value == null) return NullNode.getInstance(); final Type type = this.getDefaultMappingType(value.getClass()); if (type == null) throw new IllegalArgumentException("Cannot find appropriate json type for " + value); return this.map(value, null, type); } protected  JavaToJsonMapper(); }
JavaToJsonMapper extends AbstractTypeMapper<TypeMapper<?, ?>> { public IJsonNode map(final Object value) { if (value == null) return NullNode.getInstance(); final Type type = this.getDefaultMappingType(value.getClass()); if (type == null) throw new IllegalArgumentException("Cannot find appropriate json type for " + value); return this.map(value, null, type); } protected  JavaToJsonMapper(); @SuppressWarnings("unchecked") TypeMapper<F, T> getMapper(final Class<?> fromClass, final Class<T> targetType); IJsonNode map(final Object value); @SuppressWarnings("unchecked") T map(final Object from, final T to, final Type targetType); }
JavaToJsonMapper extends AbstractTypeMapper<TypeMapper<?, ?>> { public IJsonNode map(final Object value) { if (value == null) return NullNode.getInstance(); final Type type = this.getDefaultMappingType(value.getClass()); if (type == null) throw new IllegalArgumentException("Cannot find appropriate json type for " + value); return this.map(value, null, type); } protected  JavaToJsonMapper(); @SuppressWarnings("unchecked") TypeMapper<F, T> getMapper(final Class<?> fromClass, final Class<T> targetType); IJsonNode map(final Object value); @SuppressWarnings("unchecked") T map(final Object from, final T to, final Type targetType); static final JavaToJsonMapper INSTANCE; }