Monday, 28 January 2019

What is the use of the coldfusion mutators and accessors in framework ?

When a constructor method does have the arguments, but they are not needed to be passed after creation, then this method is known as the “no-argument constructor”. To make a constructor with no arguments, we have to use required = “false” and the default value becomes zero.
When an object is created for a CFC component, then it is needed to create variables within the adjacent CFC. The variable scope is default private, so it can’t be modified from anywhere. To get or provide the value from a property, two special methods are declared. Setters and accessors are used to complete this task.
The methods which provide value to the variables, are called as setters/mutators. To declare the setter method, set() and replacing() methods are used in coldfusion framework. The default parameters value is required = “true” so because value can be passed as argument to the property.
The getter/accessor methods are used to retrieve the value from the property. Its overall syntax is similar to the setter method. There is no value passed because getter method directly reads the value from the property and returns it back to the user.
All properties defined in a project code can have its different getters and setters functions and they help in making the property completely encapsulated. They also help application user toi get their data from the object with minimal interruption. It also helps in managing the code from one place only.

Hope you have liked this post ! thanks for reading it !
reference link -
http://mukeshtiwari.doodlekit.com/blog/entry/4758185/how-to-give-and-take-the-value-from-the-coldfusion-framework

No comments:

Post a Comment