cancel
Showing results for 
Search instead for 
Did you mean: 

Regarding setter and getter methods

Former Member
0 Kudos

Hi,

Can anybody tell me the use of setter and getter methods in webdynpro .

It is generated when we set the calculate property of value attribute to true .

Thanks a lot .

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Setter method is called when a value is assigned to the attribute .

This method can be called either by using

wdContext.currentContextElement().set<YOURATTRIBUTE>

or when a new value is entered by the user from the UI Element bound to this attribute.

<b>value</b> param of the setter method holds the new value.

Getter is called to retreive the value for the attribute.

wdContext.currentContextElement().get<YOURATTRIBUTE>

Regards

Ayyapparaj

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Jain

<b>setter</b> and <b>getter </b>functions will be created when you set the calculated propertyto true

Consider the following scenario where in you can get some basic idea

1) First insert a Child "Image" UI Element

2) Create a Context in a view in which you are using Image UI Element

3) Value Node

Name : Image

Cardidality : 1..1

4) create 2 Value Attributes

4)a ImageAlt (Calculate property - true) //this will create getter and setter methods

4)b ImageSrc (Calculate property - true) //this will create getter and setter methods

5)Bind the properties of Image

alt - Image.ImageAlt

source - Image.ImageSrc

6) in getImageSrc()

{

retrun "XX.gif"

}

7) in getImageAlt()

{

return "Image Not Available"

}

you can even achieve getter and setter methods by doing the following procedure

goto <b>implementation</b> tab-> rightclick -> <b>source</b> -> <b>generate Getter and Setter methods...</b>

Best Regards

Chaitanya.A

Former Member
0 Kudos

When we create a node or attribute at design time, setter and getter

methods are provided to access these elements:

The set methods set the value of a property or an element. If a property is readOnly, then this method is not implemented

The get methods return the value of a property or an element.