private String[] xmlNames(Collection<? extends ConfigModel.Property> properties) { List<String> names = new ArrayList<String>(); for (ConfigModel.Property attribute : properties) { names.add(attribute.xmlName()); } return names.toArray(new String[names.size()]); }
void _setter(ConfigModel.Property target, Object value) throws Exception { Object oldValue = super.getter(target, value.getClass()); PropertyChangeEvent evt = new PropertyChangeEvent(this, target.xmlName(), oldValue, value); for (ConfigBeanInterceptor interceptor : optionalFeatures.values()) { interceptor.beforeChange(evt); } super.setter(target, value); for (ConfigBeanInterceptor interceptor : optionalFeatures.values()) { interceptor.afterChange(evt, System.currentTimeMillis()); } }
public Object getter(ConfigModel.Property property, java.lang.reflect.Type t) { Object value = bean._getter(property, t); if (value instanceof List) { if (!changedCollections.containsKey(property.xmlName())) { // wrap collections so we can record events on that collection mutation. changedCollections.put(property.xmlName(), new ProtectedList(List.class.cast(value), defaultView, property.xmlName())); } return changedCollections.get(property.xmlName()); } return value; }
void _setter(ConfigModel.Property target, Object value) throws Exception { Object oldValue = super.getter(target, value.getClass()); PropertyChangeEvent evt = new PropertyChangeEvent(this, target.xmlName(), oldValue, value); for (ConfigBeanInterceptor interceptor : optionalFeatures.values()) { interceptor.beforeChange(evt); } super.setter(target, value); for (ConfigBeanInterceptor interceptor : optionalFeatures.values()) { interceptor.afterChange(evt, System.currentTimeMillis()); } }
protected void setter(ConfigModel.Property target, Object value) throws Exception { if (!writeLock) { throw new PropertyVetoException("Instance of " + typeName() + " named '" + getKey() + "' is not locked for writing when changing attribute " + target.xmlName() + ", you must use transaction semantics to access it.", null); } _setter(target, value); }
private String[] xmlNames(Collection<? extends ConfigModel.Property> properties) { List<String> names = new ArrayList<String>(); for (ConfigModel.Property attribute : properties) { names.add(attribute.xmlName()); } return names.toArray(new String[names.size()]); }
void _setter(ConfigModel.Property target, Object value) throws Exception { Object oldValue = super.getter(target, value.getClass()); PropertyChangeEvent evt = new PropertyChangeEvent(this, target.xmlName(), oldValue, value); for (ConfigBeanInterceptor interceptor : optionalFeatures.values()) { interceptor.beforeChange(evt); } super.setter(target, value); for (ConfigBeanInterceptor interceptor : optionalFeatures.values()) { interceptor.afterChange(evt, System.currentTimeMillis()); } }
public String getPropertyValue(String propertyName) { ConfigModel.Property prop = this.getProperty(propertyName); if (prop!=null) { if (changedAttributes.containsKey(prop.xmlName())) { // serve masked changes. return (String) changedAttributes.get(prop.xmlName()).getNewValue(); } else { return (String) getter(prop, String.class); } } return null; }
void _setter(ConfigModel.Property target, Object value) throws Exception { Object oldValue = super.getter(target, value.getClass()); PropertyChangeEvent evt = new PropertyChangeEvent(this, target.xmlName(), oldValue, value); for (ConfigBeanInterceptor interceptor : optionalFeatures.values()) { interceptor.beforeChange(evt); } super.setter(target, value); for (ConfigBeanInterceptor interceptor : optionalFeatures.values()) { interceptor.afterChange(evt, System.currentTimeMillis()); } }
public String getPropertyValue(String propertyName) { ConfigModel.Property prop = this.getProperty(propertyName); if (prop!=null) { if (changedAttributes.containsKey(prop.xmlName())) { // serve masked changes. return (String) changedAttributes.get(prop.xmlName()).getNewValue(); } else { return (String) getter(prop, String.class); } } return null; }
public Object getter(ConfigModel.Property property, java.lang.reflect.Type t) { Object value = bean._getter(property, t); if (value instanceof List) { if (!changedCollections.containsKey(property.xmlName())) { // wrap collections so we can record events on that collection mutation. changedCollections.put(property.xmlName(), new ProtectedList(List.class.cast(value), defaultView, property.xmlName())); } return changedCollections.get(property.xmlName()); } return value; }
Object _getter(ConfigModel.Property target, Type t) { final Object value = super.getter(target,t); for (ConfigBeanInterceptor interceptor : optionalFeatures.values()) { interceptor.readValue(this, target.xmlName(), value); } return value; }
protected void setter(ConfigModel.Property target, Object value) throws Exception { if (!writeLock) { throw new PropertyVetoException("Instance of " + getImplementation() + " named '" + getKey() + "' is not locked for writing when changing attribute " + target.xmlName() + ", you must use transaction semantics to access it.", null); } _setter(target, value); }
defaultView,property.xmlName(), oldValue, newValue); try { for (ConfigBeanInterceptor interceptor : bean.getOptionalFeatures()) { changedAttributes.put(property.xmlName(), evt); for (ConfigBeanInterceptor interceptor : bean.getOptionalFeatures()) { interceptor.afterChange(evt, System.currentTimeMillis());
private void handleValidation(ConfigModel.Property property, Object value) throws ConstraintViolationException { // First check for dataType constraints -- as was done for v3 Prelude // These validations could be transformed into BV custom annotations // such as AssertBoolean, AssertInteger etc. But since GUI and other // config clients such as AMX need dataType key in @Attribute it's been // decided to validate using existing annotation information Set<ConstraintViolation<?>> constraintViolations = new HashSet<ConstraintViolation<?>>(); if (property instanceof ConfigModel.AttributeLeaf) { ConfigModel.AttributeLeaf al = (ConfigModel.AttributeLeaf)property; if (!al.isReference()) { ConstraintViolation cv = validateDataType(al, value.toString()); if (cv!=null) { constraintViolations.add(cv); } } } constraintViolations.addAll( beanValidator.validateValue( bean.getProxyType(), toCamelCase(property.xmlName()), value)); handleValidationException(constraintViolations); }
Object _getter(ConfigModel.Property target, Type t) { final Object value = super.getter(target,t); for (ConfigBeanInterceptor interceptor : optionalFeatures.values()) { interceptor.readValue(this, target.xmlName(), value); } return value; }
protected void setter(ConfigModel.Property target, Object value) throws Exception { if (!writeLock) { throw new PropertyVetoException("Instance of " + getImplementation() + " named '" + getKey() + "' is not locked for writing when changing attribute " + target.xmlName() + ", you must use transaction semantics to access it.", null); } _setter(target, value); }
public String getPropertyValue(String propertyName) { ConfigModel.Property prop = this.getProperty(propertyName); if (prop!=null) { if (changedAttributes.containsKey(prop.xmlName())) { // serve masked changes. return (String) changedAttributes.get(prop.xmlName()).getNewValue(); } else { return (String) getter(prop, String.class); } } return null; }
public synchronized Object getter(ConfigModel.Property property, java.lang.reflect.Type t) { Object value = bean._getter(property, t); if (value instanceof List) { if (!changedCollections.containsKey(property.xmlName())) { // wrap collections so we can record events on that collection mutation. changedCollections.put(property.xmlName(), new ProtectedList(List.class.cast(value), defaultView, property.xmlName())); } return changedCollections.get(property.xmlName()); } return value; }