@Test void testCreateMethod() { Optional<Function<Config, Configurables.WithCreateConfig>> mapper = provider.mapper(Configurables.WithCreateConfig.class); assertThat(mapper, not(Optional.empty())); Function<Config, Configurables.WithCreateConfig> mapperFunction = mapper.get(); Configurables.WithCreateConfig instance = mapperFunction.apply(empty.get("WithCreateConfig")); assertThat(instance, notNullValue()); }
@Override public <T> Optional<Function<Config, T>> mapper(Class<T> type) { return findStaticConfigMethodMapper(type, METHOD_CREATE) .or(() -> findStaticConfigMethodMapper(type, METHOD_FROM)) .or(() -> findConfigConstructorMapper(type)) .or(() -> findStaticConfigMethodMapper(type, METHOD_OF)) .or(() -> findStaticConfigMethodMapper(type, METHOD_VALUE_OF)) .or(() -> findStaticConfigMethodMapper(type, METHOD_FROM_CONFIG)) .or(() -> findStaticStringMethodMapper(type, METHOD_FROM)) .or(() -> findStaticStringMethodMapper(type, METHOD_PARSE)) .or(() -> findParseCharSequenceMethodMapper(type)) .or(() -> findStringConstructorMapper(type)) .or(() -> findStaticStringMethodMapper(type, METHOD_OF)) .or(() -> findStaticStringMethodMapper(type, METHOD_VALUE_OF)) .or(() -> findStaticStringMethodMapper(type, METHOD_FROM_STRING)) .or(() -> findBuilderMethodMapper(type)) .or(() -> findBuilderClassMapper(type)) .or(() -> findStaticMethodWithParamsMapper(type, METHOD_FROM)) .or(() -> findStaticMethodWithParamsMapper(type, METHOD_CREATE)) .or(() -> findConstructorWithParamsMapper(type)) .or(() -> findGenericMapper(type)); }
ObjectConfigMapperProvider implements ConfigMapperProvider { @Override public <T> Optional<Function<Config, T>> mapper(Class<T> type) { return findStaticConfigMethodMapper(type, METHOD_CREATE) .or(() -> findStaticConfigMethodMapper(type, METHOD_FROM)) .or(() -> findConfigConstructorMapper(type)) .or(() -> findStaticConfigMethodMapper(type, METHOD_OF)) .or(() -> findStaticConfigMethodMapper(type, METHOD_VALUE_OF)) .or(() -> findStaticConfigMethodMapper(type, METHOD_FROM_CONFIG)) .or(() -> findStaticStringMethodMapper(type, METHOD_FROM)) .or(() -> findStaticStringMethodMapper(type, METHOD_PARSE)) .or(() -> findParseCharSequenceMethodMapper(type)) .or(() -> findStringConstructorMapper(type)) .or(() -> findStaticStringMethodMapper(type, METHOD_OF)) .or(() -> findStaticStringMethodMapper(type, METHOD_VALUE_OF)) .or(() -> findStaticStringMethodMapper(type, METHOD_FROM_STRING)) .or(() -> findBuilderMethodMapper(type)) .or(() -> findBuilderClassMapper(type)) .or(() -> findStaticMethodWithParamsMapper(type, METHOD_FROM)) .or(() -> findStaticMethodWithParamsMapper(type, METHOD_CREATE)) .or(() -> findConstructorWithParamsMapper(type)) .or(() -> findGenericMapper(type)); } }
ObjectConfigMapperProvider implements ConfigMapperProvider { @Override public <T> Optional<Function<Config, T>> mapper(Class<T> type) { return findStaticConfigMethodMapper(type, METHOD_CREATE) .or(() -> findStaticConfigMethodMapper(type, METHOD_FROM)) .or(() -> findConfigConstructorMapper(type)) .or(() -> findStaticConfigMethodMapper(type, METHOD_OF)) .or(() -> findStaticConfigMethodMapper(type, METHOD_VALUE_OF)) .or(() -> findStaticConfigMethodMapper(type, METHOD_FROM_CONFIG)) .or(() -> findStaticStringMethodMapper(type, METHOD_FROM)) .or(() -> findStaticStringMethodMapper(type, METHOD_PARSE)) .or(() -> findParseCharSequenceMethodMapper(type)) .or(() -> findStringConstructorMapper(type)) .or(() -> findStaticStringMethodMapper(type, METHOD_OF)) .or(() -> findStaticStringMethodMapper(type, METHOD_VALUE_OF)) .or(() -> findStaticStringMethodMapper(type, METHOD_FROM_STRING)) .or(() -> findBuilderMethodMapper(type)) .or(() -> findBuilderClassMapper(type)) .or(() -> findStaticMethodWithParamsMapper(type, METHOD_FROM)) .or(() -> findStaticMethodWithParamsMapper(type, METHOD_CREATE)) .or(() -> findConstructorWithParamsMapper(type)) .or(() -> findGenericMapper(type)); }  }
ObjectConfigMapperProvider implements ConfigMapperProvider { @Override public <T> Optional<Function<Config, T>> mapper(Class<T> type) { return findStaticConfigMethodMapper(type, METHOD_CREATE) .or(() -> findStaticConfigMethodMapper(type, METHOD_FROM)) .or(() -> findConfigConstructorMapper(type)) .or(() -> findStaticConfigMethodMapper(type, METHOD_OF)) .or(() -> findStaticConfigMethodMapper(type, METHOD_VALUE_OF)) .or(() -> findStaticConfigMethodMapper(type, METHOD_FROM_CONFIG)) .or(() -> findStaticStringMethodMapper(type, METHOD_FROM)) .or(() -> findStaticStringMethodMapper(type, METHOD_PARSE)) .or(() -> findParseCharSequenceMethodMapper(type)) .or(() -> findStringConstructorMapper(type)) .or(() -> findStaticStringMethodMapper(type, METHOD_OF)) .or(() -> findStaticStringMethodMapper(type, METHOD_VALUE_OF)) .or(() -> findStaticStringMethodMapper(type, METHOD_FROM_STRING)) .or(() -> findBuilderMethodMapper(type)) .or(() -> findBuilderClassMapper(type)) .or(() -> findStaticMethodWithParamsMapper(type, METHOD_FROM)) .or(() -> findStaticMethodWithParamsMapper(type, METHOD_CREATE)) .or(() -> findConstructorWithParamsMapper(type)) .or(() -> findGenericMapper(type)); }  @Override Map<Class<?>, Function<Config, ?>> mappers(); @Override Optional<Function<Config, T>> mapper(Class<T> type); }
ObjectConfigMapperProvider implements ConfigMapperProvider { @Override public <T> Optional<Function<Config, T>> mapper(Class<T> type) { return findStaticConfigMethodMapper(type, METHOD_CREATE) .or(() -> findStaticConfigMethodMapper(type, METHOD_FROM)) .or(() -> findConfigConstructorMapper(type)) .or(() -> findStaticConfigMethodMapper(type, METHOD_OF)) .or(() -> findStaticConfigMethodMapper(type, METHOD_VALUE_OF)) .or(() -> findStaticConfigMethodMapper(type, METHOD_FROM_CONFIG)) .or(() -> findStaticStringMethodMapper(type, METHOD_FROM)) .or(() -> findStaticStringMethodMapper(type, METHOD_PARSE)) .or(() -> findParseCharSequenceMethodMapper(type)) .or(() -> findStringConstructorMapper(type)) .or(() -> findStaticStringMethodMapper(type, METHOD_OF)) .or(() -> findStaticStringMethodMapper(type, METHOD_VALUE_OF)) .or(() -> findStaticStringMethodMapper(type, METHOD_FROM_STRING)) .or(() -> findBuilderMethodMapper(type)) .or(() -> findBuilderClassMapper(type)) .or(() -> findStaticMethodWithParamsMapper(type, METHOD_FROM)) .or(() -> findStaticMethodWithParamsMapper(type, METHOD_CREATE)) .or(() -> findConstructorWithParamsMapper(type)) .or(() -> findGenericMapper(type)); }  @Override Map<Class<?>, Function<Config, ?>> mappers(); @Override Optional<Function<Config, T>> mapper(Class<T> type);  }