Editor Template for UIControl Properties that use Value Binding


<?xml version="1.0" encoding="UTF-8"?><templates><template autoinsert="true" context="java" deleted="false" description="Getter which Checks private field then value binding then default" enabled="true" name="vbgettersetter">public ${valuetype} get${name}() {&#13;
&#13;
	if (this.${privateField} != null) {&#13;
		return this.${privateField};&#13;
	}&#13;
&#13;
	ValueBinding vb = getValueBinding("${privateField}");&#13;
&#13;
	if (vb != null) {&#13;
		return (${valuetype})vb.getValue(getFacesContext());&#13;
	}&#13;
&#13;
	return ${defaultValue}${cursor};&#13;
&#13;
}&#13;
&#13;
public void set${name}(${valuetype} ${privateField}) {&#13;
	this.${privateField} = ${privateField};&#13;
}&#13;
${:import(javax.faces.el.ValueBinding)}</template></templates>
All code submitted to OpenNTF XSnippets, whether submitted as a "Snippet" or in the body of a Comment, is provided under the Apache License Version 2.0. See Terms of Use for full details.
No comments yetLogin first to comment...