POJOs

The following methods are provided for accessing POJO values:

- {@link oaj.config.Config}
  - {@link oaj.config.Config#getObject(String,Class) getObject(String,Class)}
  - {@link oaj.config.Config#getObjectWithDefault(String,Object,Class) getObjectWithDefault(String,T,Class)}

In theory, any {@doc PojoCategories parsable} POJO type can be represented as a config value.
However in practice, we're typically talking about the following:

- Objects convertible from Strings.
- Beans.

An example of an object convertible from a String was already shown in an example above.
In that case, it was a URL which has a public constructor that takes in a String:

# A POJO key4 = http://bar

// Read values from section #1 URL key4 = c.getObject("Section1/key4", URL.class);

Beans are represented as {@doc juneau-marshall.JsonDetails.SimplifiedJson Simplified JSON} by default:

// Contact information [ContactInfo] address = { street: '123 Main Street', city: 'Anywhere', state: 'NY', zip: 12345 }

// Example bean public class Address { public String street, city; public StateEnum state; public int zip; } // Example usage Config c = Config.create("MyConfig.cfg").build(); Address myAddress = c.getObject("ContactInfo/address", Address.class);

The format for beans depends on the serializer and parser registered on the Config which is defined in the builder via the following methods:

- {@link oaj.config.ConfigBuilder}
  - {@link oaj.config.ConfigBuilder#serializer(Class) serializer(Class)}
  - {@link oaj.config.ConfigBuilder#serializer(WriterSerializer) serializer(WriterSerializer)}
  - {@link oaj.config.ConfigBuilder#parser(Class) parser(Class)}
  - {@link oaj.config.ConfigBuilder#parser(ReaderParser) parser(ReaderParser)}

The default parser can also be overridden on the following getters:

- {@link oaj.config.Config}
  - {@link oaj.config.Config#getObject(String,Parser,Class) getObject(String,Parser,Class)}
  - {@link oaj.config.Config#getObjectWithDefault(String,Parser,Object,Class) getObjectWithDefault(String,T,Parser,Class)}