Package co.elastic.clients.util
Class ApiTypeHelper
java.lang.Object
co.elastic.clients.util.ApiTypeHelper
Utility functions for API model types
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionDANGEROUS_disableRequiredPropertiesCheck(boolean disable) DANGEROUS! Allows disabling the verification of required properties on the current thread when callingObjectBuilder.build().static <T> booleanIslistdefined according to JSON/JavaScript semantics?static <K,V> boolean Ismapdefined according to JSON/JavaScript semantics?static booleanstatic <T> TrequireNonNull(T value, Object obj, String name) static <T> List<T>Returns an empty list that is undefined from a JSON perspective.static <K,V> Map<K, V> Returns an empty list that is undefined from a JSON perspective.static <T> List<T>unmodifiable(List<T> list) Returns an unmodifiable view of a list.static <K,V> Map<K, V> unmodifiable(Map<K, V> map) Returns an unmodifiable view of a map.static <T> List<T>unmodifiableRequired(List<T> list, Object obj, String name) Returns an unmodifiable view of a required list.static <K,V> Map<K, V> unmodifiableRequired(Map<K, V> map, Object obj, String name) Returns an unmodifiable view of a required map.
-
Method Details
-
requiredPropertiesCheckDisabled
public static boolean requiredPropertiesCheckDisabled() -
DANGEROUS_disableRequiredPropertiesCheck
public static ApiTypeHelper.DisabledChecksHandle DANGEROUS_disableRequiredPropertiesCheck(boolean disable) DANGEROUS! Allows disabling the verification of required properties on the current thread when callingObjectBuilder.build(). This can lead properties expected to be always present to benull, or have the default value for primitive types.This can be used as a workaround for properties that are erroneously marked as required. If you have to use it, please file a bug at https://github.com/elastic/elasticsearch-java/issues to report the offending property.
The result of this method is an
AutoCloseablehandle that can be used in try-with-resource blocks to precisely limit the scope where checks are disabled. -
requireNonNull
-
undefinedList
Returns an empty list that is undefined from a JSON perspective. It will not be serialized when used as the value of an array property in API objects. -
isDefined
Islistdefined according to JSON/JavaScript semantics?- Returns:
- true if
listis notnulland notundefinedList()
-
unmodifiable
-
unmodifiableRequired
Returns an unmodifiable view of a required list. -
undefinedMap
Returns an empty list that is undefined from a JSON perspective. It will not be serialized when used as the value of an array property in API objects. -
isDefined
Ismapdefined according to JSON/JavaScript semantics?- Returns:
- true if
mapis notnulland notundefinedMap()
-
unmodifiable
-
unmodifiableRequired
Returns an unmodifiable view of a required map.
-