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 org.eclipse.microprofile.openapi.models.Operation |
findOperation(org.eclipse.microprofile.openapi.models.OpenAPI api,
Method method,
String path) |
static org.eclipse.microprofile.openapi.models.PathItem.HttpMethod |
getHttpMethod(Method method) |
static org.eclipse.microprofile.openapi.models.PathItem.HttpMethod |
getHttpMethod(String method) |
static org.eclipse.microprofile.openapi.models.Operation |
getOperation(Method method,
org.eclipse.microprofile.openapi.models.OpenAPI api,
Map<String,Set<Class<?>>> resourceMapping) |
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(Parameter parameter) |
static org.eclipse.microprofile.openapi.models.parameters.Parameter.In |
getParameterType(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 |
getResourcePath(GenericDeclaration declaration,
Map<String,Set<Class<?>>> resourceMapping) |
static org.eclipse.microprofile.openapi.models.media.Schema.SchemaType |
getSchemaType(Class<?> type)
Finds the
Schema.SchemaType that corresponds to a given class. |
static boolean |
isAnnotationNull(Annotation annotation) |
static boolean |
isRequestBody(Parameter parameter) |
static <T> void |
merge(T from,
T to,
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(Method 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, Method 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(Class<?> type)
Schema.SchemaType
that corresponds to a given class.type
- 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(Parameter parameter)
public static org.eclipse.microprofile.openapi.models.parameters.Parameter.In getParameterType(Parameter parameter)
public static boolean isAnnotationNull(Annotation annotation)
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 org.eclipse.microprofile.openapi.models.Operation getOperation(Method method, org.eclipse.microprofile.openapi.models.OpenAPI api, Map<String,Set<Class<?>>> resourceMapping)
Copyright © 2018. All rights reserved.