Created
August 11, 2017 17:05
-
-
Save gregturn/1073134bb9a114e23193dab9c6caa1b6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface Affordance { | |
/** | |
* HTTP method this affordance covers. For multiple methods, add multiple {@link Affordance}s. | |
* | |
* @return | |
*/ | |
String getHttpMethod(); | |
/** | |
* Name for the REST action this {@link Affordance} can take. | |
* | |
* @return | |
*/ | |
String getName(); | |
/** | |
* Are the properties on this {@link Affordance} required or not? Distinguish between PUT (all required) | |
* vs. PATCH (none required). | |
* | |
* @return | |
*/ | |
boolean isRequired(); | |
/** | |
* Collection of the {@link Affordance}'s properties, mapped by {@literal name} and {@link Class}. | |
* For example, a class Employee { String name, String role } would be mapped as: | |
* Map(name -> java.lang.String, role -> java.lang.String) | |
* | |
* @return | |
*/ | |
Map<String, Class<?>> getProperties(); | |
/** | |
* The URI of the {@link Affordance} because certain mediatypes need to list it. Other | |
* mediatypes need to validate that the URI matches the {@literal self} link. | |
* | |
* @return | |
*/ | |
String getUri(); | |
List<AffordanceModel> getAffordanceModel(MediaType mediaType); | |
void addAffordanceModels(MediaType mediaType, List<AffordanceModel> affordanceModels); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment