APIdia Launch Partner
Top Inners Methods
jdk.jpackage.internal.cli

pack-priv Interface Validator<T, U extends Exception>

Known Direct Implementers
jdk.jpackage.internal.cli.Validator.Details.ScalarValidator
Annotations
@FunctionalInterface
Imports
java.util.List, .Objects, .Optional, java.util.function.Consumer, .Predicate, java.util.stream.Stream

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
public static class
public static interface
public static class
Validator.ValidatingConsumerException

Thrown to indicate that the given value didn't pass validation.

public static class
Validator.ValidatorException

Thrown to indicate an error in the normal execution of a validator.

Method Summary

Modifier and TypeMethod and Description
public default Validator<T, ? extends Exception>
andGreedy(Validator<T, ? extends Exception> after)

public static <T, U extends Exception> Validator<T, U>
andGreedy(Validator<T, U> first, Validator<T, U> second)

public default Validator<T, ? extends Exception>
andLazy(Validator<T, ? extends Exception> after)

public static <T, U extends Exception> Validator<T, U>
andLazy(Validator<T, U> first, Validator<T, U> second)

public static <T, U extends Exception> Validator.Builder<T, U>
public default Validator<T, ? extends Exception>
or(Validator<T, ? extends Exception> after)

public static <T, U extends Exception> Validator<T, U>
or(Validator<T, U> first, Validator<T, U> second)

public List<U>

Returns:

the list of validation errors
validate
(OptionName
the name of an option to validate
optionName
,
Validator.ParsedValue<T>
the value of an option to validate
optionValue
)

Validates the given option value.

Method Detail

andGreedyback to summary
public default Validator<T, ? extends Exception> andGreedy(Validator<T, ? extends Exception> after)
andGreedyback to summary
public static <T, U extends Exception> Validator<T, U> andGreedy(Validator<T, U> first, Validator<T, U> second)
Annotations
@SuppressWarnings:unchecked
andLazyback to summary
public default Validator<T, ? extends Exception> andLazy(Validator<T, ? extends Exception> after)
andLazyback to summary
public static <T, U extends Exception> Validator<T, U> andLazy(Validator<T, U> first, Validator<T, U> second)
Annotations
@SuppressWarnings:unchecked
buildback to summary
public static <T, U extends Exception> Validator.Builder<T, U> build()
orback to summary
public default Validator<T, ? extends Exception> or(Validator<T, ? extends Exception> after)
orback to summary
public static <T, U extends Exception> Validator<T, U> or(Validator<T, U> first, Validator<T, U> second)
Annotations
@SuppressWarnings:unchecked
validateback to summary
public List<U> validate(OptionName optionName, Validator.ParsedValue<T> optionValue) throws ValidatorException

Validates the given option value.

Parameters
optionName:OptionName

the name of an option to validate

optionValue:Validator.ParsedValue<T>

the value of an option to validate

Returns:List<U>

the list of validation errors

Exceptions
ValidatorException:
if internal validator error occurs
jdk.jpackage.internal.cli back to summary

public final Class Validator.Builder<T, U extends Exception>

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private Consumer<T>
private OptionValueExceptionFactory<? extends U>
private String
private Predicate<T>

Constructor Summary

AccessConstructor and Description
private
pack-priv
Builder(Validator.Builder<T, U> other)

Method Summary

Modifier and TypeMethod and Description
pack-priv Validator.Builder<T, U>
pack-priv Optional<Consumer<T>>
pack-priv Validator.Builder<T, U>
copy()

pack-priv Validator<T, U>
pack-priv Validator.Builder<T, U>
pack-priv Optional<OptionValueExceptionFactory<? extends U>>
pack-priv Validator.Builder<T, U>
pack-priv Optional<String>
pack-priv boolean
pack-priv Validator.Builder<T, U>
mutate(Consumer<Validator.Builder<T, U>> mutator)

pack-priv Validator.Builder<T, U>
pack-priv Optional<Predicate<T>>
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

consumerback to summary
private Consumer<T> consumer
exceptionFactoryback to summary
private OptionValueExceptionFactory<? extends U> exceptionFactory
formatStringback to summary
private String formatString
predicateback to summary
private Predicate<T> predicate

Constructor Detail

Builderback to summary
private Builder()
Builderback to summary
pack-priv Builder(Validator.Builder<T, U> other)

Method Detail

consumerback to summary
pack-priv Validator.Builder<T, U> consumer(Consumer<T> v)
consumerback to summary
pack-priv Optional<Consumer<T>> consumer()
copyback to summary
pack-priv Validator.Builder<T, U> copy()
createback to summary
pack-priv Validator<T, U> create()
exceptionFactoryback to summary
pack-priv Validator.Builder<T, U> exceptionFactory(OptionValueExceptionFactory<? extends U> v)
exceptionFactoryback to summary
pack-priv Optional<OptionValueExceptionFactory<? extends U>> exceptionFactory()
formatStringback to summary
pack-priv Validator.Builder<T, U> formatString(String v)
formatStringback to summary
pack-priv Optional<String> formatString()
hasValidatingMethodback to summary
pack-priv boolean hasValidatingMethod()
mutateback to summary
pack-priv Validator.Builder<T, U> mutate(Consumer<Validator.Builder<T, U>> mutator)
predicateback to summary
pack-priv Validator.Builder<T, U> predicate(Predicate<T> v)
predicateback to summary
pack-priv Optional<Predicate<T>> predicate()
jdk.jpackage.internal.cli back to summary

public final Class Validator.Details

extends Object
Class Inheritance

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static record
private static record

Constructor Summary

AccessConstructor and Description
private

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Detailsback to summary
private Details()
jdk.jpackage.internal.cli back to summary

private final Record Validator.Details.DefaultParsedValue<T>

extends Record
implements Validator.ParsedValue<T>
Class Inheritance
All Implemented Interfaces
jdk.jpackage.internal.cli.Validator.ParsedValue
Record Components
value:T 
sourceToken:StringToken 

Field Summary

Modifier and TypeField and Description
private final StringToken
sourceToken

Record Component accessed by sourceToken().

private final T
value

Record Component accessed by value().

Constructor Summary

AccessConstructor and Description
pack-priv
DefaultParsedValue(T value, StringToken sourceToken)

Method Summary

Modifier and TypeMethod and Description
public final boolean
equals(Object o)

Implements abstract java.lang.Record.equals.

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

public final int
hashCode()

Implements abstract java.lang.Record.hashCode.

Returns a hash code value for the record.

public StringToken
public final String
toString()

Implements abstract java.lang.Record.toString.

Returns a string representation of the record.

public T
value()

Record Component getter of value.

Implements jdk.jpackage.internal.cli.Validator.ParsedValue.value.

Field Detail

sourceTokenback to summary
private final StringToken sourceToken

Record Component accessed by sourceToken().

valueback to summary
private final T value

Record Component accessed by value().

Constructor Detail

DefaultParsedValueback to summary
pack-priv DefaultParsedValue(T value, StringToken sourceToken)

Method Detail

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).
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.

sourceTokenback to summary
public StringToken sourceToken()

Record Component getter of sourceToken.

Implements jdk.jpackage.internal.cli.Validator.ParsedValue.sourceToken.

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.

valueback to summary
public T value()

Record Component getter of value.

Implements jdk.jpackage.internal.cli.Validator.ParsedValue.value.

jdk.jpackage.internal.cli back to summary

private final Record Validator.Details.ScalarValidator<T, U extends Exception>

extends Record
implements Validator<T, U extends Exception>
Class Inheritance
All Implemented Interfaces
jdk.jpackage.internal.cli.Validator
Record Components
predicate:Optional<Predicate<T>> 
consumer:Optional<Consumer<T>> 
formatString:String 
exceptionFactory:OptionValueExceptionFactory<? extends U> 

Field Summary

Modifier and TypeField and Description
private final Optional<Consumer<T>>
consumer

Record Component accessed by consumer().

private final OptionValueExceptionFactory<? extends U>
exceptionFactory

Record Component accessed by exceptionFactory().

private final String
formatString

Record Component accessed by formatString().

private final Optional<Predicate<T>>
predicate

Record Component accessed by predicate().

Constructor Summary

AccessConstructor and Description
pack-priv
ScalarValidator(Optional<Predicate<T>> predicate, Optional<Consumer<T>> consumer, String formatString, OptionValueExceptionFactory<? extends U> exceptionFactory)

Method Summary

Modifier and TypeMethod and Description
public Optional<Consumer<T>>
consumer()

Record Component getter of consumer.

public final boolean
equals(Object o)

Implements abstract java.lang.Record.equals.

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

public OptionValueExceptionFactory<? extends U>
exceptionFactory()

Record Component getter of exceptionFactory.

public String
formatString()

Record Component getter of formatString.

private List<U>
public final int
hashCode()

Implements abstract java.lang.Record.hashCode.

Returns a hash code value for the record.

public Optional<Predicate<T>>
predicate()

Record Component getter of predicate.

public final String
toString()

Implements abstract java.lang.Record.toString.

Returns a string representation of the record.

public List<U>
validate(OptionName optionName, Validator.ParsedValue<T> optionValue)

Implements jdk.jpackage.internal.cli.Validator.validate.

Validates the given option value.

Field Detail

consumerback to summary
private final Optional<Consumer<T>> consumer

Record Component accessed by consumer().

exceptionFactoryback to summary
private final OptionValueExceptionFactory<? extends U> exceptionFactory

Record Component accessed by exceptionFactory().

formatStringback to summary
private final String formatString

Record Component accessed by formatString().

predicateback to summary
private final Optional<Predicate<T>> predicate

Record Component accessed by predicate().

Constructor Detail

ScalarValidatorback to summary
pack-priv ScalarValidator(Optional<Predicate<T>> predicate, Optional<Consumer<T>> consumer, String formatString, OptionValueExceptionFactory<? extends U> exceptionFactory)

Method Detail

consumerback to summary
public Optional<Consumer<T>> consumer()

Record Component getter of consumer.

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).
exceptionFactoryback to summary
public OptionValueExceptionFactory<? extends U> exceptionFactory()

Record Component getter of exceptionFactory.

formatStringback to summary
public String formatString()

Record Component getter of formatString.

handleExceptionback to summary
private List<U> handleException(OptionName optionName, Validator.ParsedValue<T> optionValue, RuntimeException ex)
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.

predicateback to summary
public Optional<Predicate<T>> predicate()

Record Component getter of predicate.

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.

validateback to summary
public List<U> validate(OptionName optionName, Validator.ParsedValue<T> optionValue)

Implements jdk.jpackage.internal.cli.Validator.validate.

Doc from jdk.jpackage.internal.cli.Validator.validate.

Validates the given option value.

Annotations
@Override
jdk.jpackage.internal.cli back to summary

public sealed Interface Validator.ParsedValue<T>

permits Validator.Details.DefaultParsedValue<T>
Known Direct Implementers
jdk.jpackage.internal.cli.Validator.Details.DefaultParsedValue

Method Summary

Modifier and TypeMethod and Description
public static <T> Validator.ParsedValue<T>
create(T value, StringToken sourceToken)

public StringToken
public T

Method Detail

createback to summary
public static <T> Validator.ParsedValue<T> create(T value, StringToken sourceToken)
sourceTokenback to summary
public StringToken sourceToken()
valueback to summary
public T value()
jdk.jpackage.internal.cli back to summary

public final Class Validator.ValidatingConsumerException

extends RuntimeException
Class Inheritance

Thrown to indicate that the given value didn't pass validation.

Field Summary

Modifier and TypeField and Description
private static final long

Constructor Summary

AccessConstructor and Description
pack-priv
pack-priv

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.lang.RuntimeException.serialVersionUID.

Constructor Detail

ValidatingConsumerExceptionback to summary
pack-priv ValidatingConsumerException(String msg, Exception cause)
ValidatingConsumerExceptionback to summary
pack-priv ValidatingConsumerException(Throwable cause)
jdk.jpackage.internal.cli back to summary

public final Class Validator.ValidatorException

extends RuntimeException
Class Inheritance

Thrown to indicate an error in the normal execution of a validator.

Field Summary

Modifier and TypeField and Description
private static final long

Constructor Summary

AccessConstructor and Description
private

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.lang.RuntimeException.serialVersionUID.

Constructor Detail

ValidatorExceptionback to summary
private ValidatorException(Exception cause)