package net.eusashead.hateoas.response;
import java.util.Date;
import net.eusashead.hateoas.header.ETagHeaderStrategy;
/*
* #[license]
* spring-responseentitybuilder
* %%
* Copyright (C) 2013 Eusa's Head
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* %[license]
*/
/**
* Create an appropriate response
* to a PUT request.
* @return The returned entity
* should have a status code of
* 204 (no content) and a null
* body.
*
* @author patrickvk
*
*/
public interface PutResponseBuilder<T> extends ResponseBuilder<Void> {
/**
* Set the wrapped entity
* that this response represents
* @param entity
*/
PutResponseBuilder<T> entity(T entity);
/**
* Create ETag header based
* on the best available
* {@link ETagStrategy}
* @return
*/
PutResponseBuilder<T> etag();
/**
* Create ETag header based
* on the supplied
* {@link ETagStrategy}
* @return
*/
PutResponseBuilder<T> etag(ETagHeaderStrategy strategy);
/**
* Create a weak ETag based
* on the supplied date
* @param date
* @return
*/
PutResponseBuilder<T> etag(Date date);
/**
* Create a strong ETag based
* on the supplied version
* number
* @param version
* @return
*/
PutResponseBuilder<T> etag(Integer version);
/**
* Set the Last-Modified header
* based on the supplied date
* @param date
* @return
*/
PutResponseBuilder<T> lastModified(Date date);
/**
* Return a 201 Created response
* instead of a 204 No Content
* for the case where the entity
* was created using a PUT
*/
PutResponseBuilder<T> isCreate();
}