sanathkd
4 years agoOccasional Contributor
Parameterize the context.expand to have dynamic value
Hello all, I'm trying to parameterize a context.expand and re-use the same method for various properties like below. But the "value" seems not taking properly. [ Spoiler ] Anyone to guide me ...
- 4 years ago
It is solved now 😃 I figured it out myself. The script helped me:
def propertyStepName = "Properties";
propertyRead(propertyStepName, "logRef");
propertyRead(propertyStepName, "user");
public void propertyRead(String propertyStepName, String value){
def newValue = context.expand('${'+propertyStepName+'#'+value+'}');
}
sanathkd wrote:Hello all,
I'm trying to parameterize a context.expand and re-use the same method for various properties like below.
But the "value" seems not taking properly.
Spoilerdef logRef = propertyRead (logRef);
def user = propertyRead (user);
//-----------------------------------------------------
public static String propertyRead(String value)
{
def newValue = context.expand( '${Properties#{$value}}' );
return newValue;
}Anyone to guide me here?