@Override public void addAllVariables(Collection<String> variables) { if (variables == null) { return; } for (String item : variables) { addVariables(item); } }
@Override public String getType() { fireOnPreRead(PROPERTY_TYPE, type); String result = this.type; fireOnPostRead(PROPERTY_TYPE, type); return result; }
@Override public void setType(String type) { String oldValue = this.type; fireOnPreWrite(PROPERTY_TYPE, oldValue, type); this.type = type; fireOnPostWrite(PROPERTY_TYPE, oldValue, type); }
@Override public boolean isVariablesEmpty() { int size = sizeVariables(); return size == 0; }
@Override public void setVariables(Collection<String> variables) { // Copy elements to keep data for fire with new reference Collection<String> oldValue = this.variables != null ? new ArrayList<String>(this.variables) : null; fireOnPreWrite(PROPERTY_VARIABLES, oldValue, variables); this.variables = variables; fireOnPostWrite(PROPERTY_VARIABLES, oldValue, variables); }
@Override public void clearVariables() { if (this.variables == null) { return; } Collection<String> oldValue = new ArrayList<String>(this.variables); fireOnPreWrite(PROPERTY_VARIABLES, oldValue, this.variables); this.variables.clear(); fireOnPostWrite(PROPERTY_VARIABLES, oldValue, this.variables); }
@Override public void addVariables(String variables) { fireOnPreWrite(PROPERTY_VARIABLES, null, variables); if (this.variables == null) { this.variables = new ArrayList<String>(); } this.variables.add(variables); fireOnPostWrite(PROPERTY_VARIABLES, this.variables.size(), null, variables); }
@Override public void removeVariables(String variables) { fireOnPreWrite(PROPERTY_VARIABLES, variables, null); if (this.variables == null || !this.variables.remove(variables)) { throw new IllegalArgumentException("List does not contain given element"); } fireOnPostWrite(PROPERTY_VARIABLES, this.variables.size() + 1, variables, null); }