Class Affordance

java.lang.Object
org.springframework.hateoas.Affordance
All Implemented Interfaces:
Iterable<AffordanceModel>

public final class Affordance extends Object implements Iterable<AffordanceModel>
Hold the AffordanceModels for all supported media types.
Author:
Greg Turnquist, Oliver Gierke
  • Constructor Details

    • Affordance

      public Affordance(Map<org.springframework.http.MediaType,AffordanceModel> models)
  • Method Details

    • getAffordanceModel

      public <T extends AffordanceModel> @Nullable T getAffordanceModel(org.springframework.http.MediaType mediaType)
      Look up the AffordanceModel for the requested MediaType.
      Parameters:
      mediaType - must not be null.
      Returns:
      can be null.
    • getRequiredAffordanceModel

      public <T extends AffordanceModel> T getRequiredAffordanceModel(org.springframework.http.MediaType mediaType)
      Look up the AffordanceModel for the requested MediaType.
      Parameters:
      mediaType - must not be null.
      Returns:
      will never be null.
      Since:
      3.0
    • iterator

      public Iterator<AffordanceModel> iterator()
      Specified by:
      iterator in interface Iterable<AffordanceModel>
    • equals

      public boolean equals(@Nullable Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object