- public static class LeafModificationStrategy extends ValueNodeModificationStrategy<LeafSchemaNode> {
- @SuppressWarnings({ "unchecked", "rawtypes" })
- protected LeafModificationStrategy(final LeafSchemaNode schema) {
- super(schema, (Class) LeafNode.class);
- }
+ @Override
+ void verifyValue(final NormalizedNode writtenValue) {
+ verifyWrittenValue(writtenValue);
+ }
+
+ @Override
+ void recursivelyVerifyStructure(final NormalizedNode value) {
+ verifyWrittenValue(value);
+ }
+
+ @Override
+ ToStringHelper addToStringAttributes(final ToStringHelper helper) {
+ return helper.add("value", nodeClass.getSimpleName());
+ }
+
+ private void verifyWrittenValue(final NormalizedNode value) {
+ checkArgument(nodeClass.isInstance(value), "Expected an instance of %s, have %s", nodeClass, value);