Interface ModelContentConverter<T extends ModelContent>


  • public interface ModelContentConverter<T extends ModelContent>
    Model content converter interface
    • Method Detail

      • getHandledModelType

        ModelType getHandledModelType()
        Get handled model type by this converter.
        Returns:
        handled model type
      • convertToModelContent

        Optional<T> convertToModelContent​(byte[] bytes)
        Convert a bytes array to the handled model content entity.
        Parameters:
        bytes - the bytes to convert
        Returns:
        the model content, or Optional.empty()
      • convertToBytes

        byte[] convertToBytes​(T modelContent)
        Convert an instance of the model content to bytes array
        Parameters:
        modelContent - the model content instance to convert
        Returns:
        the bytes array
      • overrideModelId

        default FileContent overrideModelId​(FileContent fileContent,
                                            Map<String,​String> modelIdentifiers)
        Converts the file content to the handled model content entity, sets the given id, and converts back to a FileContent. If the id is already the expected one, it returns it unchanged.
        Parameters:
        fileContent - the FileContent wrapper to convert and fix
        modelIdentifiers - the mapping of the old ids to the new ones
        Returns:
        the fixed FileContent