TypedRest for Java
|
REST endpoint that represents a single entity. More...
Public Member Functions | |
Class< TEntity > | getEntityType () |
Returns the type of entity the endpoint represents. More... | |
TEntity | read () throws IOException, IllegalArgumentException, IllegalAccessException, FileNotFoundException, IllegalStateException |
Returns the specific TEntity . More... | |
boolean | exists () throws IOException, IllegalAccessException |
Determines whether the entity currently exists. More... | |
Optional< Boolean > | isSetAllowed () |
Shows whether the server has indicated that set(java.lang.Object) is currently allowed. More... | |
TEntity | set (TEntity entity) throws IOException, IllegalArgumentException, IllegalAccessException, FileNotFoundException, IllegalStateException |
Sets/replaces the TEntity . More... | |
default TEntity | update (TEntity entity) throws IOException, IllegalArgumentException, IllegalAccessException, FileNotFoundException, IllegalStateException |
Sets/replaces the TEntity . More... | |
default TEntity | update (Consumer< TEntity > updateAction) throws IOException, IllegalArgumentException, IllegalAccessException, FileNotFoundException, IllegalStateException |
Reads the current state of the entity, applies a change to it and stores the result. More... | |
default TEntity | update (Consumer< TEntity > updateAction, int maxRetries) throws IOException, IllegalArgumentException, IllegalAccessException, FileNotFoundException, IllegalStateException |
Reads the current state of the entity, applies a change to it and stores the result. More... | |
Optional< Boolean > | isMergeAllowed () |
Shows whether the server has indicated that merge(java.lang.Object) is currently allowed. More... | |
TEntity | merge (TEntity entity) throws IOException, IllegalArgumentException, IllegalAccessException, FileNotFoundException, IllegalStateException |
Modifies an existing TEntity by merging changes. More... | |
Optional< Boolean > | isDeleteAllowed () |
Shows whether the server has indicated that delete() is currently allowed. More... | |
void | delete () throws IOException, IllegalArgumentException, IllegalAccessException, FileNotFoundException, IllegalStateException |
Deletes the TEntity . More... | |
![]() | |
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... | |
REST endpoint that represents a single entity.
<TEntity> | The type of entity the endpoint represents. |
void net.typedrest.ElementEndpoint< TEntity >.delete | ( | ) | throws IOException, IllegalArgumentException, IllegalAccessException, FileNotFoundException, IllegalStateException |
Deletes the TEntity
.
IOException | Network communication failed. |
IllegalArgumentException | HttpStatus#SC_BAD_REQUEST |
IllegalAccessException | HttpStatus#SC_UNAUTHORIZED or HttpStatus#SC_FORBIDDEN |
FileNotFoundException | HttpStatus#SC_NOT_FOUND or HttpStatus#SC_GONE |
IllegalStateException | The entity has changed since it was last retrieved with read(). Your delete call was rejected to prevent a lost update. |
RuntimeException | Other non-success status code. |
Implemented in net.typedrest.ElementEndpointImpl< TEntity >.
boolean net.typedrest.ElementEndpoint< TEntity >.exists | ( | ) | throws IOException, IllegalAccessException |
Determines whether the entity currently exists.
true
if the entity currently exists, false
if it does not.IOException | Network communication failed. |
IllegalAccessException | HttpStatus#SC_UNAUTHORIZED or HttpStatus#SC_FORBIDDEN |
RuntimeException | Other non-success status code. |
Implemented in net.typedrest.ElementEndpointImpl< TEntity >.
Class<TEntity> net.typedrest.ElementEndpoint< TEntity >.getEntityType | ( | ) |
Returns the type of entity the endpoint represents.
Optional<Boolean> net.typedrest.ElementEndpoint< TEntity >.isDeleteAllowed | ( | ) |
Shows whether the server has indicated that delete() is currently allowed.
Uses cached data from last response.
Implemented in net.typedrest.ElementEndpointImpl< TEntity >.
Optional<Boolean> net.typedrest.ElementEndpoint< TEntity >.isMergeAllowed | ( | ) |
Shows whether the server has indicated that merge(java.lang.Object) is currently allowed.
Uses cached data from last response.
Implemented in net.typedrest.ElementEndpointImpl< TEntity >.
Optional<Boolean> net.typedrest.ElementEndpoint< TEntity >.isSetAllowed | ( | ) |
Shows whether the server has indicated that set(java.lang.Object) is currently allowed.
Uses cached data from last response.
Implemented in net.typedrest.ElementEndpointImpl< TEntity >.
TEntity net.typedrest.ElementEndpoint< TEntity >.merge | ( | TEntity | entity | ) | throws IOException, IllegalArgumentException, IllegalAccessException, FileNotFoundException, IllegalStateException |
Modifies an existing TEntity
by merging changes.
entity | The TEntity data to merge with the existing one. |
TEntity
as returned by the server, possibly with additional fields set. null
if the server does not respond with a result entity. IOException | Network communication failed. |
IllegalArgumentException | HttpStatus#SC_BAD_REQUEST |
IllegalAccessException | HttpStatus#SC_UNAUTHORIZED or HttpStatus#SC_FORBIDDEN |
FileNotFoundException | HttpStatus#SC_NOT_FOUND or HttpStatus#SC_GONE |
IllegalStateException | The entity has changed since it was last retrieved with read(). Your changes were rejected to prevent a lost update. |
RuntimeException | Other non-success status code. |
Implemented in net.typedrest.ElementEndpointImpl< TEntity >.
TEntity net.typedrest.ElementEndpoint< TEntity >.read | ( | ) | throws IOException, IllegalArgumentException, IllegalAccessException, FileNotFoundException, IllegalStateException |
Returns the specific TEntity
.
TEntity
.IOException | Network communication failed. |
IllegalArgumentException | HttpStatus#SC_BAD_REQUEST |
IllegalAccessException | HttpStatus#SC_UNAUTHORIZED or HttpStatus#SC_FORBIDDEN |
FileNotFoundException | HttpStatus#SC_NOT_FOUND or HttpStatus#SC_GONE |
IllegalStateException | HttpStatus#SC_CONFLICT |
RuntimeException | Other non-success status code. |
Implemented in net.typedrest.ElementEndpointImpl< TEntity >.
TEntity net.typedrest.ElementEndpoint< TEntity >.set | ( | TEntity | entity | ) | throws IOException, IllegalArgumentException, IllegalAccessException, FileNotFoundException, IllegalStateException |
Sets/replaces the TEntity
.
entity | The new TEntity . |
TEntity
as returned by the server, possibly with additional fields set. null
if the server does not respond with a result entity. IOException | Network communication failed. |
IllegalArgumentException | HttpStatus#SC_BAD_REQUEST |
IllegalAccessException | HttpStatus#SC_UNAUTHORIZED or HttpStatus#SC_FORBIDDEN |
FileNotFoundException | HttpStatus#SC_NOT_FOUND or HttpStatus#SC_GONE |
IllegalStateException | The entity has changed since it was last retrieved with read(). Your changes were rejected to prevent a lost update. |
RuntimeException | Other non-success status code. |
Implemented in net.typedrest.ElementEndpointImpl< TEntity >.
default TEntity net.typedrest.ElementEndpoint< TEntity >.update | ( | TEntity | entity | ) | throws IOException, IllegalArgumentException, IllegalAccessException, FileNotFoundException, IllegalStateException |
Sets/replaces the TEntity
.
entity | The new TEntity . |
TEntity
as returned by the server, possibly with additional fields set. null
if the server does not respond with a result entity. IOException | Network communication failed. |
IllegalArgumentException | HttpStatus#SC_BAD_REQUEST |
IllegalAccessException | HttpStatus#SC_UNAUTHORIZED or HttpStatus#SC_FORBIDDEN |
FileNotFoundException | HttpStatus#SC_NOT_FOUND or HttpStatus#SC_GONE |
IllegalStateException | The entity has changed since it was last retrieved with read(). Your changes were rejected to prevent a lost update. |
RuntimeException | Other non-success status code. |
default TEntity net.typedrest.ElementEndpoint< TEntity >.update | ( | Consumer< TEntity > | updateAction | ) | throws IOException, IllegalArgumentException, IllegalAccessException, FileNotFoundException, IllegalStateException |
Reads the current state of the entity, applies a change to it and stores the result.
Applies optimistic concurrency using automatic retries.
updateAction | A callback that takes the current state of the entity and applies the desired modifications. |
TEntity
as returned by the server, possibly with additional fields set. null
if the server does not respond with a result entity. IOException | |
IllegalArgumentException | |
IllegalAccessException | |
FileNotFoundException | |
IllegalStateException |
default TEntity net.typedrest.ElementEndpoint< TEntity >.update | ( | Consumer< TEntity > | updateAction, |
int | maxRetries | ||
) | throws IOException, IllegalArgumentException, IllegalAccessException, FileNotFoundException, IllegalStateException |
Reads the current state of the entity, applies a change to it and stores the result.
Applies optimistic concurrency using automatic retries.
updateAction | A callback that takes the current state of the entity and applies the desired modifications. |
maxRetries | The maximum number of retries to perform for optimistic concurrency before giving up. |
TEntity
as returned by the server, possibly with additional fields set. null
if the server does not respond with a result entity. IOException | Network communication failed. |
IllegalArgumentException | HttpStatus#SC_BAD_REQUEST |
IllegalAccessException | HttpStatus#SC_UNAUTHORIZED or HttpStatus#SC_FORBIDDEN |
FileNotFoundException | HttpStatus#SC_NOT_FOUND or HttpStatus#SC_GONE |
IllegalStateException | The entity has changed since it was last retrieved with read(). Your changes were rejected to prevent a lost update. |
RuntimeException | Other non-success status code. |