leakingtapan/rof

Update documentation

Opened this issue · 1 comments

Update README to reflect latest artifact version, fix any typos, and perhaps elaborate on the customization section with a more relatable example of where one might need to do this (i.e. java.time.Instant)

Also the examples should clarify that Config is stateless, i.e.

// works
final Config config = Config.createDefault()
    .withSupplier(FooClass.class, new FooSupplier());
final ObjectFactory factory = new ReflectionObjectFactory(config);

// works
Config config = Config.createDefault();
config = config.withSupplier(FooClass.class, new FooSupplier());
final ObjectFactory factory = new ReflectionObjectFactory(config);

// doesn't work
final Config config = Config.createDefault();
config.withSupplier(FooClass.class, new FooSupplier());
final ObjectFactory factory = new ReflectionObjectFactory(config);

I believe it's a common pattern to think of config objects as builders, and ideally people don't have to step into the code to find out that it isn't. I think the key change would be to include an example like the second one above, in addition the the first which is already present.

Could also add a ConfigBuilder that just wraps it with state so that people can use it however they want, but that's a different discussion.