public final class ModelUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
UNKNOWN_ELEMENT_NAME
The name of a variable in the model tree that is unrecognised.
|
| Modifier and Type | Method and Description |
|---|---|
static void |
applyReference(org.eclipse.microprofile.openapi.models.Reference<?> referee,
String reference)
Set the reference property of an object, and clear every other field.
|
static <T> List<T> |
createList() |
static <T> List<T> |
createList(Collection<? extends T> items) |
static <K,V> Map<K,V> |
createMap() |
static <K,V> Map<K,V> |
createMap(Map<? extends K,? extends V> items) |
static <K,V> Map<K,V> |
createOrderedMap() |
static <K,V> Map<K,V> |
createOrderedMap(Map<? extends K,? extends V> items) |
static <T> void |
extractAnnotations(org.glassfish.hk2.classmodel.reflect.AnnotationModel annotationModel,
ApiContext context,
String type,
BiFunction<org.glassfish.hk2.classmodel.reflect.AnnotationModel,ApiContext,T> factory,
Consumer<T> wrapperAddFunction) |
static <T> void |
extractAnnotations(org.glassfish.hk2.classmodel.reflect.AnnotationModel annotationModel,
ApiContext context,
String type,
String key,
BiFunction<org.glassfish.hk2.classmodel.reflect.AnnotationModel,ApiContext,T> factory,
BiConsumer<String,T> wrapperAddFunction) |
static org.eclipse.microprofile.openapi.models.Operation |
findOperation(OpenApiContext context,
org.eclipse.microprofile.openapi.models.OpenAPI api,
org.glassfish.hk2.classmodel.reflect.MethodModel method,
String path) |
static String |
getAccessorName(String fieldName) |
static org.eclipse.microprofile.openapi.models.PathItem.HttpMethod |
getHttpMethod(OpenApiContext context,
org.glassfish.hk2.classmodel.reflect.MethodModel method) |
static org.eclipse.microprofile.openapi.models.PathItem.HttpMethod |
getHttpMethod(String method) |
static org.eclipse.microprofile.openapi.models.Operation |
getOrCreateOperation(org.eclipse.microprofile.openapi.models.PathItem pathItem,
org.eclipse.microprofile.openapi.models.PathItem.HttpMethod httpMethod)
Creates a new
Operation, and inserts it into the PathItem. |
static String |
getParameterName(ApiContext context,
org.glassfish.hk2.classmodel.reflect.Parameter parameter) |
static org.eclipse.microprofile.openapi.models.parameters.Parameter.In |
getParameterType(ApiContext context,
org.glassfish.hk2.classmodel.reflect.Parameter parameter) |
static org.eclipse.microprofile.openapi.models.media.Schema.SchemaType |
getParentSchemaType(org.eclipse.microprofile.openapi.models.media.Schema.SchemaType type1,
org.eclipse.microprofile.openapi.models.media.Schema.SchemaType type2)
Finds a
Schema.SchemaType that can represent both of the given types. |
static String |
getSchemaName(ApiContext context,
org.glassfish.hk2.classmodel.reflect.AnnotatedElement type) |
static org.eclipse.microprofile.openapi.models.media.Schema.SchemaType |
getSchemaType(org.glassfish.hk2.classmodel.reflect.ParameterizedType type,
ApiContext context) |
static org.eclipse.microprofile.openapi.models.media.Schema.SchemaType |
getSchemaType(String typeName,
ApiContext context)
Finds the
Schema.SchemaType that corresponds to a given class. |
static String |
getSimpleName(String fqn) |
static boolean |
isAnnotationNull(Annotation annotation) |
static boolean |
isMap(String typeName,
ApiContext context) |
static boolean |
isRequestBody(ApiContext context,
org.glassfish.hk2.classmodel.reflect.Parameter parameter) |
static boolean |
isVoid(org.glassfish.hk2.classmodel.reflect.ParameterizedType type) |
static <T> void |
merge(T from,
T to,
boolean override) |
static <T> void |
mergeImmutableList(List<T> from,
List<T> to,
Consumer<List<T>> setFunction) |
static Boolean |
mergeProperty(boolean current,
boolean offer,
boolean override) |
static Boolean |
mergeProperty(boolean current,
Boolean offer,
boolean override) |
static Boolean |
mergeProperty(Boolean current,
boolean offer,
boolean override) |
static <E> E |
mergeProperty(E current,
E offer,
boolean override) |
static String |
normaliseUrl(String path)
Normalises a path string.
|
static <T> void |
overwrite(T from,
T to) |
static <T> List<T> |
readOnlyView(List<T> list) |
static <K,V> Map<K,V> |
readOnlyView(Map<K,V> map) |
static void |
removeOperation(org.eclipse.microprofile.openapi.models.PathItem pathItem,
org.eclipse.microprofile.openapi.models.Operation operation) |
public static final String UNKNOWN_ELEMENT_NAME
public static String normaliseUrl(String path)
path - the path to be normalised.public static org.eclipse.microprofile.openapi.models.PathItem.HttpMethod getHttpMethod(OpenApiContext context, org.glassfish.hk2.classmodel.reflect.MethodModel method)
context - method - the method to analyse.PathItem.HttpMethod applied to this method, or null if there is
none.public static org.eclipse.microprofile.openapi.models.PathItem.HttpMethod getHttpMethod(String method)
public static org.eclipse.microprofile.openapi.models.Operation getOrCreateOperation(org.eclipse.microprofile.openapi.models.PathItem pathItem,
org.eclipse.microprofile.openapi.models.PathItem.HttpMethod httpMethod)
Operation, and inserts it into the PathItem.pathItem - the PathItem to add the Operation to.httpMethod - the HTTP method of the operation to add.Operation, or the existing operation if
available.public static org.eclipse.microprofile.openapi.models.Operation findOperation(OpenApiContext context, org.eclipse.microprofile.openapi.models.OpenAPI api, org.glassfish.hk2.classmodel.reflect.MethodModel method, String path)
public static void removeOperation(org.eclipse.microprofile.openapi.models.PathItem pathItem,
org.eclipse.microprofile.openapi.models.Operation operation)
public static String getSchemaName(ApiContext context, org.glassfish.hk2.classmodel.reflect.AnnotatedElement type)
public static org.eclipse.microprofile.openapi.models.media.Schema.SchemaType getSchemaType(org.glassfish.hk2.classmodel.reflect.ParameterizedType type,
ApiContext context)
public static org.eclipse.microprofile.openapi.models.media.Schema.SchemaType getSchemaType(String typeName, ApiContext context)
Schema.SchemaType that corresponds to a given class.typeName - the class to map.public static boolean isMap(String typeName, ApiContext context)
public static org.eclipse.microprofile.openapi.models.media.Schema.SchemaType getParentSchemaType(org.eclipse.microprofile.openapi.models.media.Schema.SchemaType type1,
org.eclipse.microprofile.openapi.models.media.Schema.SchemaType type2)
Schema.SchemaType that can represent both of the given types. If one
of the input values are null, this function returns the other. If both are
null, this function returns null.type1 - the first schema type.type2 - the second schema type.Schema.SchemaType that can represent both.public static boolean isRequestBody(ApiContext context, org.glassfish.hk2.classmodel.reflect.Parameter parameter)
public static org.eclipse.microprofile.openapi.models.parameters.Parameter.In getParameterType(ApiContext context, org.glassfish.hk2.classmodel.reflect.Parameter parameter)
public static String getParameterName(ApiContext context, org.glassfish.hk2.classmodel.reflect.Parameter parameter)
public static boolean isVoid(org.glassfish.hk2.classmodel.reflect.ParameterizedType type)
public static boolean isAnnotationNull(Annotation annotation)
public static <T> void extractAnnotations(org.glassfish.hk2.classmodel.reflect.AnnotationModel annotationModel,
ApiContext context,
String type,
String key,
BiFunction<org.glassfish.hk2.classmodel.reflect.AnnotationModel,ApiContext,T> factory,
BiConsumer<String,T> wrapperAddFunction)
public static <T> void extractAnnotations(org.glassfish.hk2.classmodel.reflect.AnnotationModel annotationModel,
ApiContext context,
String type,
BiFunction<org.glassfish.hk2.classmodel.reflect.AnnotationModel,ApiContext,T> factory,
Consumer<T> wrapperAddFunction)
public static <T> void mergeImmutableList(List<T> from, List<T> to, Consumer<List<T>> setFunction)
public static Boolean mergeProperty(boolean current, boolean offer, boolean override)
public static <E> E mergeProperty(E current,
E offer,
boolean override)
public static void applyReference(org.eclipse.microprofile.openapi.models.Reference<?> referee,
String reference)
public static <T> void overwrite(T from,
T to)
public static <T> void merge(T from,
T to,
boolean override)
public static <T> List<T> createList()
public static <T> List<T> createList(Collection<? extends T> items)
public static <K,V> Map<K,V> createMap()
public static <K,V> Map<K,V> createOrderedMap()
Copyright © 2021. All rights reserved.