- checkArgument(schemaNode instanceof LeafSchemaNode, "schemaNode must be of type LeafSchemaNode");
- final JSONCodec<?> objectJSONCodec = codecFactory.codecFor((LeafSchemaNode) schemaNode, resolver);
- return objectJSONCodec.parseValue(null, value);
+ if (schemaNode instanceof LeafSchemaNode) {
+ return codecFactory.codecFor((LeafSchemaNode) schemaNode, resolver).parseValue(null, value);
+ } else if (schemaNode instanceof LeafListSchemaNode) {
+ return codecFactory.codecFor((LeafListSchemaNode) schemaNode, resolver).parseValue(null, value);
+ }
+ throw new IllegalArgumentException("schemaNode " + schemaNode
+ + " must be of type LeafSchemaNode or LeafListSchemaNode");