Class FieldPolicy

java.lang.Object
com.kazforge.jsonapi.representation.FieldPolicy

public final class FieldPolicy extends Object
Application allow-list over (resourceType, fieldName) pairs for sparse fieldsets.

Policy is consulted only for names in a present fieldset entry. A present empty fieldset list selects no attributes/relationships and does not consult per-field allows; non-field resource members such as mapped resource meta remain independent.

  • Method Details

    • denyAll

      public static FieldPolicy denyAll()
      Rejects every fieldset field name.
    • allowAll

      public static FieldPolicy allowAll()
      Permits every mapped fieldset field name.
    • allowing

      public static FieldPolicy allowing(Set<FieldAllowance> allowances)
      Permits only the given owner-type + field allowances. The allowance set is defensively copied.
    • allows

      public boolean allows(String resourceType, String fieldName)
      Returns whether a present fieldset may include fieldName on a resource whose JSON:API type is resourceType.
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object