@Test(expected=IllegalArgumentException.class) public void allDeserializersMustBeAnnotatedWithDeserializes() throws Exception { deserializers.register(NotAnnotatedDeserializer.class); }
public void register(Class<? extends Deserializer> type) { if (!type.isAnnotationPresent(Deserializes.class)) { throw new IllegalArgumentException("You must annotate your deserializers with @Deserializes"); } String[] contentTypes = type.getAnnotation(Deserializes.class).value(); for (String contentType : contentTypes) { deserializers.put(contentType, type); } }
DefaultDeserializers implements Deserializers { public void register(Class<? extends Deserializer> type) { if (!type.isAnnotationPresent(Deserializes.class)) { throw new IllegalArgumentException("You must annotate your deserializers with @Deserializes"); } String[] contentTypes = type.getAnnotation(Deserializes.class).value(); for (String contentType : contentTypes) { deserializers.put(contentType, type); } } }
DefaultDeserializers implements Deserializers { public void register(Class<? extends Deserializer> type) { if (!type.isAnnotationPresent(Deserializes.class)) { throw new IllegalArgumentException("You must annotate your deserializers with @Deserializes"); } String[] contentTypes = type.getAnnotation(Deserializes.class).value(); for (String contentType : contentTypes) { deserializers.put(contentType, type); } } DefaultDeserializers(); }
DefaultDeserializers implements Deserializers { public void register(Class<? extends Deserializer> type) { if (!type.isAnnotationPresent(Deserializes.class)) { throw new IllegalArgumentException("You must annotate your deserializers with @Deserializes"); } String[] contentTypes = type.getAnnotation(Deserializes.class).value(); for (String contentType : contentTypes) { deserializers.put(contentType, type); } } DefaultDeserializers(); Deserializer deserializerFor(String contentType, Container container); void register(Class<? extends Deserializer> type); }
DefaultDeserializers implements Deserializers { public void register(Class<? extends Deserializer> type) { if (!type.isAnnotationPresent(Deserializes.class)) { throw new IllegalArgumentException("You must annotate your deserializers with @Deserializes"); } String[] contentTypes = type.getAnnotation(Deserializes.class).value(); for (String contentType : contentTypes) { deserializers.put(contentType, type); } } DefaultDeserializers(); Deserializer deserializerFor(String contentType, Container container); void register(Class<? extends Deserializer> type);  }