'Put a read-only string parameter

I am trying to display a parameter on the screen and make it read-only. If I put a string with a default value, the user can change it. Example:

string(
name: 'parametro1',
defaultValue: 'parametro1') 

I have tried to use the following class

        [$class: 'WReadonlyStringParameterDefinition', 
        name: 'parametro1',
        defaultValue: 'parametro1']

But it shows me the following error

java.lang.UnsupportedOperationException: no known implementation of class hudson.model.ParameterDefinition is named WReadonlyStringParameterDefinition



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source