class ConstantsReader {

  @SuppressWarnings("unchecked")
  public static void loadConstantsFrom(final InputStream source) throws IOException {
    final ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
    final Map<String, Object> values =
        (Map<String, Object>)
            mapper
                .readerFor(
                    mapper.getTypeFactory().constructMapType(Map.class, String.class, Object.class))
                .readValues(source)
                .next();
    values.forEach(ConstantsReader::setField);
  }

}