@Test public void canCreateCompositeAnnotator() { Annotator annotator1 = mock(Annotator.class); Annotator annotator2 = mock(Annotator.class); CompositeAnnotator composite = factory.getAnnotator(annotator1, annotator2); assertThat(composite.annotators.length, equalTo(2)); assertThat(composite.annotators[0], is(equalTo(annotator1))); assertThat(composite.annotators[1], is(equalTo(annotator2))); }
public Annotator getAnnotator(AnnotationStyle style) { switch (style) { case JACKSON: case JACKSON2: return new Jackson2Annotator(generationConfig); case JACKSON1: return new Jackson1Annotator(generationConfig); case GSON: return new GsonAnnotator(generationConfig); case MOSHI1: return new Moshi1Annotator(generationConfig); case NONE: return new NoopAnnotator(); default: throw new IllegalArgumentException("Unrecognised annotation style: " + style); } }
AnnotatorFactory { public Annotator getAnnotator(AnnotationStyle style) { switch (style) { case JACKSON: case JACKSON2: return new Jackson2Annotator(generationConfig); case JACKSON1: return new Jackson1Annotator(generationConfig); case GSON: return new GsonAnnotator(generationConfig); case MOSHI1: return new Moshi1Annotator(generationConfig); case NONE: return new NoopAnnotator(); default: throw new IllegalArgumentException("Unrecognised annotation style: " + style); } } }
AnnotatorFactory { public Annotator getAnnotator(AnnotationStyle style) { switch (style) { case JACKSON: case JACKSON2: return new Jackson2Annotator(generationConfig); case JACKSON1: return new Jackson1Annotator(generationConfig); case GSON: return new GsonAnnotator(generationConfig); case MOSHI1: return new Moshi1Annotator(generationConfig); case NONE: return new NoopAnnotator(); default: throw new IllegalArgumentException("Unrecognised annotation style: " + style); } } AnnotatorFactory(GenerationConfig generationConfig); }
AnnotatorFactory { public Annotator getAnnotator(AnnotationStyle style) { switch (style) { case JACKSON: case JACKSON2: return new Jackson2Annotator(generationConfig); case JACKSON1: return new Jackson1Annotator(generationConfig); case GSON: return new GsonAnnotator(generationConfig); case MOSHI1: return new Moshi1Annotator(generationConfig); case NONE: return new NoopAnnotator(); default: throw new IllegalArgumentException("Unrecognised annotation style: " + style); } } AnnotatorFactory(GenerationConfig generationConfig); Annotator getAnnotator(AnnotationStyle style); Annotator getAnnotator(Class<? extends Annotator> clazz); CompositeAnnotator getAnnotator( Annotator... annotators ); }
AnnotatorFactory { public Annotator getAnnotator(AnnotationStyle style) { switch (style) { case JACKSON: case JACKSON2: return new Jackson2Annotator(generationConfig); case JACKSON1: return new Jackson1Annotator(generationConfig); case GSON: return new GsonAnnotator(generationConfig); case MOSHI1: return new Moshi1Annotator(generationConfig); case NONE: return new NoopAnnotator(); default: throw new IllegalArgumentException("Unrecognised annotation style: " + style); } } AnnotatorFactory(GenerationConfig generationConfig); Annotator getAnnotator(AnnotationStyle style); Annotator getAnnotator(Class<? extends Annotator> clazz); CompositeAnnotator getAnnotator( Annotator... annotators );  }