public StdValueInstantiator(DeserializationConfig config, JavaType valueType) { _valueTypeDesc = (valueType == null) ? "UNKNOWN TYPE" : valueType.toString(); _valueClass = (valueType == null) ? Object.class : valueType.getRawClass(); }
/** * Helper method called to get a description of type into which a scalar value coercion * is (most likely) being applied, to be used for constructing exception messages * on coerce failure. * * @return Message with backtick-enclosed name of type this deserializer supports * * @since 2.9 */ protected String _coercedTypeDesc() { boolean structured; String typeDesc; JavaType t = getValueType(); if ((t != null) && !t.isPrimitive()) { structured = (t.isContainerType() || t.isReferenceType()); // 21-Jul-2017, tatu: Probably want to change this (JavaType.toString() not very good) but... typeDesc = "'"+t.toString()+"'"; } else { Class<?> cls = handledType(); structured = cls.isArray() || Collection.class.isAssignableFrom(cls) || Map.class.isAssignableFrom(cls); typeDesc = ClassUtil.nameOf(cls); } if (structured) { return "as content of type "+typeDesc; } return "for type "+typeDesc; }
@Override public String toString() { return _jacksonType.toString(); }
public StdValueInstantiator(DeserializationConfig config, JavaType valueType) { _valueTypeDesc = (valueType == null) ? "UNKNOWN TYPE" : valueType.toString(); }
public StdValueInstantiator(DeserializationConfig config, JavaType valueType) { _valueTypeDesc = (valueType == null) ? "UNKNOWN TYPE" : valueType.toString(); }
public StdValueInstantiator(DeserializationConfig config, JavaType valueType) { _cfgEmptyStringsAsObjects = (config == null) ? false : config.isEnabled(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT); _valueTypeDesc = (valueType == null) ? "UNKNOWN TYPE" : valueType.toString(); }
public StdValueInstantiator(DeserializationConfig config, JavaType valueType) { _cfgEmptyStringsAsObjects = (config == null) ? false : config.isEnabled(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT); _valueTypeDesc = (valueType == null) ? "UNKNOWN TYPE" : valueType.toString(); }
public StdValueInstantiator(DeserializationConfig config, JavaType valueType) { _valueTypeDesc = (valueType == null) ? "UNKNOWN TYPE" : valueType.toString(); _valueClass = (valueType == null) ? Object.class : valueType.getRawClass(); }
public StdValueInstantiator(DeserializationConfig config, JavaType valueType) { _valueTypeDesc = (valueType == null) ? "UNKNOWN TYPE" : valueType.toString(); _valueClass = (valueType == null) ? Object.class : valueType.getRawClass(); }
@Override public String toString() { if (_bindings == null) { _resolve(); } StringBuilder sb = new StringBuilder("[TypeBindings for "); if (_contextType != null) { sb.append(_contextType.toString()); } else { sb.append(_contextClass.getName()); } sb.append(": ").append(_bindings).append("]"); return sb.toString(); } }
@Override public String toString() { if (_bindings == null) { _resolve(); } StringBuilder sb = new StringBuilder("[TypeBindings for "); if (_contextType != null) { sb.append(_contextType.toString()); } else { sb.append(_contextClass.getName()); } sb.append(": ").append(_bindings).append("]"); return sb.toString(); } }
@Override public String toString() { if (_bindings == null) { _resolve(); } StringBuilder sb = new StringBuilder("[TypeBindings for "); if (_contextType != null) { sb.append(_contextType.toString()); } else { sb.append(_contextClass.getName()); } sb.append(": ").append(_bindings).append("]"); return sb.toString(); } }
@Override public String toString() { if (_bindings == null) { _resolve(); } StringBuilder sb = new StringBuilder("[TypeBindings for "); if (_contextType != null) { sb.append(_contextType.toString()); } else { sb.append(_contextClass.getName()); } sb.append(": ").append(_bindings).append("]"); return sb.toString(); } }
public Object extract(ObjectNode node, RakamHttpRequest request) { JsonNode value = node.get(name); Object o; if (value == null) { o = null; } else { try { o = mapper.convertValue(value, type); } catch (IllegalArgumentException e) { throw new HttpRequestException(name + " body parameter cannot be cast to " + type.toString() + ": "+e.getMessage(), BAD_REQUEST); } } if (required && (o == null || o == NullNode.getInstance())) { throw new HttpRequestException(name + " body parameter is required", BAD_REQUEST); } return o; } }
className = _contextClass.getName(); } else if (_contextType != null) { className = _contextType.toString(); } else { className = "UNKNOWN";
className = _contextClass.getName(); } else if (_contextType != null) { className = _contextType.toString(); } else { className = "UNKNOWN";
className = _contextClass.getName(); } else if (_contextType != null) { className = _contextType.toString(); } else { className = "UNKNOWN";
@Override public JsonDeserializer<?> createContextual(DeserializationContext ctxt, BeanProperty property) throws JsonMappingException { checkNotNull(ctxt, "Null DeserializationContext."); JavaType type = checkNotNull(ctxt.getContextualType(), "Invalid type: %s", getClass()); JavaType[] params = type.findTypeParameters(ValueProvider.class); if (params.length != 1) { throw new RuntimeException("Unable to derive type for ValueProvider: " + type.toString()); } JavaType param = params[0]; return new Deserializer(param); }
protected Map<String, SlotTypeDefinition> resolveSlots(TypeReflector<?> reflector) { Map<String, SlotTypeDefinition> slots = new LinkedHashMap<>(); // TODO: order in some consistent way? for (PropertyDescriptor property : reflector.getPropertyDescriptors()) { if (reflector.getAnnotation(property, AlexaIgnore.class) != null) { continue; } SlotProperty slotProperty = reflector.getAnnotation(property, SlotProperty.class); if (slotProperty != null) { String name = slotProperty.name().isEmpty() ? property.getName() : slotProperty.name(); if (slots.containsKey(name)) { throw new IllegalArgumentException("Slot '" + name + "' defined multiple times on intent '" + reflector.getJavaType().toString()); } Class<?> slotClass = property.getPropertyType(); if (slotProperty.type() != Object.class) { slotClass = slotProperty.type(); } else if (slotClass == Object.class) { slotClass = reflector.reifyPropertyType(property); } slots.put(name, resolveSlotType(slotClass)); } } return slots; }
/** * Helper method called to get a description of type into which a scalar value coercion * is (most likely) being applied, to be used for constructing exception messages * on coerce failure. * * @return Message with backtick-enclosed name of type this deserializer supports * * @since 2.9 */ protected String _coercedTypeDesc() { boolean structured; String typeDesc; JavaType t = getValueType(); if ((t != null) && !t.isPrimitive()) { structured = (t.isContainerType() || t.isReferenceType()); // 21-Jul-2017, tatu: Probably want to change this (JavaType.toString() not very good) but... typeDesc = "'"+t.toString()+"'"; } else { Class<?> cls = handledType(); structured = cls.isArray() || Collection.class.isAssignableFrom(cls) || Map.class.isAssignableFrom(cls); typeDesc = ClassUtil.nameOf(cls); } if (structured) { return "as content of type "+typeDesc; } return "for type "+typeDesc; }