/** * @since 2.9 */ public <T> T reportBadDefinition(Class<?> type, String msg) throws JsonMappingException { return reportBadDefinition(constructType(type), msg); }
@Override public JavaType typeFromId(DatabindContext context, String id) { return context.constructType(ServiceInstanceEntity.class); }
@Override public JavaType typeFromId(DatabindContext ctxt, String id) { JsonFormatTypes stdType = JsonFormatTypes.forValue(id); if (stdType != null) { switch (stdType) { case ARRAY: return ctxt.constructType(ArraySchema.class); case BOOLEAN: return ctxt.constructType(BooleanSchema.class); case INTEGER: return ctxt.constructType(IntegerSchema.class); case NULL: return ctxt.constructType(NullSchema.class); case NUMBER: return ctxt.constructType(NumberSchema.class); case OBJECT: return ctxt.constructType(ObjectSchema.class); case STRING: return ctxt.constructType(StringSchema.class); case ANY: default: return ctxt.constructType(AnySchema.class); } } // Not a standard type; should use a custom sub-type impl throw new IllegalArgumentException("Can not resolve JsonSchema 'type' id of \""+id +"\", not recognized as one of standard values: "+Arrays.asList(JsonFormatTypes.values())); }
switch (id) { case "regex.Star": return context.constructType(iguana.regex.Star.class); case "regex.Plus": return context.constructType(iguana.regex.Plus.class); case "regex.Alt": return context.constructType(iguana.regex.Alt.class); case "regex.Opt": return context.constructType(iguana.regex.Opt.class); case "IfThenElseExpr": return context.constructType(Expression.IfThenElse.class); try { Class<?> clazz = Class.forName(packageName + id); javaType = context.constructType(clazz); break; } catch (ClassNotFoundException e) {
@Override public JavaType typeFromId(DatabindContext ctxt, String id) { JsonFormatTypes stdType = JsonFormatTypes.forValue(id); if (stdType != null) { switch (stdType) { case ARRAY: return ctxt.constructType(ArraySchema.class); case BOOLEAN: return ctxt.constructType(BooleanSchema.class); case INTEGER: return ctxt.constructType(IntegerSchema.class); case NULL: return ctxt.constructType(NullSchema.class); case NUMBER: return ctxt.constructType(NumberSchema.class); case OBJECT: return ctxt.constructType(ObjectSchema.class); case STRING: return ctxt.constructType(StringSchema.class); case ANY: default: return ctxt.constructType(AnySchema.class); } } // Not a standard type; should use a custom sub-type impl throw new IllegalArgumentException("Can not resolve JsonSchema 'type' id of \""+id +"\", not recognized as one of standard values: "+Arrays.asList(JsonFormatTypes.values())); }
@Override public JavaType typeFromId(DatabindContext context, String id) throws IOException { Class t = null; if (id.equals("integer")) { t = DataEntry.LongEntry.class; } else if (id.equals("boolean")) { t = DataEntry.BooleanEntry.class; } else if (id.equals("binary")) { t = DataEntry.BinaryEntry.class; } else if (id.equals("string")) { t = DataEntry.StringEntry.class; } return context.constructType(t); } }
/** * @since 2.9 */ public <T> T reportBadDefinition(Class<?> type, String msg) throws JsonMappingException { return reportBadDefinition(constructType(type), msg); }
@Override public JavaType typeFromId(DatabindContext context, String id) throws IOException { try { Class<?> type = Class.forName(id); return context.constructType(type); } catch (ClassNotFoundException e) { if(!(context instanceof DeserializationContext)) { throw new RuntimeException(e); } //see magic from ClassNameIdResolver._typeFromId() return ((DeserializationContext) context).handleUnknownTypeId(_baseType, id, this, "Class '" + id + "' not found."); } }
@Override public JavaType typeFromId(DatabindContext context, String id) throws IOException { Class<?> type = idToClassMapping.get(id); if (type == null) { synchronized (TypeAliasIdResolver.class) { type = idToClassMapping.get(id); if (type == null) { int commaPos = id.indexOf(","); if (commaPos > 0) { String exactId = id.substring(0, commaPos).trim(); type = idToClassMapping.get(exactId); if (type != null) { idToClassMapping.put(id, type); } } } } } if (type != null) { return context.constructType(type); } else { throw new IllegalArgumentException(String.format("Unknown type for id %s", id)); } }
@SuppressWarnings("unchecked") @Override public JavaType typeFromId(final DatabindContext context, final String id) { return context.constructType(beanTypeResolver.resolveTypeClass(id, (Class<ConfiguredBean>) baseType.getRawClass())); }