void (boolean showAllStandardOptions, String... allowedOptions) { for (BooleanOptionKey key : myKeys) { String fieldName = key.field.getName(); if (key instanceof CustomBooleanOptionKey) { key.setEnabled(false); } else if (showAllStandardOptions) { key.setEnabled(true); } else { key.setEnabled(false); for (String optionName : allowedOptions) { if (fieldName.equals(optionName)) { key.setEnabled(true); break; } } } } }