@Test public void getSerializer_emptyFactories_identitySerializerReturned() throws Exception { SerializerFactoryImpl factory = new SerializerFactoryImpl(ImmutableList.of(), mockProcessingEnvironment); Serializer actualSerializer = factory.getSerializer(typeMirrorOf(String.class)); assertThat(actualSerializer.getClass().getName()) .contains("IdentitySerializerFactory$IdentitySerializer"); }
@Override public Serializer getSerializer(TypeMirror typeMirror) { for (SerializerExtension extension : extensions) { Optional<Serializer> serializer = extension.getSerializer(typeMirror, this, env); if (serializer.isPresent()) { return serializer.get(); } } return IdentitySerializerFactory.getSerializer(typeMirror); }
SerializerFactoryImpl implements SerializerFactory { @Override public Serializer getSerializer(TypeMirror typeMirror) { for (SerializerExtension extension : extensions) { Optional<Serializer> serializer = extension.getSerializer(typeMirror, this, env); if (serializer.isPresent()) { return serializer.get(); } } return IdentitySerializerFactory.getSerializer(typeMirror); } }
SerializerFactoryImpl implements SerializerFactory { @Override public Serializer getSerializer(TypeMirror typeMirror) { for (SerializerExtension extension : extensions) { Optional<Serializer> serializer = extension.getSerializer(typeMirror, this, env); if (serializer.isPresent()) { return serializer.get(); } } return IdentitySerializerFactory.getSerializer(typeMirror); } SerializerFactoryImpl(
      ImmutableList<SerializerExtension> extensions, ProcessingEnvironment env); }
SerializerFactoryImpl implements SerializerFactory { @Override public Serializer getSerializer(TypeMirror typeMirror) { for (SerializerExtension extension : extensions) { Optional<Serializer> serializer = extension.getSerializer(typeMirror, this, env); if (serializer.isPresent()) { return serializer.get(); } } return IdentitySerializerFactory.getSerializer(typeMirror); } SerializerFactoryImpl(
      ImmutableList<SerializerExtension> extensions, ProcessingEnvironment env); @Override Serializer getSerializer(TypeMirror typeMirror); }
SerializerFactoryImpl implements SerializerFactory { @Override public Serializer getSerializer(TypeMirror typeMirror) { for (SerializerExtension extension : extensions) { Optional<Serializer> serializer = extension.getSerializer(typeMirror, this, env); if (serializer.isPresent()) { return serializer.get(); } } return IdentitySerializerFactory.getSerializer(typeMirror); } SerializerFactoryImpl(
      ImmutableList<SerializerExtension> extensions, ProcessingEnvironment env); @Override Serializer getSerializer(TypeMirror typeMirror);  }