TypedRest for Java
Public Member Functions | List of all members
net.typedrest.GenericCollectionEndpoint< TEntity, TElementEndpoint extends Endpoint > Interface Template Reference

REST endpoint that represents a collection of TEntitys as TElementEndpoints. More...

Inheritance diagram for net.typedrest.GenericCollectionEndpoint< TEntity, TElementEndpoint extends Endpoint >:
net.typedrest.Endpoint

Public Member Functions

Class< TEntity > getEntityType ()
 Returns the type of entity the endpoint represents. More...
 
TElementEndpoint get (String id)
 Returns a ElementEndpoint for a specific child element of this collection. More...
 
TElementEndpoint get (TEntity entity)
 Returns a ElementEndpoint for a specific child element of this collection. More...
 
Optional< Boolean > isReadAllAllowed ()
 Shows whether the server has indicated that readAll() is currently allowed. More...
 
List< TEntity > readAll () throws IOException, IllegalArgumentException, IllegalAccessException, FileNotFoundException, IllegalStateException
 Returns all TEntitys. More...
 
Optional< Boolean > isReadRangeAllowed ()
 Shows whether the server has indicated that readRange(Long,Long) is allowed. More...
 
PartialResponse< TEntity > readRange (Long from, Long to) throws IOException, IllegalArgumentException, IllegalAccessException, FileNotFoundException, IllegalStateException
 Returns all TElementEndpoints within a specific range of the set. More...
 
Optional< Boolean > isCreateAllowed ()
 Shows whether the server has indicated that create(java.lang.Object) is currently allowed. More...
 
TElementEndpoint create (TEntity entity) throws IOException, IllegalArgumentException, IllegalAccessException, FileNotFoundException, IllegalStateException
 Creates a new TEntity. More...
 
Optional< Boolean > isCreateAllAllowed ()
 Shows whether the server has indicated that createAll(java.lang.Iterable) is currently allowed. More...
 
void createAll (Iterable< TEntity > entities) throws IOException, IllegalArgumentException, IllegalAccessException, FileNotFoundException, IllegalStateException
 Creates multiple new TEntitys. More...
 
Optional< Boolean > isSetAllAllowed ()
 Shows whether the server has indicated that setAll(java.util.Collection) is currently allowed. More...
 
void setAll (Collection< TEntity > entities) throws IOException, IllegalArgumentException, IllegalAccessException, FileNotFoundException
 Replaces the entire content of the collection with new TEntitys. More...
 
- Public Member Functions inherited from net.typedrest.Endpoint
URI getUri ()
 The HTTP URI of the remote resource. More...
 
Executor getExecutor ()
 The REST executor used to communicate with the remote resource. More...
 
ObjectMapper getSerializer ()
 Controls the serialization of entities sent to and received from the server. More...
 
Set< URI > getLinks (String rel)
 Retrieves all links with a specific relation type cached from the last request. More...
 
Map< URI, String > getLinksWithTitles (String rel)
 Retrieves all links (with titles) with a specific relation type cached from the last request. More...
 
URI link (String rel)
 Retrieves a single link with a specific relation type. More...
 
UriTemplate linkTemplate (String rel)
 Retrieves a link template with a specific relation type. More...
 
default URI linkTemplate (String rel, String variableName, Object value)
 Retrieves a link template with a specific relation type and resolves it. More...
 

Detailed Description

REST endpoint that represents a collection of TEntitys as TElementEndpoints.

Use the more constrained CollectionEndpoint when possible.

Parameters
<TEntity>The type of entity the endpoint represents.
<TElementEndpoint>The specific type of ElementEndpoint to provide for individual TEntitys.

Member Function Documentation

◆ create()

TElementEndpoint net.typedrest.GenericCollectionEndpoint< TEntity, TElementEndpoint extends Endpoint >.create ( TEntity  entity) throws IOException, IllegalArgumentException, IllegalAccessException, FileNotFoundException, IllegalStateException

Creates a new TEntity.

Parameters
entityThe new TEntity.
Returns
The newly created TEntity; may be null if the server deferred creating the resource.
Exceptions
IOExceptionNetwork communication failed.
IllegalArgumentExceptionHttpStatus#SC_BAD_REQUEST
IllegalAccessExceptionHttpStatus#SC_UNAUTHORIZED or HttpStatus#SC_FORBIDDEN
FileNotFoundExceptionHttpStatus#SC_NOT_FOUND or HttpStatus#SC_GONE
IllegalStateExceptionHttpStatus#SC_CONFLICT
RuntimeExceptionOther non-success status code.

◆ createAll()

void net.typedrest.GenericCollectionEndpoint< TEntity, TElementEndpoint extends Endpoint >.createAll ( Iterable< TEntity >  entities) throws IOException, IllegalArgumentException, IllegalAccessException, FileNotFoundException, IllegalStateException

Creates multiple new TEntitys.

Parameters
entitiesThe new TEntitys.
Exceptions
IOExceptionNetwork communication failed.
IllegalArgumentExceptionHttpStatus#SC_BAD_REQUEST
IllegalAccessExceptionHttpStatus#SC_UNAUTHORIZED or HttpStatus#SC_FORBIDDEN
FileNotFoundExceptionHttpStatus#SC_NOT_FOUND or HttpStatus#SC_GONE
IllegalStateExceptionHttpStatus#SC_CONFLICT
RuntimeExceptionOther non-success status code.

◆ get() [1/2]

TElementEndpoint net.typedrest.GenericCollectionEndpoint< TEntity, TElementEndpoint extends Endpoint >.get ( String  id)

Returns a ElementEndpoint for a specific child element of this collection.

Parameters
idThe ID identifying the entity in the collection.
Returns
An ElementEndpoint for a specific element of this collection.

◆ get() [2/2]

TElementEndpoint net.typedrest.GenericCollectionEndpoint< TEntity, TElementEndpoint extends Endpoint >.get ( TEntity  entity)

Returns a ElementEndpoint for a specific child element of this collection.

Parameters
entityAn existing entity to extract the ID from.
Returns
An ElementEndpoint for a specific element of this collection.

◆ getEntityType()

Class<TEntity> net.typedrest.GenericCollectionEndpoint< TEntity, TElementEndpoint extends Endpoint >.getEntityType ( )

Returns the type of entity the endpoint represents.

Returns
The class type.

◆ isCreateAllAllowed()

Optional<Boolean> net.typedrest.GenericCollectionEndpoint< TEntity, TElementEndpoint extends Endpoint >.isCreateAllAllowed ( )

Shows whether the server has indicated that createAll(java.lang.Iterable) is currently allowed.

Uses cached data from last response.

Returns
An indicator whether the method is allowed. If no request has been sent yet or the server did not specify allowed methods Optional#empty() is returned.

◆ isCreateAllowed()

Optional<Boolean> net.typedrest.GenericCollectionEndpoint< TEntity, TElementEndpoint extends Endpoint >.isCreateAllowed ( )

Shows whether the server has indicated that create(java.lang.Object) is currently allowed.

Uses cached data from last response.

Returns
An indicator whether the method is allowed. If no request has been sent yet or the server did not specify allowed methods Optional#empty() is returned.

◆ isReadAllAllowed()

Optional<Boolean> net.typedrest.GenericCollectionEndpoint< TEntity, TElementEndpoint extends Endpoint >.isReadAllAllowed ( )

Shows whether the server has indicated that readAll() is currently allowed.

Uses cached data from last response.

Returns
An indicator whether the method is allowed. If no request has been sent yet or the server did not specify allowed methods Optional#empty() is returned.

◆ isReadRangeAllowed()

Optional<Boolean> net.typedrest.GenericCollectionEndpoint< TEntity, TElementEndpoint extends Endpoint >.isReadRangeAllowed ( )

Shows whether the server has indicated that readRange(Long,Long) is allowed.

Uses cached data from last response.

Returns
An indicator whether the method is allowed. If no request has been sent yet Optional#empty() is returned.

◆ isSetAllAllowed()

Optional<Boolean> net.typedrest.GenericCollectionEndpoint< TEntity, TElementEndpoint extends Endpoint >.isSetAllAllowed ( )

Shows whether the server has indicated that setAll(java.util.Collection) is currently allowed.

Uses cached data from last response.

Returns
An indicator whether the method is allowed. If no request has been sent yet or the server did not specify allowed methods Optional#empty() is returned.

◆ readAll()

List<TEntity> net.typedrest.GenericCollectionEndpoint< TEntity, TElementEndpoint extends Endpoint >.readAll ( ) throws IOException, IllegalArgumentException, IllegalAccessException, FileNotFoundException, IllegalStateException

Returns all TEntitys.

Returns
All TEntitys.
Exceptions
IOExceptionNetwork communication failed.
IllegalArgumentExceptionHttpStatus#SC_BAD_REQUEST
IllegalAccessExceptionHttpStatus#SC_UNAUTHORIZED or HttpStatus#SC_FORBIDDEN
FileNotFoundExceptionHttpStatus#SC_NOT_FOUND or HttpStatus#SC_GONE
IllegalStateExceptionHttpStatus#SC_CONFLICT
RuntimeExceptionOther non-success status code.

◆ readRange()

PartialResponse<TEntity> net.typedrest.GenericCollectionEndpoint< TEntity, TElementEndpoint extends Endpoint >.readRange ( Long  from,
Long  to 
) throws IOException, IllegalArgumentException, IllegalAccessException, FileNotFoundException, IllegalStateException

Returns all TElementEndpoints within a specific range of the set.

Parameters
fromThe index of the first element to return. null to use to to specify a start point counting from the end of the set.
toThe index of the last element to return. Alternatively the index of the first element to return counting from the end of the set if from is null. null to read to the end.
Returns
A subset of the TElementEndpoints and the range they come from. May not exactly match the request range.
Exceptions
IOExceptionNetwork communication failed.
IllegalArgumentExceptionHttpStatus#SC_BAD_REQUEST
IllegalAccessExceptionHttpStatus#SC_UNAUTHORIZED or HttpStatus#SC_FORBIDDEN
FileNotFoundExceptionHttpStatus#SC_NOT_FOUND or HttpStatus#SC_GONE
IllegalStateExceptionThe requested range is not satisfiable.
RuntimeExceptionOther non-success status code.

◆ setAll()

void net.typedrest.GenericCollectionEndpoint< TEntity, TElementEndpoint extends Endpoint >.setAll ( Collection< TEntity >  entities) throws IOException, IllegalArgumentException, IllegalAccessException, FileNotFoundException

Replaces the entire content of the collection with new TEntitys.

Parameters
entitiesThe new set of TEntitys the collection shall contain.
Exceptions
IOExceptionNetwork communication failed.
IllegalArgumentExceptionHttpStatus#SC_BAD_REQUEST
IllegalAccessExceptionHttpStatus#SC_UNAUTHORIZED or HttpStatus#SC_FORBIDDEN
FileNotFoundExceptionHttpStatus#SC_NOT_FOUND or HttpStatus#SC_GONE
IllegalStateExceptionThe entities have changed since they were last retrieved with readAll(). Your changes were rejected to prevent a lost update.
RuntimeExceptionOther non-success status code.

The documentation for this interface was generated from the following file: