@Test public void testWrite() throws AccessException { String key = "someKey"; String value = "someValue"; accessor.write(evalContext, objWithExt, key, value); Assert.assertEquals(value, objWithExt.getExtendedAttributes().get(key)); }
@Override public void write(EvaluationContext context, Object target, String name, Object newValue) throws AccessException { BaseObjectWithExts<?> objWithExt = (BaseObjectWithExts<?>) target; if (objWithExt.getExtendedAttributes() == null) { objWithExt.setExtendedAttributes(new HashMap<String, String>()); } objWithExt.getExtendedAttributes().put(name, (String) newValue); }
ExtendedAttributePropertyAccessor implements PropertyAccessor { @Override public void write(EvaluationContext context, Object target, String name, Object newValue) throws AccessException { BaseObjectWithExts<?> objWithExt = (BaseObjectWithExts<?>) target; if (objWithExt.getExtendedAttributes() == null) { objWithExt.setExtendedAttributes(new HashMap<String, String>()); } objWithExt.getExtendedAttributes().put(name, (String) newValue); } }
ExtendedAttributePropertyAccessor implements PropertyAccessor { @Override public void write(EvaluationContext context, Object target, String name, Object newValue) throws AccessException { BaseObjectWithExts<?> objWithExt = (BaseObjectWithExts<?>) target; if (objWithExt.getExtendedAttributes() == null) { objWithExt.setExtendedAttributes(new HashMap<String, String>()); } objWithExt.getExtendedAttributes().put(name, (String) newValue); }  }
ExtendedAttributePropertyAccessor implements PropertyAccessor { @Override public void write(EvaluationContext context, Object target, String name, Object newValue) throws AccessException { BaseObjectWithExts<?> objWithExt = (BaseObjectWithExts<?>) target; if (objWithExt.getExtendedAttributes() == null) { objWithExt.setExtendedAttributes(new HashMap<String, String>()); } objWithExt.getExtendedAttributes().put(name, (String) newValue); }  @Override Class<?>[] getSpecificTargetClasses(); @Override boolean canRead(EvaluationContext context, Object target, String name); @Override TypedValue read(EvaluationContext context, Object target, String name); @Override boolean canWrite(EvaluationContext context, Object target, String name); @Override void write(EvaluationContext context, Object target, String name, Object newValue); }
ExtendedAttributePropertyAccessor implements PropertyAccessor { @Override public void write(EvaluationContext context, Object target, String name, Object newValue) throws AccessException { BaseObjectWithExts<?> objWithExt = (BaseObjectWithExts<?>) target; if (objWithExt.getExtendedAttributes() == null) { objWithExt.setExtendedAttributes(new HashMap<String, String>()); } objWithExt.getExtendedAttributes().put(name, (String) newValue); }  @Override Class<?>[] getSpecificTargetClasses(); @Override boolean canRead(EvaluationContext context, Object target, String name); @Override TypedValue read(EvaluationContext context, Object target, String name); @Override boolean canWrite(EvaluationContext context, Object target, String name); @Override void write(EvaluationContext context, Object target, String name, Object newValue);  }