Interface IValueDescriptorFactory
- All Known Implementing Classes:
ValueDescriptorFactory
public interface IValueDescriptorFactory
Factory for creating
IValueDescriptors. This includes methods that create IValueDescriptorBuilders
that let you configure the descriptor, as well as some convenience methods that return preconfigured descriptors. A
value descriptor indicates the type a value must have and may impose additional restrictions on the allowed values.
You may create descriptors once during startup and store them statically. Also, please note that these builder methods perform checks and will throw an error if an invalid configuration is detected.
- Since:
- 7.0.0
- Author:
- XIMA MEDIA GmbH
-
Method Summary
Modifier and TypeMethodDescriptionList<?> accessAtPath(Object base, String path) Access a nested property in an object at a given JSON path.default IAnyValueDescriptorany()Gets a value descriptor that allows any type of value.default IAnyValueDescriptorGets a value descriptor that allows any type of value.default IBooleanValueDescriptorbool()default IBooleanValueDescriptorbool(boolean defaultValue) default IBooleanValueDescriptorDeprecated.default IConstValueDescriptor<Boolean> constant(boolean value) Creates a value descriptor that only admits the given constant value.default IConstValueDescriptor<Double> constant(double value) default IConstValueDescriptor<Long> constant(long value) default IConstValueDescriptor<LargeString> constant(LargeString value) IValueDescriptor<?, ?> Creates a value descriptor that only admits the given constant value.IValueDescriptor<?, ?> constant(Object value, IValueStructureAccessor adapter) Creates a value descriptor that only admits the given constant value.default IConstValueDescriptor<String> constantBuilder(boolean value) constantBuilder(double value) constantBuilder(long value) constantBuilder(LargeString value) constantBuilder(String value) default IFloatValueDescriptorfloating()default IFloatValueDescriptorfloating(double defaultValue) default IFloatValueDescriptorDeprecated.default IIntegerValueDescriptorinteger()default IIntegerValueDescriptorinteger(long defaultValue) default IIntegerValueDescriptorDeprecated.IValueDescriptor<?, ?> intersect(IValueDescriptor<?, ?> first, IValueDescriptor<?, ?> second) Intersects two value descriptors with each other.IValueDescriptor<?, ?> intersectAll(Iterable<? extends IValueDescriptor<?, ?>> descriptors) Intersects all value descriptors, returning a descriptor that represents their intersection.Map<String, IValueDescriptor<?, ?>> intersectDescriptorMap(Map<String, IValueDescriptor<?, ?>> first, Map<String, IValueDescriptor<?, ?>> second) Intersects two maps of value descriptors with each other.default ILargeStringValueDescriptordefault ILargeStringValueDescriptorlargeString(LargeString defaultValue) default ILargeStringValueDescriptorlargeString(LargeString defaultValue, String descriptionI18n) Deprecated.default <V> IListValueDescriptor<V> list(IValueDescriptor<V, ? extends IValueBuilder<V>> descriptor) default IListValueDescriptor<?> list(IValueDescriptorCreator elementType) <V> IListValueDescriptorBuilder<V> listBuilder(IValueDescriptor<V, ? extends IValueBuilder<V>> descriptor) listBuilder(IValueDescriptorCreator elementType) default IListValueDescriptor<LargeString> default IListValueDescriptor<LargeString> listOfLargeStrings(String descriptionI18n) Deprecated.default IListValueDescriptor<String> default IListValueDescriptor<String> listOfStrings(String descriptionI18n) Deprecated.default <V> IMapValueDescriptor<V> map(IValueDescriptor<V, ? extends IValueBuilder<V>> descriptor) default IMapValueDescriptor<?> map(IValueDescriptorCreator elementType) <V> IMapValueDescriptorBuilder<V> mapBuilder(IValueDescriptor<V, ? extends IValueBuilder<V>> descriptor) mapBuilder(IValueDescriptorCreator elementType) default IMapValueDescriptor<LargeString> default IMapValueDescriptor<LargeString> mapToLargeStrings(String descriptionI18n) Deprecated.default IMapValueDescriptor<String> default IMapValueDescriptor<String> mapToStrings(String descriptionI18n) Deprecated.IValueDescriptor<?, ?> normalizeUnion(IUnionValueDescriptor descriptor) Normalizes a union value descriptor by removing duplicate types, flattening nested unions, and merging types that can be merged (e.g. integer and float become float).default INullValueDescriptornullish()default INullValueDescriptorDeprecated.default IRecordValueDescriptorrecord()default IStringValueDescriptorGets a string descriptor for a string value that must have a length of at least one and defaults to " ".default IStringValueDescriptorrequiredString(String defaultValue) default IStringValueDescriptorBuilderCreates a new builder for a string and sets it up so the string is required, i.e. must have a length of at least 1.default IStringValueDescriptorstring()Gets a string descriptor that defaults to the empty string.default IStringValueDescriptordefault IStringValueDescriptorDeprecated.default ITupleValueDescriptortuple()Creates an empty tuple descriptor.default ITupleValueDescriptortuple(IValueDescriptor<?, ? extends IValueBuilder<?>>... types) default ITupleValueDescriptortuple(IValueDescriptorCreator... types) default <V> ITupleValueDescriptortupleOfSame(int count, IValueDescriptor<V, ? extends IValueBuilder<V>> type) default ITupleValueDescriptortupleOfSame(int count, IValueDescriptorCreator creator) Creates a new union descriptor builder.default IUnionValueDescriptorBuilderunionBuilder(Class<?> ignoredDiscriminatorClass) Deprecated.UseunionBuilder()instead.default IUnionValueDescriptordefault IUnionValueDescriptorBuilderunionEnumBuilder(Class<?> ignoredDiscriminatorClass) Deprecated.UseunionBuilder()instead.default IUnionValueDescriptorunionOfEnumConst(Class<? extends Enum<?>> enumClass) Deprecated.UseunionOfStringConst(Class)instead.default <E extends Enum<E>>
IUnionValueDescriptorunionOfEnumConst(Class<E> enumClass, E defaultValue) Deprecated.UseunionOfStringConst(Class, Enum)instead.default IUnionValueDescriptorBuilderunionOfEnumConstBuilder(Class<? extends Enum<?>> enumClass) Deprecated.UseunionOfStringConstBuilder(Class)instead.default <E extends Enum<E>>
IUnionValueDescriptorBuilderunionOfEnumConstBuilder(Class<E> enumClass, E defaultValue) Deprecated.UseunionOfStringConstBuilder(Class, Enum)instead.default IUnionValueDescriptorunionOfStringConst(Class<? extends Enum<?>> enumClass) default <E extends Enum<E>>
IUnionValueDescriptorunionOfStringConst(Class<E> enumClass, E defaultValue) default IUnionValueDescriptorunionOfStringConst(String first, String... moreStrings) default IUnionValueDescriptorBuilderunionOfStringConstBuilder(Class<? extends Enum<?>> enumClass) default <E extends Enum<E>>
IUnionValueDescriptorBuilderunionOfStringConstBuilder(Class<E> enumClass, E defaultValue) default IUnionValueDescriptorBuilderunionOfStringConstBuilder(String first, String... moreStrings) default IUnionValueDescriptorBuilderDeprecated.UseunionBuilder()instead.default IUnionValueDescriptorunionWithNull(IValueDescriptor<?, ?> valueDescriptor) Creates a union value descriptor with two members, one beingnulland the other being the given descriptor.default IUnionValueDescriptorBuilderunionWithNullBuilder(IValueDescriptor<?, ?> valueDescriptor) Creates a union value descriptor builder set up with two members, one beingnulland the other being the given descriptor.voidish()
-
Method Details
-
accessAtPath
-
any
Gets a value descriptor that allows any type of value. When no value is provided, defaults tonull(i.e. like aINullValueDescriptor).- Returns:
- A descriptor for an any value that defaults to the given value. The description uses the default i18n key determined from the root class and the path to this property.
-
any
Gets a value descriptor that allows any type of value. Uses the given default value when no value is provided. explicitly.- Parameters:
defaultValue- The default value for the property of type any, used when no other value is supplied.- Returns:
- A descriptor for an any value that defaults to the given value. The description uses the default i18n key determined from the root class and the path to this property.
-
anyBuilder
IAnyValueDescriptorBuilder anyBuilder()- Returns:
- A descriptor builder for an any value.
-
bool
- Returns:
- A descriptor for a boolean value that defaults to
false. The description uses the default i18n key determined from the root class and the path to this property.
-
bool
- Parameters:
defaultValue- The default value for the boolean property, used when no other value is supplied.- Returns:
- A descriptor for a boolean value that defaults to the given value. The description uses the default i18n key determined from the root class and the path to this property.
-
bool
Deprecated.- Parameters:
defaultValue- The default value for the boolean property, used when no other value is supplied.descriptionI18n- The i18n key to use for the description of the boolean property.- Returns:
- A descriptor for a boolean value that defaults to the given value and uses the given description.
-
boolBuilder
IBooleanValueDescriptorBuilder boolBuilder()- Returns:
- A descriptor builder for a boolean value.
-
constant
Creates a value descriptor that only admits the given constant value.- Parameters:
value- The constant value that the descriptor should allow.- Returns:
- A descriptor for a value that only admits the given constant boolean value.
-
constant
Creates a value descriptor that only admits the given constant value. The given value must be a JSON-like value, i.e. null, aBoolean, aNumber, aStringorLargeString, aListof JSON values, or aMapfrom strings to JSON values.- Parameters:
value- The constant value that the descriptor should allow.- Returns:
- A descriptor for a value that only admits the given constant boolean value.
- Throws:
IllegalArgumentException- When the value is not a valid JSON value, e.g. when it is a map with non-string keys, or some object that is not a JSON value.
-
constant
Creates a value descriptor that only admits the given constant value.- Parameters:
value- The constant value that the descriptor should allow.adapter- The adapter to access the structure of the value.- Returns:
- A descriptor for a value that only admits the given constant boolean value.
- Throws:
IllegalArgumentException- When the value is not a valid JSON value, e.g. when it is a map with non-string keys, or some object that is not a JSON value.
-
constant
- Parameters:
value- The constant value that the descriptor should allow.- Returns:
- A descriptor for a value that only admits the given constant floating point value.
-
constant
- Parameters:
value- The constant value that the descriptor should allow.- Returns:
- A descriptor for a value that only admits the given constant large string value.
-
constant
- Parameters:
value- The constant value that the descriptor should allow.- Returns:
- A descriptor for a value that only admits the given constant integer value.
-
constant
- Parameters:
value- The constant value that the descriptor should allow.- Returns:
- A descriptor for a value that only admits the given constant string value.
-
constantBuilder
- Parameters:
value- The constant value that the descriptor should allow.- Returns:
- A descriptor builder for a boolean value that only admits a constant instance.
-
constantBuilder
- Parameters:
value- The constant value that the descriptor should allow.- Returns:
- A descriptor builder for a floating point value that only admits a constant instance.
-
constantBuilder
- Parameters:
value- The constant value that the descriptor should allow.- Returns:
- A descriptor builder for a large string value that only admits a constant instance.
-
constantBuilder
- Parameters:
value- The constant value that the descriptor should allow.- Returns:
- A descriptor builder for an integer value that only admits a constant instance.
-
constantBuilder
- Parameters:
value- The constant value that the descriptor should allow.- Returns:
- A descriptor builder for a string value that only admits a constant instance.
-
floating
- Returns:
- A descriptor for a floating point value that defaults to
0. The description uses the default i18n key determined from the root class and the path to this property.
-
floating
- Parameters:
defaultValue- The default value for the floating point property, used when no other value is supplied.- Returns:
- A descriptor for a floating point value that defaults to the given value. The description uses the default i18n key determined from the root class and the path to this property.
-
floating
Deprecated.- Parameters:
defaultValue- The default value for the floating point property, used when no other value is supplied.descriptionI18n- The i18n key to use for the description of the floating point property.- Returns:
- A descriptor for a floating point value that defaults to the given value and uses the given description.
-
floatingBuilder
IFloatValueDescriptorBuilder floatingBuilder()- Returns:
- A descriptor builder for a floating point value.
-
integer
- Returns:
- A descriptor for an integer value that defaults to
0. The description uses the default i18n key determined from the root class and the path to this property.
-
integer
- Parameters:
defaultValue- The default value for the integer property, used when no other value is supplied.- Returns:
- A descriptor for an integer value that defaults to the given value. The description uses the default i18n key determined from the root class and the path to this property.
-
integer
Deprecated.- Parameters:
defaultValue- The default value for the integer property, used when no other value is supplied.descriptionI18n- The i18n key to use for the description of the integer property.- Returns:
- A descriptor for an integer value that defaults to the given value and uses the given description.
-
integerBuilder
IIntegerValueDescriptorBuilder integerBuilder()- Returns:
- A descriptor builder for an integer value.
-
intersect
Intersects two value descriptors with each other. The intersection is the value descriptor that is compatible with both given descriptors, i.e. letcbeintersect(first, second), then for all valuesv:c.
If the descriptors are incompatible with each other,acceptsValue(v) <=> first.acceptsValue(v) & second.acceptsValue(v)IVoidValueDescriptoris returned, which does not accept any values.When there are conflicts, the
default valueand theattributesof the second descriptor are used. Disregarding the default value and the attributes, this is a symmetric operation, i.e.intersect(a,b) = intersect(b,a)
For example:intersect(null, void) = void intersect(string, string) = string intersect(string, boolean) = void intersect(string, null) = void intersect(string, void) = void intersect(string, "foo") = "foo" intersect(string, "foo" | "bar") = "foo" intersect(float, float) = float intersect(float, integer) = integer intersect(float[1,6], float[3,8]) = float[3,6] intersect(float[1,6), float(3,8]) = float(3,6) intersect(integer[1,6], integer[3,8]) = integer[3,6] // A union with a single string intersect(string, string | boolean) = string intersect(float | string | boolean, boolean | string) = string intersect(List[string], List[number]) = void intersect(List[string], List[string | number]) = List[string] intersect([string, string], List[string]) = [string, string] intersect([string, number], List[string]) = void intersect(Map[string], Map[number]) = void intersect(Map[string], Map[string]) = Map[string] intersect(Map[string|number], Map[string|number]) = Map[string] intersect({a=string|boolean,b=number}, Map[string|number]) = {a=string,b=number} intersect({a:string,b:number}, Map[string]) = void intersect({a:string}, {b:string}) = void intersect({a:string, b?:string}, {b:string}) = void intersect({a:string, b?:string}, {a?:string, b:string}) = {a:string, b:string} intersect({a:string, b:number}, {a:string, b:string}) = void intersect({type:"foo" | "bar"}, {type:"foo"}) = {type:"foo"} intersect( {type:"number", value:number} | {type:"string", value:string, optional?:boolean}, {type:"string", value:string} ) = {type:"string", value:string}- Parameters:
first- A descriptor to intersect with the other.second- A descriptor to intersect with the other.- Returns:
- The intersection of the two given value descriptors. If either is
null, the other is returned. If both arenull,voidish()is returned. - Since:
- 8.1.0
-
intersectAll
Intersects all value descriptors, returning a descriptor that represents their intersection. If no descriptors are given, returnsany(). Seeintersect(first, second)for more details on the intersection of two value descriptors. This is a convenience method that is functionally equivalent to:var result = any(); for (var descriptor : descriptors) { result = result.intersect(descriptor); } return result;- Parameters:
descriptors- Value descriptors to intersect.- Returns:
- The intersected value descriptor.
- Since:
- 8.5.0
- See Also:
-
intersectDescriptorMap
Map<String, IValueDescriptor<?,?>> intersectDescriptorMap(Map<String, IValueDescriptor<?, ?>> first, Map<String, IValueDescriptor<?, ?>> second) Intersects two maps of value descriptors with each other. The intersection is the map that contains only those entries that are present in both maps, and where the value descriptors are intersected usingintersect(first, second). If the descriptors are incompatible with each other, the entry is omitted from the result.- Parameters:
first- The first map of descriptors.second- The second map of descriptors.- Returns:
- The intersection of the two given maps of value descriptors.
- Since:
- 8.5.0
-
largeString
- Returns:
- A descriptor for a large string value that defaults to the empty string. The description uses the default i18n key determined from the root class and the path to this property.
-
largeString
- Parameters:
defaultValue- The default value for the string property, used when no other value is supplied.- Returns:
- A descriptor for a large string value that defaults to the given value. The description uses the default i18n key determined from the root class and the path to this property.
-
largeString
@Deprecated default ILargeStringValueDescriptor largeString(LargeString defaultValue, String descriptionI18n) Deprecated.- Parameters:
defaultValue- The default value for the string property, used when no other value is supplied.descriptionI18n- The i18n key to use for the description of the string property.- Returns:
- A descriptor for a large string value that defaults to the given value and uses the given description.
-
largeStringBuilder
ILargeStringValueDescriptorBuilder largeStringBuilder()- Returns:
- A descriptor builder for a large string value.
-
list
default <V> IListValueDescriptor<V> list(IValueDescriptor<V, ? extends IValueBuilder<V>> descriptor) - Type Parameters:
V- Type of the elements contained in the list.- Parameters:
descriptor- Descriptor for the elements contained in the list.- Returns:
- A descriptor for a list value (
List<V>) that defaults to an empty list and may contain any number of elements.
-
list
- Parameters:
elementType- Creates the descriptor for the type of the list elements.- Returns:
- A descriptor for a list value (
List<V>) that defaults to an empty list and may contain any number of elements.
-
listBuilder
<V> IListValueDescriptorBuilder<V> listBuilder(IValueDescriptor<V, ? extends IValueBuilder<V>> descriptor) - Type Parameters:
V- Type of the elements contained in the list.- Parameters:
descriptor- Descriptor for the elements contained in the list.- Returns:
- A descriptor builder for a list value (
List<V>).
-
listBuilder
- Parameters:
elementType- Creates the descriptor for the type of the list elements.- Returns:
- A descriptor builder for a list value (
List<V>).
-
listOfLargeStrings
- Returns:
- A descriptor builder for a value of type
List<LargeString>. The description uses the default i18n key determined from the root class and the path to this property.
-
listOfLargeStrings
Deprecated.- Parameters:
descriptionI18n- The i18n key to use for the description of the list-valued property.- Returns:
- A descriptor builder for a value of type
List<LargeString>.
-
listOfStrings
- Returns:
- A descriptor builder for a value of type
List<String>. The description uses the default i18n key determined from the root class and the path to this property.
-
listOfStrings
Deprecated.- Parameters:
descriptionI18n- The i18n key to use for the description of the list-valued property.- Returns:
- A descriptor builder for a value of type
List<String>.
-
map
- Type Parameters:
V- Type of the mapped values.- Parameters:
descriptor- Descriptor for the type of the mapped values.- Returns:
- A descriptor for a map value (
Map<String, V>) that defaults to an empty map.
-
map
- Parameters:
elementType- Creates the descriptor for the type of the mapped values.- Returns:
- A descriptor for a map value (
Map<String, V>) that defaults to an empty map.
-
mapBuilder
<V> IMapValueDescriptorBuilder<V> mapBuilder(IValueDescriptor<V, ? extends IValueBuilder<V>> descriptor) - Type Parameters:
V- Type of the mapped values.- Parameters:
descriptor- Descriptor for the type of the mapped values.- Returns:
- A descriptor builder for a map value (
Map<String, V>).
-
mapBuilder
- Parameters:
elementType- Creates the descriptor for the type of the mapped values.- Returns:
- A descriptor builder for a map value (
Map<String, V>).
-
mapToLargeStrings
- Returns:
- A descriptor builder for a value of type
Map<String, LargeString>. The description uses the default i18n key determined from the root class and the path to this property.
-
mapToLargeStrings
Deprecated.- Parameters:
descriptionI18n- The i18n key to use for the description of the map-valued property.- Returns:
- A descriptor builder for a value of type
Map<String, LargeString>.
-
mapToStrings
- Returns:
- A descriptor builder for a value of type
Map<String, String>. The description uses the default i18n key determined from the root class and the path to this property.
-
mapToStrings
Deprecated.- Parameters:
descriptionI18n- The i18n key to use for the description of the map-valued property.- Returns:
- A descriptor builder for a value of type
Map<String, String>.
-
normalizeUnion
Normalizes a union value descriptor by removing duplicate types, flattening nested unions, and merging types that can be merged (e.g. integer and float become float). If a union only has a single member after normalization, that type is returned instead of a union. If a union has no members after normalization,voidis returned.- Parameters:
descriptor- The union descriptor to normalize.- Returns:
- A normalized union descriptor.
- Since:
- 8.5.0
-
nullish
- Returns:
- A descriptor for a value that can only be
null.
-
nullish
Deprecated.- Parameters:
descriptionI18n- The i18n key to use for the description of the map-valued property.- Returns:
- A descriptor for a value that can only be
null.
-
nullishBuilder
INullValueDescriptorBuilder nullishBuilder()- Returns:
- A descriptor builder for a value that can only be
null.
-
record
- Returns:
- A descriptor for an empty record value.
-
recordBuilder
IRecordValueDescriptorBuilder recordBuilder()- Returns:
- A descriptor builder for a record value.
-
requiredString
Gets a string descriptor for a string value that must have a length of at least one and defaults to " ".- Returns:
- A descriptor for a string value that defaults to the empty string.
-
requiredString
- Parameters:
defaultValue- The default value for the string property, used when no other value is supplied.- Returns:
- A descriptor for a string value that defaults to the given value and must have a length of at least 1.
-
requiredStringBuilder
Creates a new builder for a string and sets it up so the string is required, i.e. must have a length of at least 1.- Returns:
- A descriptor builder for a required string value.
-
string
Gets a string descriptor that defaults to the empty string.- Returns:
- A descriptor for a string value that defaults to the empty string.
-
string
- Parameters:
defaultValue- The default value for the string property, used when no other value is supplied.- Returns:
- A descriptor for a string value that defaults to the given value.
-
string
Deprecated.- Parameters:
defaultValue- The default value for the string property, used when no other value is supplied.descriptionI18n- The i18n key to use for the description of the string property.- Returns:
- A descriptor for a string value that defaults to the given value and uses the given description.
-
stringBuilder
IStringValueDescriptorBuilder stringBuilder()- Returns:
- A descriptor builder for a string value.
-
tuple
Creates an empty tuple descriptor.- Returns:
- A descriptor for a tuple value that has a fixed length and where each element may have a different type. Each tuple element defaults to the default value of the given descriptor.
-
tuple
- Parameters:
types- Descriptor for each element in the tuple.- Returns:
- A descriptor for a tuple value that has a fixed length and where each element may have a different type. Each tuple element defaults to the default value of the given descriptor.
-
tuple
- Parameters:
types- Creates the descriptor for each element in the tuple.- Returns:
- A descriptor for a tuple value that has a fixed length and where each element may have a different type. Each tuple element defaults to the default value of the given descriptor.
-
tupleBuilder
ITupleValueDescriptorBuilder tupleBuilder()- Returns:
- A descriptor builder for a tuple value with a fixed length and where each element has the same type. Each tuple element defaults to the default value of the given descriptor.
-
tupleOfSame
default <V> ITupleValueDescriptor tupleOfSame(int count, IValueDescriptor<V, ? extends IValueBuilder<V>> type) - Type Parameters:
V- Common type of the tuple elements.- Parameters:
count- Number of elements in the tuple.type- Descriptor for each element in the tuple.- Returns:
- A descriptor for a tuple value of the given length and where each element has the same type. Each tuple element defaults to the default value of the given descriptor.
-
tupleOfSame
- Parameters:
count- Number of elements in the tuple.creator- Creates the descriptor for each element in the tuple.- Returns:
- A descriptor for a tuple value of the given length and where each element has the same type. Each tuple element defaults to the default value of the given descriptor.
-
unionBuilder
Deprecated.UseunionBuilder()instead.Creates a new union descriptor builder.- Parameters:
ignoredDiscriminatorClass- Unused.- Returns:
- A descriptor builder for a union value that uses instances of the given type as discriminators.
-
unionBuilder
IUnionValueDescriptorBuilder unionBuilder()Creates a new union descriptor builder.- Returns:
- A descriptor builder for a union value that uses instances of the given type as discriminators.
-
unionEmpty
- Returns:
- An empty union type, the same as
nullish().
-
unionEnumBuilder
@Deprecated default IUnionValueDescriptorBuilder unionEnumBuilder(Class<?> ignoredDiscriminatorClass) Deprecated.UseunionBuilder()instead.- Parameters:
ignoredDiscriminatorClass- Unused.- Returns:
- A descriptor builder for a union value that uses enum constants of the given type as discriminators.
-
unionOfEnumConst
Deprecated.UseunionOfStringConst(Class)instead.- Parameters:
enumClass- Class of the enum constants that are put in a union.- Returns:
- A descriptor for a union value that consists of all enum constants. Uses the enum constants as the discriminator.
-
unionOfEnumConst
@Deprecated default <E extends Enum<E>> IUnionValueDescriptor unionOfEnumConst(Class<E> enumClass, E defaultValue) Deprecated.UseunionOfStringConst(Class, Enum)instead.- Type Parameters:
E- Type of the enum constants that are put in a union.- Parameters:
enumClass- Class of the enum constants that are put in a union.defaultValue- Default value of the union.- Returns:
- A descriptor for a union value that consists of all enum constants. Uses the enum constants as the discriminator.
-
unionOfEnumConstBuilder
@Deprecated default IUnionValueDescriptorBuilder unionOfEnumConstBuilder(Class<? extends Enum<?>> enumClass) Deprecated.UseunionOfStringConstBuilder(Class)instead.- Parameters:
enumClass- Class of the enum constants that are put in a union.- Returns:
- A descriptor builder for a union value that consists of all enum constants. Uses the enum constants as the discriminator.
-
unionOfEnumConstBuilder
@Deprecated default <E extends Enum<E>> IUnionValueDescriptorBuilder unionOfEnumConstBuilder(Class<E> enumClass, E defaultValue) Deprecated.UseunionOfStringConstBuilder(Class, Enum)instead.- Type Parameters:
E- Type of the enum constants that are put in a union.- Parameters:
enumClass- Class of the enum constants that are put in a union.defaultValue- Default value of the union.- Returns:
- A descriptor builder for a union value that consists of all enum constants. Uses the enum constants as the discriminator.
-
unionOfStringConst
- Parameters:
enumClass- Class of the enum constants that are put in a union.- Returns:
- A descriptor for a union value that consists of all enum constants names. Uses the enum constants names as the discriminator.
-
unionOfStringConst
default <E extends Enum<E>> IUnionValueDescriptor unionOfStringConst(Class<E> enumClass, E defaultValue) - Type Parameters:
E- Type of the enum constants that are put in a union.- Parameters:
enumClass- Class of the enum constants that are put in a union.defaultValue- Default value of the union.- Returns:
- A descriptor for a union value that consists of all enum constants names. Uses the enum constants names as the discriminator.
-
unionOfStringConst
- Parameters:
first- First string in the union. This is also the default value.moreStrings- More strings in the union.- Returns:
- A value descriptor that represents the algebraic sum type
"string1" | "string2" | "string3" | ....
-
unionOfStringConstBuilder
- Parameters:
enumClass- Class of the enum constants that are put in a union.- Returns:
- A descriptor builder for a union value that consists of all enum constants names. Uses the enum constants names as the discriminator.
-
unionOfStringConstBuilder
default <E extends Enum<E>> IUnionValueDescriptorBuilder unionOfStringConstBuilder(Class<E> enumClass, E defaultValue) - Type Parameters:
E- Type of the enum constants that are put in a union.- Parameters:
enumClass- Class of the enum constants that are put in a union.defaultValue- Default value of the union.- Returns:
- A descriptor builder for a union value that consists of all enum constants names. Uses the enum constants names as the discriminator.
-
unionOfStringConstBuilder
- Parameters:
first- First string in the union. This is also the default value.moreStrings- More strings in the union.- Returns:
- A value descriptor builder that represents the algebraic sum type
"string1" | "string2" | "string3" | ....
-
unionStringBuilder
Deprecated.UseunionBuilder()instead.- Returns:
- A descriptor builder for a union value that uses string constants as discriminators.
-
unionWithNull
Creates a union value descriptor with two members, one beingnulland the other being the given descriptor. The discriminator type isString, with the discriminator value being"null"fornulland"value"for the other member.This can be used e.g. to create optional values, e.g.
integer | null.- Parameters:
valueDescriptor- Descriptor for the non-null member of the union.- Returns:
- A descriptor for a union value that is either
nullor a value that is accepted by the given descriptor.
-
unionWithNullBuilder
Creates a union value descriptor builder set up with two members, one beingnulland the other being the given descriptor.This can be used e.g. to create optional values, e.g.
integer | null.- Parameters:
valueDescriptor- Descriptor for the non-null member of the union.- Returns:
- A descriptor for a union value that is either
nullor a value that is accepted by the given descriptor.
-
voidish
IVoidValueDescriptor voidish()- Returns:
- A value descriptor for a void result. This is valid only as a root value for the return value of a method.
-
boolBuilder()withIValueDescriptorBuilder.addAttribute(String, Object).