Class JsonApiModelResolver

  • All Implemented Interfaces:
    io.swagger.converter.ModelConverter

    public class JsonApiModelResolver
    extends io.swagger.jackson.ModelResolver
    Swagger ModelResolvers map POJO classes to Swagger example.models. This resolver maps the POJO to a JSON-API Resource.
    • Field Summary

      • Fields inherited from class io.swagger.jackson.AbstractModelConverter

        _intr, _mapper, _resolvedTypeNames, _typeNameResolver
    • Constructor Summary

      Constructors 
      Constructor Description
      JsonApiModelResolver​(com.yahoo.elide.core.dictionary.EntityDictionary dictionary)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected String getClassPermissions​(com.yahoo.elide.core.type.Type<?> clazz)
      Get the class-level permission annotation value.
      protected String getCreatePermission​(com.yahoo.elide.core.type.Type<?> clazz)
      Get the calculated CreatePermission value for the field.
      protected String getDeletePermission​(com.yahoo.elide.core.type.Type<?> clazz)
      Get the calculated DeletePermission value for the field.
      protected String getFieldPermissions​(com.yahoo.elide.core.type.Type<?> clazz, String fieldName)
      Get the field level permission annotation value.
      protected String getReadPermission​(com.yahoo.elide.core.type.Type<?> clazz, String fieldName)
      Get the calculated ReadPermission value for the field.
      protected String getUpdatePermission​(com.yahoo.elide.core.type.Type<?> clazz, String fieldName)
      Get the calculated UpdatePermission value for the field.
      io.swagger.models.Model resolve​(Type type, io.swagger.converter.ModelConverterContext context, Iterator<io.swagger.converter.ModelConverter> next)  
      • Methods inherited from class io.swagger.jackson.ModelResolver

        _addEnumProps, applyBeanValidatorAnnotations, decorateModelName, getInnerType, ignore, objectMapper, resolve, resolveProperty, resolveProperty, shouldIgnoreClass
      • Methods inherited from class io.swagger.jackson.AbstractModelConverter

        _description, _findDefaultValue, _findExampleValue, _findReadOnly, _findReadOnlyFromAccessMode, _findTypeName, _isSetType, _subTypeName, _typeName, _typeName, _typeQName, getPropertyComparator, prioritizeAnnotationInspectorSchemaName
    • Constructor Detail

      • JsonApiModelResolver

        public JsonApiModelResolver​(com.yahoo.elide.core.dictionary.EntityDictionary dictionary)
    • Method Detail

      • resolve

        public io.swagger.models.Model resolve​(Type type,
                                               io.swagger.converter.ModelConverterContext context,
                                               Iterator<io.swagger.converter.ModelConverter> next)
        Specified by:
        resolve in interface io.swagger.converter.ModelConverter
        Overrides:
        resolve in class io.swagger.jackson.ModelResolver
      • getClassPermissions

        protected String getClassPermissions​(com.yahoo.elide.core.type.Type<?> clazz)
        Get the class-level permission annotation value.
        Parameters:
        clazz - the entity class
        Returns:
        the create and delete permissions for the entity class.
      • getFieldPermissions

        protected String getFieldPermissions​(com.yahoo.elide.core.type.Type<?> clazz,
                                             String fieldName)
        Get the field level permission annotation value.
        Parameters:
        clazz - the entity class
        fieldName - the field
        Returns:
        read and update permissions for a field.
      • getReadPermission

        protected String getReadPermission​(com.yahoo.elide.core.type.Type<?> clazz,
                                           String fieldName)
        Get the calculated ReadPermission value for the field.
        Parameters:
        clazz - the entity class
        fieldName - the field
        Returns:
        the read permissions for a field
      • getUpdatePermission

        protected String getUpdatePermission​(com.yahoo.elide.core.type.Type<?> clazz,
                                             String fieldName)
        Get the calculated UpdatePermission value for the field.
        Parameters:
        clazz - the entity class
        fieldName - the field
        Returns:
        the update permissions for a field
      • getCreatePermission

        protected String getCreatePermission​(com.yahoo.elide.core.type.Type<?> clazz)
        Get the calculated CreatePermission value for the field.
        Parameters:
        clazz - the entity class
        Returns:
        the create permissions for an entity
      • getDeletePermission

        protected String getDeletePermission​(com.yahoo.elide.core.type.Type<?> clazz)
        Get the calculated DeletePermission value for the field.
        Parameters:
        clazz - the entity class
        Returns:
        the delete permissions for an entity