TargetBuilder

public abstract class TargetBuilder<T extends Message, B extends TargetBuilder<T, B>>

An abstract base for builders that create Message instances which have a Target and a FieldMask as attributes.

The Target matching the builder configuration is created with buildTarget, while the FieldMask is composed with composeMask.

The public API of this class is inspired by SQL syntax:


    select(Customer.class) // returning <AbstractTargetBuilder> descendant instance
        .byId(westCoastCustomerIds())
        .withMask("name", "address", "email")
        .where(eq("type", "permanent"),
               eq("discountPercent", 10),
               eq("companySize", Company.Size.SMALL))
        .build();

Calling any of the builder methods overrides the previous call of the given method or any of its overloads. For example, calling sequentially:


    builder.withMask(mask1)
           .withMask(mask2)
           // optionally some other invocations
           .withMask(mask3)
           .build();
is equivalent to calling:

    builder.withMask(mask3)
           .build();
    

Parameters

<T>

a type of the message which is returned by the implementations build

<B>

a type of the builder implementations

Inheritors

Functions

Link copied to clipboard
public abstract T build()
Link copied to clipboard
public B byId(Array<Message> ids)
public B byId(Array<Integer> ids)
public B byId(Array<Long> ids)
public B byId(Array<String> ids)
Sets the ID predicate to the io.spine.client.
public B byId(Iterable<? extends Object> ids)
Sets the ID predicate to the targets of the request.
Link copied to clipboard
public String toString()
Link copied to clipboard
public B where(Array<CompositeFilter> predicate)
public B where(Array<Filter> predicate)
Sets the predicates for the io.spine.client.
Link copied to clipboard
public B withMask(Iterable<String> fieldNames)
public B withMask(Array<String> fieldNames)
Sets the entity fields to retrieve.