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> void |
extractAnnotations(org.glassfish.hk2.classmodel.reflect.AnnotationModel annotationModel,
ApiContext context,
String type,
BiFunction<org.glassfish.hk2.classmodel.reflect.AnnotationModel,ApiContext,T> factory,
List<T> wrapper) |
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,
Map<String,T> wrapper) |
static org.eclipse.microprofile.openapi.models.Operation |
findOperation(org.eclipse.microprofile.openapi.models.OpenAPI api,
org.glassfish.hk2.classmodel.reflect.MethodModel method,
String path) |
static org.eclipse.microprofile.openapi.models.PathItem.HttpMethod |
getHttpMethod(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(org.glassfish.hk2.classmodel.reflect.Parameter parameter) |
static org.eclipse.microprofile.openapi.models.parameters.Parameter.In |
getParameterType(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 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 |
isRequestBody(org.glassfish.hk2.classmodel.reflect.Parameter parameter) |
static <T> void |
merge(T from,
T to,
boolean override) |
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 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(org.glassfish.hk2.classmodel.reflect.MethodModel method)
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(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 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 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(org.glassfish.hk2.classmodel.reflect.Parameter parameter)
public static org.eclipse.microprofile.openapi.models.parameters.Parameter.In getParameterType(org.glassfish.hk2.classmodel.reflect.Parameter parameter)
public static String getParameterName(org.glassfish.hk2.classmodel.reflect.Parameter parameter)
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,
Map<String,T> wrapper)
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,
List<T> wrapper)
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)
Copyright © 2020. All rights reserved.