*/
package org.opendaylight.yangtools.yang.data.codec.gson;
-import com.google.common.base.Preconditions;
+import static com.google.common.base.Preconditions.checkArgument;
+import static java.util.Objects.requireNonNull;
+
import com.google.gson.stream.JsonWriter;
import java.io.IOException;
import java.net.URI;
private final SchemaContext context;
JSONStringInstanceIdentifierCodec(final SchemaContext context, final JSONCodecFactory jsonCodecFactory) {
- this.context = Preconditions.checkNotNull(context);
+ this.context = requireNonNull(context);
this.dataContextTree = DataSchemaContextTree.from(context);
- this.codecFactory = Preconditions.checkNotNull(jsonCodecFactory);
+ this.codecFactory = requireNonNull(jsonCodecFactory);
}
@Override
@Override
protected Object deserializeKeyValue(final DataSchemaNode schemaNode, final String value) {
- Preconditions.checkNotNull(schemaNode, "schemaNode cannot be null");
- Preconditions.checkArgument(schemaNode instanceof LeafSchemaNode, "schemaNode must be of type LeafSchemaNode");
+ requireNonNull(schemaNode, "schemaNode cannot be null");
+ checkArgument(schemaNode instanceof LeafSchemaNode, "schemaNode must be of type LeafSchemaNode");
final JSONCodec<?> objectJSONCodec = codecFactory.codecFor((LeafSchemaNode) schemaNode);
return objectJSONCodec.parseValue(null, value);
}