* @param optionType the option type of interest
* @return the container which effectively contributes the given option's value; May be an empty container in case
* no value at all is configured for the given option, but never {@code null}
*/
private <I, V, O extends Option<I, V>> OptionsContainer getMostSpecificContainer(Class<O> optionType) {
OptionsContainer container;
if ( propertyName != null ) {
for ( Class<?> clazz : hierarchy ) {
for ( OptionValueSource source : sources ) {
container = source.getPropertyOptions( clazz, propertyName );
if ( !container.getAll( optionType ).isEmpty() ) {
return container;
}
}
}
}
if ( entityType != null ) {
for ( Class<?> clazz : hierarchy ) {
for ( OptionValueSource source : sources ) {
container = source.getEntityOptions( clazz );
if ( !container.getAll( optionType ).isEmpty() ) {
return container;
}
}
}
}
for ( OptionValueSource source : sources ) {
container = source.getGlobalOptions();
if ( !container.getAll( optionType ).isEmpty() ) {
return container;
}
}
return OptionsContainer.EMPTY;