/** * @author nshankar */ @RestLiAssociation(name = "typerefCustomDoubleAssociationKeyResource", namespace = "com.linkedin.restli.examples.greetings.client", assocKeys = {@Key(name = "src", type = CustomDouble.class, typeref = CustomDoubleRef.class), @Key(name = "dest", type = URI.class, typeref = UriRef.class)}) public class TyperefCustomDoubleAssociationKeyResource extends AssociationResourceTemplate<Message> { @RestMethod.Get public Message get(final CompoundKey key, @QueryParam(value = "array", typeref = CustomStringRef.class) final CustomString[] stringArray) { return new Message().setId(((CustomDouble) key.getPart("src")).toDouble() + "->" + ((URI) key.getPart( "dest")).getHost()) .setMessage(String.format("I need some $20. Array contents %s.", Arrays.asList(stringArray))) .setTone(Tone.SINCERE); } }
/** * @param associationAnno {@link RestLiAssociation} annotation */ public RestLiAnnotationData(RestLiAssociation associationAnno) { _parent = associationAnno.parent(); _name = associationAnno.name(); _namespace = associationAnno.namespace(); _keys = associationAnno.assocKeys(); _keyName = RestAnnotations.DEFAULT.equals(associationAnno.keyName()) ? null : associationAnno.keyName(); _typerefInfoClass = null; }
private static Class<?> getParentResourceClass(Class<?> resourceClass) { for (Annotation a : resourceClass.getAnnotations()) { if (a instanceof RestLiAssociation) { return ((RestLiAssociation)a).parent(); } else if (a instanceof RestLiCollection) { return ((RestLiCollection)a).parent(); } else if (a instanceof RestLiSimpleResource) { return ((RestLiSimpleResource)a).parent(); } } return RestAnnotations.ROOT.class; }
/** * @author nshankar */ @RestLiAssociation(name = "typerefPrimitiveLongAssociationKeyResource", namespace = "com.linkedin.restli.examples.greetings.client", assocKeys = {@Key(name = "src", type = Long.class, typeref = LongRef.class), @Key(name = "dest", type = Long.class, typeref = LongRef.class)}) public class TyperefPrimitiveLongAssociationKeyResource extends AssociationResourceTemplate<Message> { @Override public Message get(final CompoundKey key) { return new Message().setId(key.getPartAsLong("src") + "->" + key.getPartAsLong("dest")) .setMessage("I need some $20") .setTone(Tone.SINCERE); } }
@RestLiAssociation( name = "greetingAssociationUnstructuredData", namespace = "com.linkedin.restli.examples.greetings.client",
@RestLiAssociation( name = "greetingAssociationUnstructuredDataAsync", namespace = "com.linkedin.restli.examples.greetings.client",
@RestLiAssociation( name = "customTypes3", namespace = "com.linkedin.restli.examples.greetings.client",
@RestLiAssociation( name = "chainedTyperefs", namespace = "com.linkedin.restli.examples.greetings.client",
@RestLiAssociation( name = "reactiveGreetingAssociationUnstructuredData", namespace = "com.linkedin.restli.examples.greetings.client",
@RestLiAssociation(name="associations", namespace = "com.linkedin.restli.examples.greetings.client", assocKeys={@Key(name="src", type=String.class),
@RestLiAssociation(name="groupMemberships", namespace = "com.linkedin.restli.examples.groups.client", assocKeys={@Key(name="groupID", type=int.class),