@Override public JavaType getType() { return _property.getType(); }
public static NullsFailProvider constructForProperty(BeanProperty prop) { return new NullsFailProvider(prop.getFullName(), prop.getType()); }
@Override public JsonSerializer<?> createContextual(SerializerProvider provider, BeanProperty property) throws JsonMappingException { JavaType propertyType = property.getType(); if (Score.class.equals(propertyType.getRawClass())) { // If the property type is Score (not HardSoftScore for example), // delegate to PolymorphicScoreJacksonJsonSerializer instead to write the score type too // This presumes that OptaPlannerJacksonModule is registered return provider.findValueSerializer(propertyType); } return this; }
@Override public JsonSerializer<?> createContextual(SerializerProvider provider, BeanProperty property) throws JsonMappingException { JavaType propertyType = property.getType(); if (Score.class.equals(propertyType.getRawClass())) { // If the property type is Score (not HardSoftScore for example), // delegate to PolymorphicScoreJacksonJsonSerializer instead to write the score type too // This presumes that OptaPlannerJacksonModule is registered return provider.findValueSerializer(propertyType); } return this; }
/** * Helper method used to indicate a problem with input in cases where more * specific <code>reportXxx()</code> method was not available. * * @since 2.9 */ public <T> T reportInputMismatch(BeanProperty prop, String msg, Object... msgArgs) throws JsonMappingException { msg = _format(msg, msgArgs); JavaType type = (prop == null) ? null : prop.getType(); throw MismatchedInputException.from(getParser(), type, msg); }
public void getAndSerialize(Object bean, JsonGenerator gen, SerializerProvider provider) throws Exception { Object value = _accessor.getValue(bean); if (value == null) { return; } if (!(value instanceof Map<?,?>)) { provider.reportBadDefinition(_property.getType(), String.format( "Value returned by 'any-getter' %s() not java.util.Map but %s", _accessor.getName(), value.getClass().getName())); } // 23-Feb-2015, tatu: Nasty, but has to do (for now) if (_mapSerializer != null) { _mapSerializer.serializeFields((Map<?,?>) value, gen, provider); return; } _serializer.serialize(value, gen, provider); }
/** * @since 2.3 */ public void getAndFilter(Object bean, JsonGenerator gen, SerializerProvider provider, PropertyFilter filter) throws Exception { Object value = _accessor.getValue(bean); if (value == null) { return; } if (!(value instanceof Map<?,?>)) { provider.reportBadDefinition(_property.getType(), String.format("Value returned by 'any-getter' (%s()) not java.util.Map but %s", _accessor.getName(), value.getClass().getName())); } // 19-Oct-2014, tatu: Should we try to support @JsonInclude options here? if (_mapSerializer != null) { _mapSerializer.serializeFilteredAnyProperties(provider, gen, bean,(Map<?,?>) value, filter, null); return; } // ... not sure how custom handler would do it _serializer.serialize(value, gen, provider); }
.getAnnotation(SkipWrapperObject.class); wrapperKey = skipWrapperObject.value(); JavaType collectionType = property.getType(); JavaType collectedType = collectionType.containedType(0); wrappedType = collectedType.getRawClass();
ValueInstantiator vi = ((BeanDeserializerBase) valueDeser).getValueInstantiator(); if (!vi.canCreateUsingDefault()) { final JavaType type = prop.getType(); ctxt.reportBadDefinition(type, String.format("Cannot create empty instance of %s, no default Creator", type));
@Override public JsonSerializer<?> createContextual(final SerializerProvider prov, final BeanProperty property) throws JsonMappingException { //return property.get; if (property != null) { final JavaType type = property.getType(); if (type != null) { final Class<?> clazz = type.getRawClass(); if (type.isCollectionLikeType()) { return new RefSerializer(type.getContentType().getRawClass()); } if (type.isMapLikeType()) { return new RefSerializer(type.getContentType().getRawClass()); } if (clazz != null) { return new RefSerializer(clazz); } } } return this; } }
@Override public JsonDeserializer<?> createContextual(DeserializationContext ctxt, BeanProperty property) throws JsonMappingException { JavaType vc = property.getType().getContentType(); HalResourcesDeserializer des = new HalResourcesDeserializer(vc); return des; } }
@Override public JsonDeserializer<?> createContextual(DeserializationContext ctxt, BeanProperty property) throws JsonMappingException { return new HalFormsResourcesDeserializer( property == null ? ctxt.getContextualType() : property.getType().getContentType()); } }
@Override public JsonDeserializer<?> createContextual(DeserializationContext ctxt, BeanProperty property) throws JsonMappingException { if (property != null) { JavaType vc = property.getType().getContentType(); return new UberResourcesDeserializer(vc); } else { return new UberResourcesDeserializer(ctxt.getContextualType()); } }
@Override public JsonDeserializer<?> createContextual(DeserializationContext ctxt, BeanProperty property) throws JsonMappingException { if (property != null) { JavaType vc = property.getType().getContentType(); return new UberResourceDeserializer(vc); } else { return new UberResourceDeserializer(ctxt.getContextualType()); } }
@Override public JsonDeserializer<?> createContextual(DeserializationContext ctxt, BeanProperty property) throws JsonMappingException { if (property != null) { JavaType vc = property.getType().getContentType(); CollectionJsonResourcesDeserializer des = new CollectionJsonResourcesDeserializer(vc); return des; } else { return new CollectionJsonResourcesDeserializer(ctxt.getContextualType()); } } }
@Override public JsonDeserializer<?> createContextual(DeserializationContext ctxt, BeanProperty property) throws JsonMappingException { if (property != null) { JavaType vc = property.getType().getContentType(); return new UberPagedResourcesDeserializer(vc); } else { return new UberPagedResourcesDeserializer(ctxt.getContextualType()); } }
@Override public JsonDeserializer<?> createContextual(DeserializationContext ctxt, BeanProperty property) throws JsonMappingException { if (property != null) { return new CollectionJsonResourceSupportDeserializer(property.getType().getContentType()); } else { return new CollectionJsonResourceSupportDeserializer(ctxt.getContextualType()); } } }
@Override public JsonDeserializer<?> createContextual(DeserializationContext ctxt, BeanProperty property) throws JsonMappingException { if (property != null) { return new CollectionJsonResourceDeserializer(property.getType().getContentType()); } else { return new CollectionJsonResourceDeserializer(ctxt.getContextualType()); } } }
@Override public JsonDeserializer<?> createContextual(DeserializationContext ctxt, BeanProperty property) throws JsonMappingException { if (property != null) { JavaType vc = property.getType().getContentType(); return new UberResourceSupportDeserializer(vc); } else { return new UberResourceSupportDeserializer(ctxt.getContextualType()); } }
@Override public JsonDeserializer<?> createContextual(DeserializationContext ctxt, BeanProperty property) throws JsonMappingException { if (property != null) { JavaType vc = property.getType().getContentType(); CollectionJsonPagedResourcesDeserializer des = new CollectionJsonPagedResourcesDeserializer(vc); return des; } else { return new CollectionJsonPagedResourcesDeserializer(ctxt.getContextualType()); } }