- String encodeValue(final @NonNull ValueWriter writer, final @NonNull SchemaNode schemaNode,
- final @NonNull Object value, final QNameModule parent) throws XMLStreamException {
- checkArgument(schemaNode instanceof TypeAware,
- "Unable to write value for node %s, only nodes of type: leaf, leaf-list and annotations can be written "
- + "at this point", schemaNode.getQName());
-
- TypeDefinition<?> type = ((TypeAware) schemaNode).getType();
- if (type instanceof LeafrefTypeDefinition) {
- type = getBaseTypeForLeafRef(schemaNode, (LeafrefTypeDefinition) type);
- }
-
- return encodeValue(writer, type, value, parent);
+ String encodeValue(final @NonNull ValueWriter writer,final @NonNull SchemaNode schemaNode,
+ final TypeDefinition<?> type, final @NonNull Object value, final QNameModule parent)
+ throws XMLStreamException {
+ return type instanceof LeafrefTypeDefinition
+ ? encodeValue(writer, getBaseTypeForLeafRef(schemaNode, (LeafrefTypeDefinition) type), value, parent)
+ : encodeValue(writer, type, value, parent);