APIdia Launch Partner
Top Description Inners Fields Constructors Methods
jdk.jpackage.internal.cli

pack-priv final Record OptionSpec<T>

extends Record
Class Inheritance
Record Components
names:List<OptionName>
the names. Must be non-empty
converter:Optional<OptionValueConverter<String, T>>
the converter. Converts from a String to an object of type T
scope:Set<OptionScope>
the scope. Must be non-empty
mergePolicy:OptionSpec.MergePolicy
the merge policy
defaultOptionalValue:Optional<T>
the default optional value or an empty Optional instance if the option has a mandatory value or doesn't have a value
valuePattern:Optional<String>
the value pattern. Used in help output
description:String
the description. Used in help output
Type Parameters
<T>
option value type
Imports
java.util.List, .Objects, .Optional, .Set, java.util.stream.Stream, jdk.jpackage.internal.util.Result

Option spec. Names are used to identify an option. Converter converts option value from a String to an object of type T. Scope defines where the option applies. The standard scopes are: BundlingOperationOptionScope, BundlingOperationModifier. Merge policy defines how to handle multiple values of the option. Value pattern and description are targeted for help output.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static enum

Field Summary

Modifier and TypeField and Description
private final Optional<OptionValueConverter<String, T>>
converter

Record Component accessed by converter().

the converter.
private final Optional<T>
defaultOptionalValue

Record Component accessed by defaultOptionalValue().

the default optional value or an empty Optional instance if the option has a mandatory value or doesn't have a value
private final String
description

Record Component accessed by description().

the description.
private final OptionSpec.MergePolicy
mergePolicy

Record Component accessed by mergePolicy().

the merge policy
private final List<OptionName>
names

Record Component accessed by names().

the names.
private final Set<OptionScope>
scope

Record Component accessed by scope().

the scope.
private final Optional<String>
valuePattern

Record Component accessed by valuePattern().

the value pattern.

Constructor Summary

AccessConstructor and Description
pack-priv
OptionSpec(List<OptionName> names, Optional<OptionValueConverter<String, T>> converter, Set<OptionScope> scope, OptionSpec.MergePolicy mergePolicy, Optional<T> defaultOptionalValue, Optional<String> valuePattern, String description)

Method Summary

Modifier and TypeMethod and Description
pack-priv <U> Optional<OptionArrayValueConverter<U>>
pack-priv Result<T>
convert(OptionName optionName, StringToken optionValue)

public Optional<OptionValueConverter<String, T>>
converter()

Record Component getter of converter.

Record Component the converter.

pack-priv Stream<OptionSpec<T>>

Returns:

the stream of copy option spec objects each having a single name
copyForEveryName
()

Returns a stream of copy option spec objects, each having a single name.

pack-priv <U> OptionSpec<U>
pack-priv OptionSpec<T>
pack-priv OptionSpec<T>
public Optional<T>
defaultOptionalValue()

Record Component getter of defaultOptionalValue.

Record Component the default optional value or an empty Optional instance if the option has a mandatory value or doesn't have a value

public String
description()

Record Component getter of description.

Record Component the description.

public final boolean
equals(Object o)

Implements abstract java.lang.Record.equals.

Indicates whether some other object is "equal to" this one.

pack-priv List<OptionName>
pack-priv OptionName
public final int
hashCode()

Implements abstract java.lang.Record.hashCode.

Returns a hash code value for the record.

pack-priv boolean
pack-priv boolean
public OptionSpec.MergePolicy
mergePolicy()

Record Component getter of mergePolicy.

Record Component the merge policy

pack-priv OptionName

Returns:

the first name of this option spec
name
()

Returns the first (primary) name of this option spec.

public List<OptionName>
names()

Record Component getter of names.

Record Component the names.

pack-priv List<OptionName>

Returns:

the additional names
otherNames
()

Returns all names but the first of this option spec.

public Set<OptionScope>
scope()

Record Component getter of scope.

Record Component the scope.

public final String
toString()

Implements abstract java.lang.Record.toString.

Returns a string representation of the record.

public Optional<String>
valuePattern()

Record Component getter of valuePattern.

Record Component the value pattern.

pack-priv Class<? extends T>
private static <T> Optional<Class<? extends T>>

Field Detail

converterback to summary
private final Optional<OptionValueConverter<String, T>> converter

Record Component accessed by converter().

the converter. Converts from a String to an object of type T

defaultOptionalValueback to summary
private final Optional<T> defaultOptionalValue

Record Component accessed by defaultOptionalValue().

the default optional value or an empty Optional instance if the option has a mandatory value or doesn't have a value

descriptionback to summary
private final String description

Record Component accessed by description().

the description. Used in help output

mergePolicyback to summary
private final OptionSpec.MergePolicy mergePolicy

Record Component accessed by mergePolicy().

the merge policy

namesback to summary
private final List<OptionName> names

Record Component accessed by names().

the names. Must be non-empty

scopeback to summary
private final Set<OptionScope> scope

Record Component accessed by scope().

the scope. Must be non-empty

valuePatternback to summary
private final Optional<String> valuePattern

Record Component accessed by valuePattern().

the value pattern. Used in help output

Constructor Detail

OptionSpecback to summary
pack-priv OptionSpec(List<OptionName> names, Optional<OptionValueConverter<String, T>> converter, Set<OptionScope> scope, OptionSpec.MergePolicy mergePolicy, Optional<T> defaultOptionalValue, Optional<String> valuePattern, String description)

Method Detail

arrayValueConverterback to summary
pack-priv <U> Optional<OptionArrayValueConverter<U>> arrayValueConverter()
Annotations
@SuppressWarnings:unchecked
convertback to summary
pack-priv Result<T> convert(OptionName optionName, StringToken optionValue)
converterback to summary
public Optional<OptionValueConverter<String, T>> converter()

Record Component getter of converter.

Record Component
the converter. Converts from a String to an object of type T
copyForEveryNameback to summary
pack-priv Stream<OptionSpec<T>> copyForEveryName()

Returns a stream of copy option spec objects, each having a single name.

If the option has three names "a", "b", and "c", the stream will have three option spec objects each with a single name. The first will have name "a", the second - "b", and the third "c".

Returns:Stream<OptionSpec<T>>

the stream of copy option spec objects each having a single name

copyWithConverterback to summary
pack-priv <U> OptionSpec<U> copyWithConverter(OptionValueConverter<String, U> converter)
copyWithDescriptionback to summary
pack-priv OptionSpec<T> copyWithDescription(String description)
copyWithNameback to summary
pack-priv OptionSpec<T> copyWithName(OptionName name)
defaultOptionalValueback to summary
public Optional<T> defaultOptionalValue()

Record Component getter of defaultOptionalValue.

Record Component
the default optional value or an empty Optional instance if the option has a mandatory value or doesn't have a value
descriptionback to summary
public String description()

Record Component getter of description.

Record Component
the description. Used in help output
equalsback to summary
public final boolean equals(Object o)

Implements abstract java.lang.Record.equals.

Doc from java.lang.Record.equals.

Indicates whether some other object is "equal to" this one. In addition to the general contract of Object.equals, record classes must further obey the invariant that when a record instance is "copied" by passing the result of the record component accessor methods to the canonical constructor, as follows:

    R copy = new R(r.c1(), r.c2(), ..., r.cn());
then it must be the case that r.equals(copy).
findNamesInback to summary
pack-priv List<OptionName> findNamesIn(Options cmdline)
getFirstNameInback to summary
pack-priv OptionName getFirstNameIn(Options cmdline)
hashCodeback to summary
public final int hashCode()

Implements abstract java.lang.Record.hashCode.

Doc from java.lang.Record.hashCode.

Returns a hash code value for the record. Obeys the general contract of Object.hashCode. For records, hashing behavior is constrained by the refined contract of Record.equals, so that any two records created from the same components must have the same hash code.

hasValueback to summary
pack-priv boolean hasValue()
isValueOptionalback to summary
pack-priv boolean isValueOptional()
mergePolicyback to summary
public OptionSpec.MergePolicy mergePolicy()

Record Component getter of mergePolicy.

Record Component
the merge policy
nameback to summary
pack-priv OptionName name()

Returns the first (primary) name of this option spec.

Returns:OptionName

the first name of this option spec

namesback to summary
public List<OptionName> names()

Record Component getter of names.

Record Component
the names. Must be non-empty
otherNamesback to summary
pack-priv List<OptionName> otherNames()

Returns all names but the first of this option spec. Returns an empty list if the option spec has only one name.

Returns:List<OptionName>

the additional names

scopeback to summary
public Set<OptionScope> scope()

Record Component getter of scope.

Record Component
the scope. Must be non-empty
toStringback to summary
public final String toString()

Implements abstract java.lang.Record.toString.

Doc from java.lang.Record.toString.

Returns a string representation of the record. In accordance with the general contract of Object#toString(), the toString method returns a string that "textually represents" this record. The result should be a concise but informative representation that is easy for a person to read.

In addition to this general contract, record classes must further participate in the invariant that any two records which are equal must produce equal strings. This invariant is necessarily relaxed in the rare case where corresponding equal component values might fail to produce equal strings for themselves.

valuePatternback to summary
public Optional<String> valuePattern()

Record Component getter of valuePattern.

Record Component
the value pattern. Used in help output
valueTypeback to summary
pack-priv Class<? extends T> valueType()
valueTypeback to summary
private static <T> Optional<Class<? extends T>> valueType(Optional<OptionValueConverter<String, T>> valueConverter)
jdk.jpackage.internal.cli back to summary

pack-priv final Enum OptionSpec.MergePolicy

extends Enum<OptionSpec.MergePolicy>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final OptionSpec.MergePolicy
public static final OptionSpec.MergePolicy
public static final OptionSpec.MergePolicy

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static OptionSpec.MergePolicy
public static OptionSpec.MergePolicy[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

CONCATENATEback to summary
public static final OptionSpec.MergePolicy CONCATENATE
USE_FIRSTback to summary
public static final OptionSpec.MergePolicy USE_FIRST
USE_LASTback to summary
public static final OptionSpec.MergePolicy USE_LAST

Constructor Detail

MergePolicyback to summary
private MergePolicy()

Method Detail

valueOfback to summary
public static OptionSpec.MergePolicy valueOf(String name)
valuesback to summary
public static OptionSpec.MergePolicy[] values()