-\r
- @Override\r
- protected void toString(Object value, BindingPrintContext ctx) throws BindingException {\r
- if(hasValue(value)) {\r
- getComponentBinding().toString(getValue(value), ctx);\r
- } else {\r
- ctx.b.append("null");\r
- }\r
- }\r
- \r
- @Override\r
- public Binding getComponentBinding(ChildReference path) {\r
- if (path==null) return this;\r
- if (path instanceof KeyReference) throw new IllegalArgumentException("KeyReference is not supported in OptionalType"); \r
- if (path instanceof NameReference) throw new IllegalArgumentException("NameReference is not supported in OptionalType"); \r
- if (path instanceof IndexReference && ((IndexReference) path).index!=0) throw new IllegalArgumentException("Index out of bounds");\r
- if (path instanceof LabelReference && !((LabelReference) path).label.equals("v")) throw new IllegalArgumentException("Unknown label");\r
- return componentBinding.getComponentBinding(path.childReference);\r
- } \r
- \r
- @Override\r
- public int getComponentCount() {\r
- return 1;\r
- }\r
- \r
- @Override\r
- public Binding getComponentBinding(int index) {\r
- if (index==0) return componentBinding;\r
- throw new IllegalArgumentException();\r
- }\r
-\r
- @Override\r
- protected boolean deepEquals(Object obj,\r
- Set<IdentityPair<Binding, Binding>> compareHistory) {\r
- return super.deepEquals( obj, compareHistory ) && componentBinding.equals(((OptionalBinding) obj).componentBinding, compareHistory);\r
- }\r
- \r
- @Override\r
- public int deepHashCode(IdentityHashMap<Object, Object> hashedObjects) {\r
- return super.deepHashCode( hashedObjects ) + componentBinding.hashCode(hashedObjects);\r
+
+ @Override
+ protected void toString(Object value, BindingPrintContext ctx) throws BindingException {
+ if(hasValue(value)) {
+ getComponentBinding().toString(getValue(value), ctx);
+ } else {
+ ctx.b.append("null");
+ }
+ }
+
+ @Override
+ public Binding getComponentBinding(ChildReference path) {
+ if (path==null) return this;
+ if (path instanceof KeyReference) throw new IllegalArgumentException("KeyReference is not supported in OptionalType");
+ if (path instanceof NameReference) throw new IllegalArgumentException("NameReference is not supported in OptionalType");
+ if (path instanceof IndexReference && ((IndexReference) path).index!=0) throw new IllegalArgumentException("Index out of bounds");
+ if (path instanceof LabelReference && !((LabelReference) path).label.equals("v")) throw new IllegalArgumentException("Unknown label");
+ return componentBinding.getComponentBinding(path.childReference);
+ }
+
+ @Override
+ public int getComponentCount() {
+ return 1;
+ }
+
+ @Override
+ public Binding getComponentBinding(int index) {
+ if (index==0) return componentBinding;
+ throw new IllegalArgumentException();
+ }
+
+ @Override
+ protected boolean deepEquals(Object obj,
+ Set<IdentityPair<Binding, Binding>> compareHistory) {
+ return super.deepEquals( obj, compareHistory ) && componentBinding.equals(((OptionalBinding) obj).componentBinding, compareHistory);
+ }
+
+ @Override
+ public int deepHashCode(IdentityHashMap<Object, Object> hashedObjects) {
+ return super.deepHashCode( hashedObjects ) + componentBinding.hashCode(hashedObjects);