public class DefaultDocumentationStrategy
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
protected static class | DefaultDocumentationStrategy.OutputClass
Output class mapped to a EMF EClass.
|
protected static class | DefaultDocumentationStrategy.OutputField
Field mapped to an EMF field.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String | COPYRIGHT
copyright
|
Constructor and Description |
---|
DefaultDocumentationStrategy(AbstractBaseResourceHandler handlerToDocument, java.util.Locale locale)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void | addPathClarification(java.lang.String path, org.eclipse.emf.ecore.EClass type)
Clarify the type of a path by name.
|
protected java.lang.String | cleanEmfText(java.lang.String textContent)
Cleanup EMF text to strip out \n\r\t and trim the result.
|
org.apache.commons.json.JSONObject | documentApi(java.lang.String urlContextRoot, AbstractBaseResourceHandler executionHandler, java.util.Map<java.lang.String,java.lang.String> bundle)
Document the referenced API.
|
protected void | documentApiMappedModelClass(java.lang.Class<?> valueClass, java.util.Collection<OutputMappingElement> mappedFields, java.lang.String className)
Document a mapped class.
|
protected void | documentApiMethod(java.lang.reflect.Method method)
Document an API method.
|
protected void | documentApiMethods()
Document all the API methods.
|
protected void | documentApiModelClass(java.lang.Class<?> valueClass)
Document the API model class.
|
protected void | documentApiModels()
Document the API model schemas.
|
protected void | documentApiModels(java.lang.reflect.Method method)
Document all the API models for a specific method.
|
protected void | documentApiSample(java.lang.String valueSamplePath)
Document an API Sample.
|
protected void | documentDescriptionValues(java.util.Map<java.lang.String,java.lang.Object> baseContext, ParameterDescription parameterDescription, org.apache.commons.json.JSONObject parameter)
Document the parameter description values if there are any.
|
protected void | documentEmfEnumerationType(org.apache.commons.json.JSONObject parameter, org.eclipse.emf.ecore.EClassifier type)
Document a EMF enumeration.
|
protected void | documentEmptyModel()
Document the default empty model.
|
protected void | documentFieldType(org.apache.commons.json.JSONObject parameter, java.lang.Class<?> fieldType, java.lang.String formatOverride)
Document a class field.
|
protected void | documentJsonObjectPropertiesToModel(java.lang.String className, java.util.Map<java.lang.String,java.lang.Object> object, org.apache.commons.json.JSONObject properties)
Reverse engineer a json properties to a model description.
|
protected void | documentMappedFieldType(java.util.Map<java.lang.String,java.lang.Object> baseContext, org.apache.commons.json.JSONObject parameter, java.lang.Class<?> fieldType, OutputMappingElement outputMappingElement, java.lang.String className)
Document a class mapped field.
|
protected void | documentMappedInput(org.apache.commons.json.JSONArray parameterList, java.util.Map<java.lang.String,java.lang.Object> context, parsedClass, InputMappingElement inputMappingElement)
Document a mapped input.
|
protected void | documentMappedInputs(org.apache.commons.json.JSONArray parameterList, java.util.Map<java.lang.String,java.lang.Object> context, AdditionalParameterList additionalParameters)
Document a list of mapped inputs.
|
protected void | documentMethodParameters(java.lang.reflect.Method method, org.apache.commons.json.JSONObject operationObject)
Document the parameters of a method.
|
protected void | documentModelFieldMapping(com.ibm.commerce.foundation.rest.bodmapping.BODMappingUtility mappingUtil, org.eclipse.emf.ecore.EClass nounEClass, DefaultDocumentationStrategy.OutputClass rootModel, DefaultDocumentationStrategy.OutputClass model, java.lang.String urlParameter, URLParameterToNounElementAssociation association, java.lang.String resourceName)
Document a model field mapping based on the BOD mapping configuration.
|
protected void | documentParameter(java.util.Map<java.lang.String,java.lang.Object> baseContext, org.apache.commons.json.JSONArray parameterList, java.lang.Class paramType, ParameterDescription description, boolean isPathParam, boolean descriptionRequired, boolean documentMultiple, java.lang.String paramName, java.lang.String methodName)
Document a parameter.
|
protected java.lang.String | documentParameterGroup(java.lang.String resourceName, java.lang.String parameterGroup, org.eclipse.emf.ecore.EClass eClass)
Document a parameter group based on the REST API BOD mapping.
|
protected void | documentParameterGroupModel(DefaultDocumentationStrategy.OutputClass modelToDocument)
Document a parameter group model.
|
protected void | documentSampleFieldType(java.lang.String className, java.lang.String key, java.lang.Object value, org.apache.commons.json.JSONObject currentProperty)
Document a sample field type based on a sample value.
|
protected void | fullyDescribeEmfClass(org.eclipse.emf.ecore.EClass currentEClass, DefaultDocumentationStrategy.OutputClass currentModel)
Fully describe an EMF class.
|
protected java.lang.String | getApiMessage(java.lang.String messageKey)
Fetch a translated API documentation message
|
protected java.util.ResourceBundle | getApiResourceBundle(java.util.Locale locale)
Get the API Resource bundle based on the selected locale.
|
static java.lang.String | getApiVersion()
Get the API Version.
|
java.lang.String | getClassDescription()
Get the class description based on description annotations.
|
protected org.w3c.dom.Document | getDocumentFromPackage(java.lang.String packageName)
Get the EMF document for a package.
|
protected java.lang.String | getEmfClassDescription(org.eclipse.emf.ecore.EClass class1)
Get the EMF class description.
|
protected java.lang.String | getEmfFieldDescription(org.eclipse.emf.ecore.EStructuralFeature parameter)
Get the EMF Field description.
|
protected java.lang.String | getFormatFromClass(java.lang.Class paramType)
Get the format name from a class.
|
protected java.lang.String | getFormatFromEmf(org.eclipse.emf.ecore.EClassifier type)
Get the format name from the EClassifier.
|
java.lang.Class<? extends AbstractBaseResourceHandler> | getHandlerClass() |
AbstractBaseResourceHandler | getHandlerToDocument() |
protected java.lang.String | getHttpMethodName(java.lang.reflect.Method method)
Fetch the HTTP method name of a method exposed as a REST API.
|
java.util.Locale | getLocale() |
protected java.lang.String | getMethodHttpMethodAnnotation(java.lang.reflect.Method method)
Get the HTTPMethod annotation from a method.
|
protected org.eclipse.emf.ecore.EClass | getNounClass(java.lang.String noun)
Get the noun EMF Class by name.
|
protected java.lang.String | getParameterDescription(java.lang.String methodName, ParameterDescription parameterDescription, java.lang.String parameterName)
The the description of a parameter.
|
static java.lang.Class<?> | getPrimitiveWrapperClass(java.lang.Class paramType)
Get the class used to wrap primitive types.
|
static java.lang.String | getResourceBundleNameForHandlerClass(java.lang.Class<? extends AbstractBaseResourceHandler> handlerClass)
Get the resource bundle name to use for a resource handler class.
|
protected java.lang.String | getResourceNameFromParameterGroup(java.lang.String resourceName, java.lang.String parameterGroup)
Get a resource name from a parameter group.
|
protected java.lang.String | getTypeFromClass(java.lang.Class paramType)
Get the type name from a class.
|
protected java.lang.String | getTypeFromEmf(org.eclipse.emf.ecore.EClassifier type)
Get the type name from the EClassifier.
|
protected boolean | isBasicType(java.lang.Class<?> fieldType)
Test if the field is a basic type such as String, Boolean, Date.
|
protected boolean | isInputParameterNameDocumented(java.lang.String parameterName, org.apache.commons.json.JSONArray parameterList)
Test if a parameter is already documented.
|
protected boolean | isPartialAuthenticationAllowed(java.lang.String httpMethod, java.lang.String path)
Test if partial authentication is allowed on a method.
|
protected boolean | isSecureCallRequired(java.lang.String httpMethod, java.lang.String path)
Test if a secure call is required for a URL request.
|
public static final java.lang.String COPYRIGHT
public DefaultDocumentationStrategy(AbstractBaseResourceHandler handlerToDocument, java.util.Locale locale)
public void addPathClarification(java.lang.String path, org.eclipse.emf.ecore.EClass type)
public static java.lang.String getResourceBundleNameForHandlerClass(java.lang.Class<? extends AbstractBaseResourceHandler> handlerClass)
protected java.util.ResourceBundle getApiResourceBundle(java.util.Locale locale)
protected java.lang.String getApiMessage(java.lang.String messageKey)
public org.apache.commons.json.JSONObject documentApi(java.lang.String urlContextRoot, AbstractBaseResourceHandler executionHandler, java.util.Map<java.lang.String,java.lang.String> bundle) throws java.lang.Exception
protected void documentEmptyModel() throws org.apache.commons.json.JSONException
protected void documentApiModels() throws java.lang.Exception
protected void documentApiModels(java.lang.reflect.Method method) throws java.lang.Exception
protected void documentApiSample(java.lang.String valueSamplePath) throws org.apache.commons.json.JSONException
protected void documentJsonObjectPropertiesToModel(java.lang.String className, java.util.Map<java.lang.String,java.lang.Object> object, org.apache.commons.json.JSONObject properties) throws java.lang.Exception
protected void documentSampleFieldType(java.lang.String className, java.lang.String key, java.lang.Object value, org.apache.commons.json.JSONObject currentProperty) throws java.lang.Exception
protected void documentApiMappedModelClass(java.lang.Class<?> valueClass, java.util.Collection<OutputMappingElement> mappedFields, java.lang.String className) throws org.apache.commons.json.JSONException
protected void documentMappedFieldType(java.util.Map<java.lang.String,java.lang.Object> baseContext, org.apache.commons.json.JSONObject parameter, java.lang.Class<?> fieldType, OutputMappingElement outputMappingElement, java.lang.String className) throws java.lang.Exception
protected java.lang.String documentParameterGroup(java.lang.String resourceName, java.lang.String parameterGroup, org.eclipse.emf.ecore.EClass eClass) throws java.lang.Exception
protected void documentModelFieldMapping(com.ibm.commerce.foundation.rest.bodmapping.BODMappingUtility mappingUtil, org.eclipse.emf.ecore.EClass nounEClass, DefaultDocumentationStrategy.OutputClass rootModel, DefaultDocumentationStrategy.OutputClass model, java.lang.String urlParameter, URLParameterToNounElementAssociation association, java.lang.String resourceName) throws java.lang.Exception
protected void fullyDescribeEmfClass(org.eclipse.emf.ecore.EClass currentEClass, DefaultDocumentationStrategy.OutputClass currentModel)
protected void documentParameterGroupModel(DefaultDocumentationStrategy.OutputClass modelToDocument) throws java.lang.Exception
protected void documentEmfEnumerationType(org.apache.commons.json.JSONObject parameter, org.eclipse.emf.ecore.EClassifier type) throws org.apache.commons.json.JSONException
protected java.lang.String getTypeFromEmf(org.eclipse.emf.ecore.EClassifier type)
protected java.lang.String getFormatFromEmf(org.eclipse.emf.ecore.EClassifier type)
protected java.lang.String getEmfFieldDescription(org.eclipse.emf.ecore.EStructuralFeature parameter)
protected java.lang.String cleanEmfText(java.lang.String textContent)
protected org.w3c.dom.Document getDocumentFromPackage(java.lang.String packageName)
protected java.lang.String getEmfClassDescription(org.eclipse.emf.ecore.EClass class1)
protected org.eclipse.emf.ecore.EClass getNounClass(java.lang.String noun)
protected void documentApiModelClass(java.lang.Class<?> valueClass) throws java.lang.Exception
protected void documentFieldType(org.apache.commons.json.JSONObject parameter, java.lang.Class<?> fieldType, java.lang.String formatOverride) throws java.lang.Exception
protected boolean isBasicType(java.lang.Class<?> fieldType)
protected void documentApiMethods() throws java.lang.Exception
protected void documentApiMethod(java.lang.reflect.Method method) throws java.lang.Exception
protected boolean isPartialAuthenticationAllowed(java.lang.String httpMethod, java.lang.String path)
protected boolean isSecureCallRequired(java.lang.String httpMethod, java.lang.String path)
protected java.lang.String getHttpMethodName(java.lang.reflect.Method method)
protected java.lang.String getResourceNameFromParameterGroup(java.lang.String resourceName, java.lang.String parameterGroup)
protected void documentMethodParameters(java.lang.reflect.Method method, org.apache.commons.json.JSONObject operationObject) throws java.lang.Exception
protected void documentMappedInputs(org.apache.commons.json.JSONArray parameterList, java.util.Map<java.lang.String,java.lang.Object> context, AdditionalParameterList additionalParameters) throws java.lang.Exception
protected void documentMappedInput(org.apache.commons.json.JSONArray parameterList, java.util.Map<java.lang.String,java.lang.Object> context, parsedClass, InputMappingElement inputMappingElement) throws java.lang.Exception
protected boolean isInputParameterNameDocumented(java.lang.String parameterName, org.apache.commons.json.JSONArray parameterList) throws org.apache.commons.json.JSONException
protected java.lang.String getParameterDescription(java.lang.String methodName, ParameterDescription parameterDescription, java.lang.String parameterName)
protected void documentDescriptionValues(java.util.Map<java.lang.String,java.lang.Object> baseContext, ParameterDescription parameterDescription, org.apache.commons.json.JSONObject parameter) throws java.lang.Exception
protected void documentParameter(java.util.Map<java.lang.String,java.lang.Object> baseContext, org.apache.commons.json.JSONArray parameterList, java.lang.Class paramType, ParameterDescription description, boolean isPathParam, boolean descriptionRequired, boolean documentMultiple, java.lang.String paramName, java.lang.String methodName) throws java.lang.Exception
protected java.lang.String getTypeFromClass(java.lang.Class paramType)
protected java.lang.String getFormatFromClass(java.lang.Class paramType)
public static java.lang.Class<?> getPrimitiveWrapperClass(java.lang.Class paramType)
protected java.lang.String getMethodHttpMethodAnnotation(java.lang.reflect.Method method)
public java.lang.String getClassDescription()
public java.util.Locale getLocale()
public java.lang.Class<? extends AbstractBaseResourceHandler> getHandlerClass()
public AbstractBaseResourceHandler getHandlerToDocument()
public static java.lang.String getApiVersion()