Interface ReactiveRestDataResource<Entity,​ID>

  • Type Parameters:
    Entity - Entity type that is handled by this resource.
    ID - ID type of the entity.

    public interface ReactiveRestDataResource<Entity,​ID>
    Base Reactive REST data Panache resource interface. Defines JAX-RS operations that will be implemented by the data store specific extensions such as Hibernate ORM or MongoDB.

    User shouldn't use this interface directly but rather its sub-interfaces defined by the data store specific extensions.

    • Method Summary

      All Methods Instance Methods Default Methods 
      Modifier and Type Method Description
      default io.smallrye.mutiny.Uni<Entity> add​(Entity entity)
      Create a new entity from the provided JSON object.
      default io.smallrye.mutiny.Uni<Long> count()  
      default io.smallrye.mutiny.Uni<Boolean> delete​(ID id)
      Delete an entity.
      default io.smallrye.mutiny.Uni<Entity> get​(ID id)
      Return an entity as a JSON object.
      default io.smallrye.mutiny.Uni<List<Entity>> list​(Page page, Sort sort)
      Return entities as a JSON array.
      default io.smallrye.mutiny.Uni<Entity> update​(ID id, Entity entity)
      Update an existing entity or create a new one from the provided JSON object.
    • Method Detail

      • list

        default io.smallrye.mutiny.Uni<List<Entity>> list​(Page page,
                                                          Sort sort)
        Return entities as a JSON array. The response is paged by default, but that could be disabled with ResourceProperties annotation. Response content type: application/json.
        Parameters:
        page - Panache page instance that should be used in a query. Will be null if pagination is disabled.
        sort - Panache sort instance that should be used in a query.
        Returns:
        A response with an entities JSON array.
      • count

        default io.smallrye.mutiny.Uni<Long> count()
        Returns:
        the total number of entities.
      • get

        default io.smallrye.mutiny.Uni<Entity> get​(ID id)
        Return an entity as a JSON object. Response content type: application/json.
        Parameters:
        id - Entity identifier.
        Returns:
        A response with a JSON object representing an entity.
      • add

        default io.smallrye.mutiny.Uni<Entity> add​(Entity entity)
        Create a new entity from the provided JSON object. Request body type: application/json. Response content type: application/json.
        Parameters:
        entity - Entity to be created
        Returns:
        A response with a JSON object representing an entity and a location header of the new entity.
      • update

        default io.smallrye.mutiny.Uni<Entity> update​(ID id,
                                                      Entity entity)
        Update an existing entity or create a new one from the provided JSON object. Request content type: application/json Response content type: application/json
        Parameters:
        id - Entity identifier.
        entity - Entity to be updated or created.
        Returns:
        A response with no-content status in case of the update. A response with a JSON object representing an entity and a location header in case of the create.
      • delete

        default io.smallrye.mutiny.Uni<Boolean> delete​(ID id)
        Delete an entity.
        Parameters:
        id - Entity identifier.
        Returns:
        A boolean indicated whether the entity was deleted or not.