Contact Us

Let us know to help you out quickly!

 Admin User     Feb,08 2017

Implicit Getters/Setters

Adobe ColdFusion 9 Supports Implicit Setters/Getters for Components.

To make coldfusion autogenerate these methods for the properties listed in components set the Accessors Attribute of component to true.

Auto generation for specific properties can also be stopped if it required to be overriden.To do this set the getter/setter attribute of cfproperty to false

Sample Code :

<!--- Set Accessors Attribute To True ---><cfcomponent accessors="true"><!--- FirstName and LastName Property Will Have Implicit Getter/Setter---><cfproperty name="firstName" type="string" /><cfproperty name="lastName" type="string" /><!--- Middle Name Property Will Not Have Implicit Getter/Setter Explicit Setters And Getters Can be defined For It ---><cfproperty name="middleName" type="string" getter="false" setter="false" /><cffunction name="getPerson" access="public" output="false" returntype="person"><cfreturn this></cffunction></cfcomponent>

Adobe Claims this method to be around 35% faster than defining User Defined Methods for the properties.

Further Reading Read