All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.iangabrielsanchez.springboot.commons.CommonController Maven / Gradle / Ivy

package io.github.iangabrielsanchez.springboot.commons;

import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

public interface CommonController {


    default ResponseEntity> handle( List list, HttpStatus status ) {
        return new ResponseEntity<>( list, status );
    }

    default ResponseEntity handle( ItemType body, HttpStatus status ) {
        return new ResponseEntity<>( body, status );
    }

    default ResponseEntity handle( String message, HttpStatus status ) {
        return new ResponseEntity<>( message, status );
    }

    ResponseEntity> getAll();

    ResponseEntity getOne( @PathVariable( "id" ) Long id );

    ResponseEntity add( @RequestBody ItemType item );

    ResponseEntity update( @PathVariable( "id" ) Long id, @RequestBody ItemType item );

    ResponseEntity delete( @PathVariable( "id" ) Long id );
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy