Class Profile.Parameter<P extends Profile.Parameter<P,T>,T>
- Type Parameters:
P- The parameter implementationT- The parameter value concrete class
- Direct Known Subclasses:
Profile.DnParameter,Profile.DomainParameter,Profile.EnumParameter,Profile.HostPortParameter,Profile.NumberParameter,Profile.PasswordParameter,Profile.PathParameter,Profile.StringParameter
- Enclosing class:
- Profile
A parameter is defined by:
- a mandatory variable name (e.g fooBar)
- an optional property name (e.g FOO_BAR), this property will be used for substituting commons
configuration expression in resource files (see
Profile.ResourcesManager.applyTemplate(String, String)) - a default value which will be used if no values are provided for the parameter at runtime
- a value
-
Method Summary
Modifier and TypeMethodDescriptionabstract <R,P2, E extends Exception>
Raccept(Profile.ParameterVisitor<R, P2, E> visitor, P2 p) Applies aProfile.ParameterVisitorto thisProfile.Parameter.final Padvanced()Specifies that thisprofile parameteris advanced.final PdefaultValue(String defaultValue) Sets this profile parameter default value with the provided string.final PdefaultValue(T defaultValue) Sets this profile parameter default value.booleanReturnstrueif the default value of this parameter can be derived from the setup global options.final PdefaultValueFromSetupTool(String setupConfMethod) Indicates that this profile parameter value must be computed using theProfile.SetupConfigurationif no value is available at runtime.final Pdescription(String descriptionMsg) Sets this profile parameter description.descriptionIfNoValueSet(String descriptionIfNoValueSetMsg) Sets the message to be displayed instead of theparameter descriptionif no value is provided for this parameter.final booleanSpecifies that common configuration expressions can be specified for thisprofile parameter.Returns prompt message to know whether another value should be added for this parameter.final ValueOrExpression<T>Returns this profile parameter default value.final LocalizableMessageReturns this profile parameter description to be used when no value is provided.final LocalizableMessageReturns this profile parameter description.final LocalizableMessageReturns this profile parameter help message.final LocalizableMessageReturns prompt message to know whether a value should be provided for this parameter.final LocalizableMessageReturns this profile parameter prompt message.final StringReturns this parameter type.final StringReturns this parameter type.final TgetValue()Returns this profile parameter value.final ObjectReturns this profile parameter value or expression.final StringReturns this profile parameter variable name.final inthashCode()final PSets this profile parameter help.final booleanReturns whether thisprofile parameteris advanced.final booleanReturns whether thisprofile parameteris multivalued.final booleanReturns whether thisprofile parameteris optional.final PSpecifies that thisprofile parametercan accept multiple values.final Pmultivalued(String... addAnotherValueMsg) Specifies that thisprofile parametercan accept multiple values.final Poptional()Specifies that thisprofile parameteris optional.final PSpecifies that thisprofile parameteris optional.abstract TparseStringValue(String strValue) Parses provided string value into this parameter type and returns the typed value.final PSets this profile parameter prompt message.final PSets this profile parameter property.final StringtoString()
-
Method Details
-
defaultValueFromSetupTool
Indicates that this profile parameter value must be computed using theProfile.SetupConfigurationif no value is available at runtime.This is possible when the associated
profileisrunby thesetup tool. It is not possible when the associatedprofileisrunby thesetup-profile tool.If no value is available at runtime and it is not possible to retrieve the value from the
Profile.SetupConfiguration, the parameterdefault valuewill be used.- Parameters:
setupConfMethod- String representing the method name to be called on theProfile.SetupConfigurationto get this parameter value- Returns:
- This
profile parameter - Throws:
SetupException- If noProfile.SetupConfigurationmethod is available with the provided name
-
defaultValue
Sets this profile parameter default value.If no value is available for the parameter at runtime, default value will be used.
- Parameters:
defaultValue- The default value to be associated to this parameter- Returns:
- This
profile parameter
-
defaultValue
Sets this profile parameter default value with the provided string.If no value is available for the parameter at runtime, default value will be used.
- Parameters:
defaultValue- A string representing the default value to be associated to this parameter- Returns:
- This
profile parameter - Throws:
SetupException- If the provided string cannot be converted in the parameter object type
-
description
Sets this profile parameter 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 ...
- Parameters:
descriptionMsg- A string representing the parameter description message- Returns:
- This
profile parameter
-
help
Sets this profile parameter help.Help is printed when user wants to know all parameters associated to a profile (setup --help-profile "profileId"), if not set
descriptionwill be used.- Parameters:
helpMsg- A string representing the parameter help message- Returns:
- This
profile parameter
-
advanced
Specifies that thisprofile parameteris advanced.Setup interactive modedoes not prompt for advanced profile parameter value. As a consequence, advanced parameter must have a default value defined.- Returns:
- This
profile parameter
-
multivalued
Specifies that thisprofile parametercan accept multiple values.- Parameters:
addAnotherValueMsg- Strings representing the paragraphs of the message to be printed to ask if another value must be added for this parameter- Returns:
- This
profile parameter
-
multivalued
Specifies that thisprofile parametercan accept multiple values.- Returns:
- This
profile parameter
-
expressionAllowed
Specifies that common configuration expressions can be specified for thisprofile parameter.- Returns:
- This
profile parameter
-
optional
Specifies that thisprofile parameteris optional.Profile framework will not fail if no value has been provided for an optional parameter.
- Parameters:
optionalPromptMsg- Strings representing the paragraphs of message to ask the user to know whether a value should be provided for this parameter- Returns:
- This
profile parameter
-
optional
Specifies that thisprofile parameteris optional.Profile framework will not fail if no value has been provided for an optional parameter.
- Returns:
- This
profile parameter
-
descriptionIfNoValueSet
Sets the message to be displayed instead of theparameter descriptionif no value is provided for this parameter.Message will be used by setup tool interactive mode in summaries, hence it should be concise.
- Parameters:
descriptionIfNoValueSetMsg- Strings representing the parameter description message paragraphs- Returns:
- This
profile parameter
-
prompt
Sets this profile parameter prompt message.- Parameters:
promptForValueMsg- Strings representing the paragraphs of the message to be printed when resolving thisprofile parametervalue- Returns:
- This
profile parameter
-
property
Sets this profile parameter property.- Parameters:
property- The property to be associated to this parameter- Returns:
- This
profile parameter
-
parseStringValue
public abstract T parseStringValue(String strValue) throws com.forgerock.opendj.cli.ArgumentException Parses provided string value into this parameter type and returns the typed value.- Parameters:
strValue- A string representing the parameter value to be parsed- Returns:
- The typed value associated to provided string
- Throws:
com.forgerock.opendj.cli.ArgumentException- If an error occurred while parsing provided string value
-
isAdvanced
public final boolean isAdvanced()Returns whether thisprofile parameteris advanced.the setup interactive mode does not prompt for an advanced profile parameter value.
- Returns:
trueif thisprofile parameteris advanced,falseotherwise- See Also:
-
isMultivalued
public final boolean isMultivalued()Returns whether thisprofile parameteris multivalued.- Returns:
trueif thisprofile parameteris multivalued,falseotherwise- See Also:
-
isOptional
public final boolean isOptional()Returns whether thisprofile parameteris optional.- Returns:
trueif thisprofile parameteris optional,falseotherwise- See Also:
-
defaultValueCanBeDerivedAtSetup
public boolean defaultValueCanBeDerivedAtSetup()Returnstrueif the default value of this parameter can be derived from the setup global options.- Returns:
trueif the default value of this parameter can be derived from the setup global options,falseotherwise- See Also:
-
getDefaultValue
Returns this profile parameter default value.- Returns:
- This
profile parameterdefault value
-
getDescriptionMsg
Returns this profile parameter description.If no message has been set for the description to be returned, a generic message is used.
- Returns:
- A
LocalizableMessagerepresenting thisprofile parameterdescription
-
getDescriptionIfNoValueSetMsg
Returns this profile parameter description to be used when no value is provided.If no message has been set for this particular use case, the profile parameter
descriptionis returned.- Returns:
- A
LocalizableMessagerepresenting thisprofile parameterdescription when no value is provided
-
getHelpMsg
Returns this profile parameter help message.- Returns:
- A
LocalizableMessagerepresenting thisprofile parameterhelp message
-
getPromptForValueMsg
Returns this profile parameter prompt message.- Returns:
- A
LocalizableMessagerepresenting thisprofile parameterprompt message
-
getOptionalPromptMsg
Returns prompt message to know whether a value should be provided for this parameter.- Returns:
- A
LocalizableMessageprinted when asking if a value should be provided for this parameter
-
getAddAnotherValueMsg
Returns prompt message to know whether another value should be added for this parameter.- Returns:
- A
LocalizableMessageprinted when asking if a value should be added for this parameter
-
getVariableName
Returns this profile parameter variable name.- Returns:
- A string representing this
profile parametervariable name
-
equals
-
hashCode
public final int hashCode() -
toString
-
getSyntax
Returns this parameter type.- Returns:
- A string representing this parameter type
-
getSyntaxWithoutExpression
Returns this parameter type.The returned string does not mention that this parameter can contain configuration expression.
- Returns:
- A string representing this parameter type
-
getValue
Returns this profile parameter value.To be set,
resolveValues(ExecutionContext)method must have been called.- Returns:
- This
profile parametervalue - Throws:
ExpressionException- If the parameter contains an expression
-
getValueOrExpression
Returns this profile parameter value or expression.To be set,
resolveValues(ExecutionContext)method must have been called.- Returns:
- This
profile parametervalue
-
accept
public abstract <R,P2, R acceptE extends Exception> (Profile.ParameterVisitor<R, P2, throws EE> visitor, P2 p) Applies aProfile.ParameterVisitorto thisProfile.Parameter.- Type Parameters:
R- The return type of the visitor's methodsP2- The type of the additional parameter to this visitor's methods. UseVoidfor visitors that do not need an additional parameterE- The type of the exception thrown by the visitor method if it fails, orNeverThrowsExceptionif the visitor cannot fail- Parameters:
visitor- The parameter visitorp- Optional additional visitor parameter- Returns:
- A result as specified by the visitor
- Throws:
E- If the visitor failed
-