spring-hateoas-ext/src/main/java/de/escalon/hypermedia/spring/AffordanceBuilder.java
public AffordanceBuilder rel(TypedResource subject, String rel) {
        this.collectionHolder = subject;
        this.rels.add(rel);
        return this;
    }
public AffordanceBuilder rel(TypedResource subject, String rel) {
        this.collectionHolder = subject;
        this.rels.add(rel);
        return this;
    }
public AffordanceBuilder rel ( TypedResource subject , String rel ) { this . collectionHolder = subject ; this . rels . add ( rel ) ; return this ; }
Allows to define one or more link relations for affordances that point to collections in cases where the
resource
that has the affordance is not the subject in a subject-predicate-object statement about each collection item.
E.g. a product might have a loose relationship to ordered items where it can be POSTed, but the ordered items do
not belong to the product, but to an order. You can express that by saying:
<pre>
TypedResource order = new TypedResource("http://schema.org/Order"); // holds the ordered items
Resource&lt;Product&gt; product = new Resource&lt;&gt;(); // has a loose relationship to ordered items
product.add(linkTo(methodOn(OrderController.class).postOrderedItem()
.rel(order, "orderedItem")); // order has ordered items, not product has ordered items
</pre>
If the order doesn't exist yet, it cannot be identified. In that case you may pass null to express that

@param rel
to be used as link relation
@param subject
describing the subject
@return builder
Allows to define one or more link relations for affordances that point to collections in cases where the resource that has the affordance is not the subject in a subject - predicate - object statement about each collection item . E . g . a product might have a loose relationship to ordered items where it can be POSTed but the ordered items do not belong to the product but to an order . You can express that by saying : <pre > TypedResource order = new TypedResource ( http : // schema . org / Order ) ; // holds the ordered items Resource&lt ; Product&gt ; product = new Resource&lt ; &gt ; () ; // has a loose relationship to ordered items product . add ( linkTo ( methodOn ( OrderController . class ) . postOrderedItem () . rel ( order orderedItem )) ; // order has ordered items not product has ordered items < / pre > If the order doesn t exist yet it cannot be identified . In that case you may pass null to express that