com.ibm.commerce.foundation.rest.resourcehandler

Class DefaultDocumentationStrategy

  • java.lang.Object
    • com.ibm.commerce.foundation.rest.resourcehandler.DefaultDocumentationStrategy


  • public class DefaultDocumentationStrategy
    extends java.lang.Object
    Default implementation used to document REST APIs based on annotations and EMF.
    • Constructor Detail

      • DefaultDocumentationStrategy

        public DefaultDocumentationStrategy(AbstractBaseResourceHandler handlerToDocument,
                                            java.util.Locale locale)
        Constructor.
        Parameters:
        handlerToDocument - Handler to document.
        locale - The locale to use.
    • Method Detail

      • addPathClarification

        public void addPathClarification(java.lang.String path,
                                         org.eclipse.emf.ecore.EClass type)
        Clarify the type of a path by name.
        Parameters:
        path - the path name.
        type - The EClass that is actually used on that path.
      • getResourceBundleNameForHandlerClass

        public static java.lang.String getResourceBundleNameForHandlerClass(java.lang.Class<? extends AbstractBaseResourceHandler> handlerClass)
        Get the resource bundle name to use for a resource handler class.
        Parameters:
        handlerClass - The handler class.
        Returns:
        The bundle name in java format. Example : "com.ibm.commerce.MyHandlerMessages"
      • documentApi

        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
        Document the referenced API.
        Parameters:
        urlContextRoot - The API context root.
        executionHandler - The handler currently executing the request.
        bundle - The resource bundle to fill.
        Returns:
        The API documentation structured in JSON Schema.
        Throws:
        java.lang.Exception - If anything goes wrong.
      • getPrimitiveWrapperClass

        public static java.lang.Class<?> getPrimitiveWrapperClass(java.lang.Class paramType)
        Get the class used to wrap primitive types. For example, Long.class wraps Long.TYPE.
        Parameters:
        paramType - the basic class type to wrap.
        Returns:
        The wrapped version.
      • getClassDescription

        public java.lang.String getClassDescription()
        Get the class description based on description annotations.
        Returns:
        The class description.
      • getLocale

        public java.util.Locale getLocale()
        Returns:
        the locale
      • getApiVersion

        public static java.lang.String getApiVersion()
        Get the API Version.
        Returns:
        The running API Version.