T
- The parameter concrete classpublic class Profile.Parameter<T> extends Object
A parameter is defined by:
ResourcesManager#applyTemplate(String, String)
)
type
Modifier and Type | Method and Description |
---|---|
Profile.Parameter<T> |
advanced()
Specifies that this
profile parameter is advanced. |
Profile.Parameter<T> |
defaultValue(String defaultValue)
Sets this profile parameter default value with the provided string.
|
Profile.Parameter<T> |
defaultValue(T defaultValue)
Sets this profile parameter default value.
|
Profile.Parameter<T> |
description(String description)
Sets this profile parameter description.
|
boolean |
equals(Object obj) |
T |
getDefaultValue()
Returns this profile parameter default value.
|
LocalizableMessage |
getDescriptionMsg()
Returns this profile parameter description.
|
LocalizableMessage |
getHelpMsg()
Returns this profile parameter help message.
|
LocalizableMessage |
getPromptMsg()
Returns this profile parameter prompt message.
|
Profile.ParameterType<T> |
getType()
Returns this profile parameter type.
|
T |
getValue()
Returns this profile parameter value.
|
String |
getVariableName()
Returns this profile parameter variable name.
|
int |
hashCode() |
Profile.Parameter<T> |
help(String... helpMsgLines)
Sets this profile parameter help.
|
boolean |
isAdvanced()
Returns whether this
profile parameter is advanced. |
T |
parseStringValue(String strValue)
Parses provided string value into this parameter type and returns the typed value.
|
Profile.Parameter<T> |
prompt(String... promptMsgLines)
Sets this profile parameter prompt message.
|
Profile.Parameter<T> |
property(String property)
Sets this profile parameter property.
|
T |
resolveValue()
Resolves and returns this profile parameter runtime value.
|
String |
toString() |
public final Profile.Parameter<T> defaultValue(T defaultValue)
If no value is available for the parameter at runtime, default value will be used.
defaultValue
- The default value to be associated to this parameterprofile parameter
public final Profile.Parameter<T> description(String description)
Description will be used by setup tool interactive mode in summaries, hence description content should be concise (e.g Name of the backend used to ...
description
- A string representing the parameter descriptionprofile parameter
public final Profile.Parameter<T> help(String... helpMsgLines)
Help is printed when user wants to know all parameters associated to a profile
(setup --help-profile "profileId"), if not set description
will be
used.
helpMsgLines
- Strings representing the message linesprofile parameter
public final Profile.Parameter<T> defaultValue(String defaultValue) throws SetupException
If no value is available for the parameter at runtime, default value will be used.
defaultValue
- A string representing the default value to be associated to this parameterprofile parameter
SetupException
- If the provided string cannot be converted in the parameter object typepublic final Profile.Parameter<T> advanced()
profile parameter
is advanced.
Setup interactive mode
does not prompt for advanced profile parameter value. As a consequence, advanced parameter must have
a default value defined.
profile parameter
public final Profile.Parameter<T> prompt(String... promptMsgLines)
promptMsgLines
- Strings representing the message lines to be printed by setup interactive mode while resolving this
Profile.Parameter
value (e.g "Provide a name for the backend used to ...)profile parameter
public final Profile.Parameter<T> property(String property)
property
- The property to be associated to this parameterprofile parameter
public final T resolveValue() throws com.forgerock.opendj.cli.ArgumentException
This method is only be meant to be called one time by parameters.groovy scripts. For example:
define.newDn "domainBaseDn" \
property "DOMAIN_BASE_DN" \
defaultValue Dn.valueOf("dc=example,dc=com") \
resolveValue()
define.newPassword "amAdminPassword" \
property "AM_ADMIN_PASSWORD" \
resolveValue()
Value resolution is done as follow:
Profile.resolveParameterValues(SetupConfiguration, ParameterValuesProvider)
type
function to convert the string value into an object of the
parameter type (an exception is thrown if value cant be retrieved from string
profile parameter
valuecom.forgerock.opendj.cli.ArgumentException
- If the parameter value cannot be resolved or if the resolution
(i.e parsing its string representation) failedpublic T parseStringValue(String strValue) throws com.forgerock.opendj.cli.ArgumentException
strValue
- A string representing the parameter value to be parsedcom.forgerock.opendj.cli.ArgumentException
- If an error occurred while parsing provided string valuepublic final boolean isAdvanced()
profile parameter
is advanced.
the setup interactive mode should prompt for this profile parameter value.
true
if this profile parameter
is advanced, false
otherwiseadvanced()
public final T getDefaultValue()
profile parameter
default valuepublic final LocalizableMessage getDescriptionMsg()
LocalizableMessage
representing this profile parameter
descriptionpublic final LocalizableMessage getHelpMsg()
LocalizableMessage
representing this profile parameter
help messagepublic final LocalizableMessage getPromptMsg()
public final String getVariableName()
profile parameter
variable namepublic final Profile.ParameterType<T> getType()
Profile.ParameterType
object representing this profile parameter
typepublic final T getValue()
To be set, resolveValue()
method must have been called.
profile parameter
valueCopyright 2010-2022 ForgeRock AS.