GenericCollectionEndpointImpl

open class GenericCollectionEndpointImpl<TEntity, TElementEndpoint : ElementEndpoint<TEntity>>(referrer: Endpoint, relativeUri: URI, entityType: Class<TEntity>, elementEndpointFactory: (referrer: Endpoint, relativeUri: URI) -> TElementEndpoint) : AbstractCachingEndpoint, GenericCollectionEndpoint<TEntity, TElementEndpoint>

Endpoint for a collection of TEntitys addressable as TElementEndpoints.

Use the more constrained CollectionEndpointImpl when possible.

Parameters

referrer

The endpoint used to navigate to this one.

relativeUri

The URI of this endpoint relative to the referrer's.

entityType

The type of individual elements in the collection.

elementEndpointFactory

The factory for constructing TElementEndpoints to provide for individual elements.

TEntity

The type of individual elements in the collection.

TElementEndpoint

The type of ElementEndpoint to provide for individual TEntitys.

Inheritors

Constructors

Link copied to clipboard
constructor(referrer: Endpoint, relativeUri: URI, entityType: Class<TEntity>, elementEndpointFactory: (referrer: Endpoint, relativeUri: URI) -> TElementEndpoint)
constructor(referrer: Endpoint, relativeUri: String, entityType: Class<TEntity>, elementEndpointFactory: (referrer: Endpoint, relativeUri: URI) -> TElementEndpoint)

Creates a new element collection endpoint.

Properties

Link copied to clipboard
open override val createAllAllowed: Boolean?

Shows whether the server has indicated that createAll is currently allowed.

Link copied to clipboard
open override val createAllowed: Boolean?

Shows whether the server has indicated that create is currently allowed.

Link copied to clipboard
open override val errorHandler: ErrorHandler
Link copied to clipboard
open override val httpClient: OkHttpClient
Link copied to clipboard
open override val linkExtractor: LinkExtractor
Link copied to clipboard
Link copied to clipboard
open override val readAllAllowed: Boolean?

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

Link copied to clipboard
open override var readRangeAllowed: Boolean?

Shows whether the server has indicated that readRange is allowed.

Link copied to clipboard
open override var responseCache: ResponseCache?

A cached copy of the last response.

Link copied to clipboard
open override val serializers: List<Serializer>
Link copied to clipboard
open override val setAllAllowed: Boolean?

Shows whether the server has indicated that setAll is currently allowed.

Link copied to clipboard
open override val uri: URI

Functions

Link copied to clipboard
open override fun create(entity: TEntity): TElementEndpoint?

Adds an entity as a new element to the collection.

Link copied to clipboard
open override fun createAll(entities: Iterable<TEntity>)

Adds (or updates) multiple entities as elements in the collection.

Link copied to clipboard
fun <T> deserialize(body: ResponseBody, type: Class<T>): T?

Deserializes an entity using the first serializer that supports the body's content type.

Link copied to clipboard
fun <T> deserializeList(body: ResponseBody, type: Class<T>): List<T>?

Deserializes a list of entities using the first serializer that supports the body's content type.

Link copied to clipboard
open operator override fun get(entity: TEntity): TElementEndpoint

Returns an ElementEndpoint for a specific child element.

operator fun get(id: String): TElementEndpoint
Link copied to clipboard
open override fun getLinks(rel: String): List<Pair<URI, String?>>

Resolves all links with a specific relation type. Uses cached data from last response.

Link copied to clipboard
fun getLinkTemplate(rel: String): UriTemplate

Retrieves a link template with a specific relation type.

Link copied to clipboard
open override fun link(rel: String): URI

Resolves a single link with a specific relation type. Uses cached data from last response if possible.

Link copied to clipboard
open override fun linkTemplate(rel: String, variables: Map<String, Any>): URI

Resolves a link template with a specific relation type. Uses cached data from last response if possible.

Link copied to clipboard
open override fun readAll(): List<TEntity>

Returns all entities in the collection.

Link copied to clipboard
open override fun readRange(from: Long?, to: Long?): PartialResponse<TEntity>

Returns all entities within a specific range of the collection.

Link copied to clipboard
fun <T> serialize(entity: T, type: Class<T>): RequestBody

Serializes an entity using the first serializer.

Link copied to clipboard
fun <T> serializeList(entities: Iterable<T>, type: Class<T>): RequestBody

Serializes a list of entities using the first serializer.

Link copied to clipboard
open override fun setAll(entities: Iterable<TEntity>)

Replaces the entire content of the collection with new entities.

Link copied to clipboard
fun setDefaultLink(rel: String, href: String?)

Registers one or more default links for a specific relation type.

Link copied to clipboard

Registers a default link template for a specific relation type.