Java Code Examples for java.util.Set#isEmpty()

The following examples show how to use java.util.Set#isEmpty() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ShowHistoryAction.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
protected boolean enable(Node[] activatedNodes) {     
    if(activatedNodes == null || activatedNodes.length != 1) {
        return false;
    }
    VCSContext ctx = VCSContext.forNodes(activatedNodes);
    Set<VCSFileProxy> rootSet = ctx.getRootFiles();                
    if(rootSet == null || rootSet.isEmpty()) { 
        return false;
    }                        
    for (VCSFileProxy p : rootSet) {            
        if(p != null && !p.isFile()) {
            return false;
        }
    }        
    return true;           
}
 
Example 2
Source File: CallAnalysis.java    From clava with Apache License 2.0 6 votes vote down vote up
public static boolean canBeInlined(CompoundStmt compoundStmt) {
    Set<Class<? extends ClavaNode>> nodesInBody = compoundStmt.getDescendants().stream()
            .map(node -> node.getClass())
            .collect(Collectors.toSet());

    // Check if all nodes are allowed
    Set<String> unsupportedNodes = nodesInBody.stream()
            .filter(node -> !ALLOWED_NODES.contains(node))
            .map(node -> node.getSimpleName())
            .collect(Collectors.toSet());

    if (!unsupportedNodes.isEmpty()) {
        SpecsLogs.msgInfo("Cannot inline function which contains the following nodes: " + unsupportedNodes);
        return false;
    }

    return true;
}
 
Example 3
Source File: ClassAnalyzer.java    From glowroot with Apache License 2.0 6 votes vote down vote up
private void removeAdviceAlreadyWovenIntoSuperClass(
        Map<AnalyzedMethodKey, Set<Advice>> matchingAdvisorSets) {
    for (AnalyzedClass superAnalyzedClass : superAnalyzedClasses) {
        for (AnalyzedMethod superAnalyzedMethod : superAnalyzedClass.analyzedMethods()) {
            if (Modifier.isAbstract(superAnalyzedMethod.modifiers())) {
                continue;
            }
            AnalyzedMethodKey key = AnalyzedMethodKey.wrap(superAnalyzedMethod);
            Set<Advice> matchingAdvisorSet = matchingAdvisorSets.get(key);
            if (matchingAdvisorSet == null) {
                continue;
            }
            matchingAdvisorSet.removeAll(superAnalyzedMethod.advisors());
            if (matchingAdvisorSet.isEmpty()) {
                matchingAdvisorSets.remove(key);
            }
        }
    }
}
 
Example 4
Source File: ClusterSearcher.java    From vespa with Apache License 2.0 6 votes vote down vote up
private List<Query> createQueries(Query query, Set<String> docTypes) {
    query.getModel().getQueryTree(); // performance: parse query before cloning such that it is only done once
    List<Query> retval = new ArrayList<>(docTypes.size());
    if (docTypes.size() == 1) {
        query.getModel().setRestrict(docTypes.iterator().next());
        retval.add(query);
    } else if ( ! docTypes.isEmpty() ) {
        for (String docType : docTypes) {
            Query q = query.clone();
            q.setOffset(0);
            q.setHits(query.getOffset() + query.getHits());
            q.getModel().setRestrict(docType);
            retval.add(q);
        }
    }
    return retval;
}
 
Example 5
Source File: PartitionRegionHelper.java    From gemfirexd-oss with Apache License 2.0 6 votes vote down vote up
private static void fillInPartitionedRegionInfo(GemFireCacheImpl cache, final Set prDetailsSet, 
                                            final boolean internal) {
  // TODO: optimize by fetching all PR details from each member at once
  Set<PartitionedRegion> prSet = cache.getPartitionedRegions();
  if (prSet.isEmpty()) {
    return;
  }
  for (Iterator<PartitionedRegion> iter = prSet.iterator(); iter.hasNext();) {
    PartitionedRegion pr = iter.next();
    PartitionRegionInfo prDetails = pr.getRedundancyProvider().
        buildPartitionedRegionInfo(internal, cache.getResourceManager().getLoadProbe());
    if (prDetails != null) {
      prDetailsSet.add(prDetails);
    }
  }
}
 
Example 6
Source File: StandardExtensionDiscoveringManager.java    From nifi with Apache License 2.0 6 votes vote down vote up
private static boolean checkControllerServiceEligibility(Class extensionType) {
    final Class originalExtensionType = extensionType;
    final ClassLoader originalExtensionClassLoader = extensionType.getClassLoader();

    // if the extension does not require instance classloading, its eligible
    final boolean requiresInstanceClassLoading = extensionType.isAnnotationPresent(RequiresInstanceClassLoading.class);

    final Set<Class> cobundledApis = new HashSet<>();
    while (extensionType != null) {
        for (final Class i : extensionType.getInterfaces()) {
            if (originalExtensionClassLoader.equals(i.getClassLoader())) {
                cobundledApis.add(i);
            }
        }

        extensionType = extensionType.getSuperclass();
    }

    if (!cobundledApis.isEmpty()) {
        logger.warn(String.format("Controller Service %s is bundled with its supporting APIs %s. The service APIs should not be bundled with the implementations.",
                originalExtensionType.getName(), StringUtils.join(cobundledApis.stream().map(Class::getName).collect(Collectors.toSet()), ", ")));
    }

    // the service is eligible when it does not require instance classloading or when the supporting APIs are bundled in a parent NAR
    return requiresInstanceClassLoading == false || cobundledApis.isEmpty();
}
 
Example 7
Source File: AgentManagementResource.java    From titus-control-plane with Apache License 2.0 6 votes vote down vote up
@DELETE
@ApiOperation("Delete agent instance attributes")
@Path("/instances/{id}/attributes")
public Response deleteAgentInstanceAttributes(@PathParam("id") String agentInstanceId, @QueryParam("keys") String delimitedKeys) {
    if (Strings.isNullOrEmpty(delimitedKeys)) {
        throw TitusServiceException.invalidArgument("Path parameter 'keys' cannot be empty");
    }

    Set<String> keys = StringExt.splitByCommaIntoSet(delimitedKeys);
    if (keys.isEmpty()) {
        throw TitusServiceException.invalidArgument("Parsed path parameter 'keys' cannot be empty");
    }

    DeleteAgentInstanceAttributesRequest request = DeleteAgentInstanceAttributesRequest.newBuilder()
            .setAgentInstanceId(agentInstanceId)
            .addAllKeys(keys)
            .build();
    return Responses.fromVoidMono(agentManagementService.deleteAgentInstanceAttributes(request));
}
 
Example 8
Source File: ExpandSelectHelper.java    From olingo-odata4 with Apache License 2.0 6 votes vote down vote up
/**
 * @param selectedPaths
 * @param parts
 * @param path
 */
private static Set<List<String>> extractPathsFromResourceParts(
    Set<List<String>> selectedPaths, final List<UriResource> parts,
    List<String> path) {
  if (parts.size() > 1) {
    for (final UriResource part : parts.subList(1, parts.size())) {
      if (part instanceof UriResourceProperty) {
        path.add(((UriResourceProperty) part).getProperty().getName());
      } else if (part instanceof UriResourceNavigation) {
        path.add(((UriResourceNavigation) part).getProperty().getName());
      }
      if (part instanceof UriResourceComplexProperty &&
          ((UriResourceComplexProperty) part).getComplexTypeFilter() != null) {
        path.add(((UriResourceComplexProperty) part).getComplexTypeFilter().
            getFullQualifiedName().getFullQualifiedNameAsString());
      }
    }
    selectedPaths.add(path);
  } else if (!path.isEmpty()) {
    selectedPaths.add(path);
  } else {
    return null;
  }
  return selectedPaths.isEmpty() ? null : selectedPaths;
}
 
Example 9
Source File: MutableShortcutsModel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private boolean isDirty() {
    boolean isChanged = !getCurrentProfile().equals(model.getCurrentProfile());
    if (isChanged) { // currently selected profile is modified, so no need to iterate futher
        return true;
    }
    for (KeymapManager m : getKeymapManagerInstances()) {
        List<String> profiles = m.getProfiles();
        if (profiles != null) {
            if(!modifiedProfiles.isEmpty()) {
                isChanged |= !profiles.containsAll(modifiedProfiles.keySet());
            }
            if (isChanged) { // one or more profiles have been dublicated, so no need to iterate futher
                return true;
            }
            if(!deletedProfiles.isEmpty()) {
                isChanged |= profiles.containsAll(deletedProfiles);
            }
            if (isChanged) { // one or more profiles have been deleted, so no need to iterate futher
                return true;
            }
            for (String profile : profiles) {
                Map<ShortcutAction, Set<String>> saved = m.getKeymap(profile);
                Map<ShortcutAction, Set<String>> current = modifiedProfiles.get(profile);
                if(current != null) {
                    for(Map.Entry<ShortcutAction, Set<String>> entry : current.entrySet()) {
                        Set<String> savedShortcut = saved.get(entry.getKey());
                        Set<String> currentShortcut = current.get(entry.getKey());
                        isChanged |= savedShortcut == null ? !currentShortcut.isEmpty() : !savedShortcut.equals(currentShortcut);
                        if (isChanged) { // a shortcut is found to be modified, so no need to iterate futher
                            return true;
                        }
                    }
                }
            }
        }
    }
    return false;
}
 
Example 10
Source File: DefaultSchedulerService.java    From titus-control-plane with Apache License 2.0 5 votes vote down vote up
@Override
public Completable updateSystemSelector(String id, SystemSelector systemSelector) {
    com.netflix.titus.api.scheduler.model.SystemSelector coreSystemSelector = GrpcSchedulerModelConverters.toCoreSystemSelector(systemSelector);
    Set<ValidationError> violations = entitySanitizer.validate(coreSystemSelector);
    if (!violations.isEmpty()) {
        return Completable.error(TitusServiceException.invalidArgument(violations));
    }

    return createRequestCompletable(emitter -> {
        StreamObserver<Empty> streamObserver = createEmptyClientResponseObserver(emitter);
        SystemSelectorUpdate systemSelectorUpdate = SystemSelectorUpdate.newBuilder().setId(id).setSystemSelector(systemSelector).build();
        GrpcUtil.createWrappedStubWithResolver(client, callMetadataResolver, configuration.getRequestTimeout()).updateSystemSelector(systemSelectorUpdate, streamObserver);
    }, configuration.getRequestTimeout());
}
 
Example 11
Source File: VirtualTableRuleMatcher.java    From tddl5 with Apache License 2.0 5 votes vote down vote up
private Map<String, Map<String, Field>> crossWithSourceKey1(Rule<String> matchedDbRule,
                                                            Map<String, Comparative> matchedDbRuleArgs,
                                                            Rule<String> matchedTbRule,
                                                            Map<String, Comparative> matchedTbRuleArgs,
                                                            String[] commonColumn, Object outerCtx) {
    SamplesCtx dbRuleCtx = null; // 对于表规则中与库规则列名相同而自增类型不同的列,将其表枚举结果加入库规则的枚举集
    Set<AdvancedParameter> mergeInCommon = diffTypeOrOptionalInCommon(matchedDbRule,
        matchedTbRule,
        commonColumn,
        matchedDbRuleArgs,
        matchedTbRuleArgs);
    if (mergeInCommon != null && !mergeInCommon.isEmpty()) {
        // 公共列包含有枚举类型不同的列,例如库是1_month,表示1_day
        Map<String, Set<Object>> tbTypes = RuleUtils.getSamplingField(matchedTbRuleArgs, mergeInCommon);
        dbRuleCtx = new SamplesCtx(new Samples(tbTypes), SamplesCtx.merge);
    }
    Map<String, Samples> dbValues = RuleUtils.cast(matchedDbRule.calculate(matchedDbRuleArgs, dbRuleCtx, outerCtx));
    Map<String, Map<String, Field>> topology = new HashMap<String, Map<String, Field>>(dbValues.size());
    for (Map.Entry<String, Samples> e : dbValues.entrySet()) {
        SamplesCtx tbRuleCtx = new SamplesCtx(e.getValue().subSamples(commonColumn), SamplesCtx.replace);
        Map<String, Samples> tbValues = RuleUtils.cast(matchedTbRule.calculate(matchedTbRuleArgs,
            tbRuleCtx,
            outerCtx));
        topology.put(e.getKey(), toMapField(tbValues));
    }
    return topology;
}
 
Example 12
Source File: TableServiceImpl.java    From metacat with Apache License 2.0 5 votes vote down vote up
private void tag(final QualifiedName name, final ObjectNode definitionMetadata) {
    final Set<String> tags = getTableTags(definitionMetadata);
    if (!tags.isEmpty()) {
        log.info("Setting tags {} for table {}", tags, name);
        final Set<String> result = tagService.setTags(name, tags, false);
    }
}
 
Example 13
Source File: StatementSerializer.java    From rya with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a Regular Expression to match serialized statements meeting these constraints. A <code>null</code> or empty parameters imply
 * no constraint. A <code>null</code> return value implies no constraints.
 *
 * @param context
 *            context constraint
 * @param subject
 *            subject constraint
 * @param predicates
 *            list of predicate constraints
 * @return a regular expression that can be used to match serialized statements. A <code>null</code> return value implies no
 *         constraints.
 */
public static String createStatementRegex(final StatementConstraints contraints) {
    final Resource context = contraints.getContext();
    final Resource subject = contraints.getSubject();
    final Set<IRI> predicates = contraints.getPredicates();
    if (context == null && subject == null && (predicates == null || predicates.isEmpty())) {
        return null;
    }

    // match on anything but a separator
    final String anyReg = "[^" + SEP + "]*";

    // if context is empty, match on any context
    final String contextReg = (context == null) ? anyReg : context.stringValue();

    // if subject is empty, match on any subject
    final String subjectReg = (subject == null) ? anyReg : subject.stringValue();

    // if the predicates are empty, match on any predicate. Otherwise, "or" the predicates.
    String predicateReg = "";
    if (predicates == null || predicates.isEmpty()) {
        predicateReg = anyReg;
    } else {
        predicateReg = "(" + StringUtils.join(predicates, "|") + ")";
    }

    return "^" + contextReg + SEP + subjectReg + SEP + predicateReg + SEP + ".*";
}
 
Example 14
Source File: SeedNodesRequest.java    From couchbase-jvm-core with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a {@link SeedNodesRequest} with the given list of hostnames.
 *
 * @param nodes the seed node hostnames.
 */
public SeedNodesRequest(final List<String> nodes) {
    super(null, null);

    if (nodes == null || nodes.isEmpty()) {
        throw new ConfigurationException("Empty or null bootstrap list provided.");
    }
    Set<String> parsedNodes = new HashSet<>();
    for (String node : nodes) {
        if (node == null || node.isEmpty()) {
            LOGGER.info("Empty or null host in bootstrap list.");
            continue;
        }

        try {
            parsedNodes.add(node);
        } catch (Exception e) {
            LOGGER.info("Unknown host {} in bootstrap list.", system(node), e);
        }
    }

    if (parsedNodes.isEmpty()) {
        throw new ConfigurationException("No valid node found to bootstrap from. "
            + "Please check your network configuration.");
    }
    this.nodes = parsedNodes;
}
 
Example 15
Source File: TBoxUnFoldingTool.java    From owltools with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public OWLObjectIntersectionOf visit(OWLObjectIntersectionOf ce) {
	if (LOG.isDebugEnabled()) {
		LOG.debug("Unfolding intersection_of: "+ce);
	}
	
	Set<OWLClassExpression> operands = ce.getOperands();
	if (operands != null && !operands.isEmpty()) {
		Set<OWLClassExpression> unfolded = unfoldExpressions(operands);
		if (unfolded != null) {
			return factory.getOWLObjectIntersectionOf(unfolded);
		}
	}
	return null;
}
 
Example 16
Source File: DefaultRoute.java    From armeria with Apache License 2.0 5 votes vote down vote up
private static void addMediaTypes(StringJoiner builder, String prefix, Set<MediaType> mediaTypes) {
    if (!mediaTypes.isEmpty()) {
        final StringBuilder buf = new StringBuilder();
        buf.append(prefix).append(':');
        for (MediaType t : mediaTypes) {
            buf.append(t.type());
            buf.append('/');
            buf.append(t.subtype());
            buf.append(',');
        }
        buf.setLength(buf.length() - 1);
        builder.add(buf.toString());
    }
}
 
Example 17
Source File: InterceptedStaticMethodsProcessor.java    From quarkus with Apache License 2.0 4 votes vote down vote up
@BuildStep
void collectInterceptedStaticMethods(BeanArchiveIndexBuildItem beanArchiveIndex,
        BuildProducer<InterceptedStaticMethodBuildItem> interceptedStaticMethods,
        InterceptorResolverBuildItem interceptorResolver, TransformedAnnotationsBuildItem transformedAnnotations) {

    // In this step we collect all intercepted static methods, ie. static methods annotated with interceptor bindings  
    Set<DotName> interceptorBindings = interceptorResolver.getInterceptorBindings();

    for (ClassInfo clazz : beanArchiveIndex.getIndex().getKnownClasses()) {
        for (MethodInfo method : clazz.methods()) {
            // Find all static methods (except for static initializers)
            if (!Modifier.isStatic(method.flags()) || "<clinit>".equals(method.name())) {
                continue;
            }
            // Get the (possibly transformed) set of annotations
            Collection<AnnotationInstance> annotations = transformedAnnotations.getAnnotations(method);
            if (annotations.isEmpty()) {
                continue;
            }
            // Only method-level bindings are considered due to backwards compatibility
            Set<AnnotationInstance> methodLevelBindings = null;
            for (AnnotationInstance annotationInstance : annotations) {
                if (annotationInstance.target().kind() == Kind.METHOD
                        && interceptorBindings.contains(annotationInstance.name())) {
                    if (methodLevelBindings == null) {
                        methodLevelBindings = new HashSet<>();
                    }
                    methodLevelBindings.add(annotationInstance);
                }
            }
            if (methodLevelBindings == null || methodLevelBindings.isEmpty()) {
                continue;
            }
            if (Modifier.isPrivate(method.flags())) {
                LOGGER.warnf(
                        "Interception of private static methods is not supported; bindings found on %s: %s",
                        method.declaringClass().name(),
                        method);
            } else {
                List<InterceptorInfo> interceptors = interceptorResolver.get().resolve(
                        InterceptionType.AROUND_INVOKE,
                        methodLevelBindings);
                if (!interceptors.isEmpty()) {
                    LOGGER.debugf("Intercepted static method found on %s: %s", method.declaringClass().name(),
                            method);
                    interceptedStaticMethods.produce(
                            new InterceptedStaticMethodBuildItem(method, methodLevelBindings, interceptors));
                }
            }
        }
    }
}
 
Example 18
Source File: IndexLoader.java    From solr-autocomplete with Apache License 2.0 4 votes vote down vote up
public static void main(String[] args) throws CorruptIndexException, IOException, SolrServerException {

        if (args.length < 3) {
            System.err.println("Usage: java -Dfile.encoding=UTF8 -Dclient.encoding.override=UTF-8 -Xmx256m -Xms256m -server " + IndexLoader.class.getName()
                    + " </path/to/index> <AutoCompleteSolrUrl> <indexField1,acField1> [indexField2,acField2 ... ]");
            System.exit(0);
        }
        Map<String,String> fieldMap = getFieldMapping(args, 2);
        DirectoryReader reader = DirectoryReader.open(FSDirectory.open(Paths.get(args[0])));
        int docs = reader.maxDoc();
        SolrClient solr = new ConcurrentUpdateSolrClient.Builder(args[1]).withQueueSize(10000).withThreadCount(2).build();
        Set<SolrInputDocument> batch = new HashSet<SolrInputDocument>(1000);
        
        Bits liveDocs = MultiFields.getLiveDocs(reader);
        
        // go through all docs in the index
        for (int i = 0; i < docs; i++) {
            // process doc only if not deleted
            if (liveDocs == null || liveDocs.get(i)) {
                // loop through all fields to be looked at
                SolrInputDocument doc = new SolrInputDocument();
                Iterator<String> iter = fieldMap.keySet().iterator();
                
                boolean phraseFieldEmpty = false;
                
                while (iter.hasNext()) {
                    String indexField = iter.next();
                    String acField = fieldMap.get(indexField);
                    IndexableField field = reader.document(i).getField(indexField);
                    String value = field != null ? reader.document(i).getField(indexField).stringValue() : null;
                    
                    if (field != null && value != null && !value.isEmpty()) {
                      doc.addField(acField, value);
                    } else {
                      // not very relevant piece of info
                      // System.err.println("Field is null or empty, skipping: " + indexField);
                      
                      if (acField.equalsIgnoreCase("phrase")) {
                        System.err.println("Since AC phrase field would be null, this doc will not be created: " + reader.document(i));
                        phraseFieldEmpty = true;
                        break;
                      }
                    }
                }

                if (!phraseFieldEmpty) {
                  solr.add(doc);
                  if (docs % 1000 == 0) {
                    System.out.println("Docs: " + docs);
                  }
                }
            }
        }
        if (!batch.isEmpty())
            solr.add(batch);
        reader.close();
        System.out.println("Optimizing...");
        solr.optimize();
        solr.close();
    }
 
Example 19
Source File: SchedulingSubpart.java    From unitime with Apache License 2.0 4 votes vote down vote up
private Set fixDurationInTimePreferences(Set prefs) {
  	if (prefs == null || prefs.isEmpty()) return prefs;
  	DatePattern dp = effectiveDatePattern();
  	if (dp == null) return prefs;
  	DurationModel dm = getInstrOfferingConfig().getDurationModel();
  	
  	Set ret = new TreeSet(prefs);
  	List<TimePref> fixed = new ArrayList<TimePref>();
for (Iterator i=ret.iterator();i.hasNext();) {
	Preference pref = (Preference)i.next();
	if (pref instanceof TimePref) {
		TimePref tp = (TimePref) pref;
		if (tp.getTimePattern().getType() != null && tp.getTimePattern().getType() == TimePattern.sTypeExactTime) continue;
		Set<Integer> days = dm.getDayCodes(getMinutesPerWk(), dp, tp.getTimePattern());
		if (days.isEmpty()) {
			i.remove();
		} else if (days.size() < tp.getTimePattern().getDays().size()) {
			TimePatternModel model = tp.getTimePatternModel();
			boolean req = model.hasRequiredPreferences();
			for (int d = 0; d < model.getNrDays(); d++) {
				if (!days.contains(model.getDayCode(d))) {
					for (int t = 0; t < model.getNrTimes(); t++)
						model.setPreference(d, t, PreferenceLevel.sNotAvailable);
				}
			}
			if (req && !model.hasRequiredPreferences()) {
				for (int d = 0; d < model.getNrDays(); d++)
					if (days.contains(model.getDayCode(d))) {
						for (int t = 0; t < model.getNrTimes(); t++)
							model.setPreference(d, t, PreferenceLevel.sProhibited);
					}
			}
			i.remove();
			TimePref copy = (TimePref)tp.clone();
			copy.setPreference(model.getPreferences());
			fixed.add(copy);
		}
	}
}
ret.addAll(fixed);
return ret;
  }
 
Example 20
Source File: GeneratedKeysSupportFactory.java    From jaybird with GNU Lesser General Public License v2.1 3 votes vote down vote up
/**
 * Create generated keys support based on the provided config and database metadata.
 * <p>
 * The supported values for {@code generatedKeysEnabled} are
 * <dl>
 * <dt>{@code default}</dt>
 * <dd>Support all query types supported by Firebird version (if none are supported, will throw
 * {@code SQLFeatureNotSupportedException} for attempts to use generated keys facility, except
 * {@code Statement.RETURN_NO_GENERATED_KEYS})</dd>
 * <dt>{@code disabled}</dt>
 * <dd>Explicitly disabled support, will throw {@code SQLFeatureNotSupportedException} for attempts to use
 * generated keys facility, except {@code Statement.RETURN_NO_GENERATED_KEYS})</dd>
 * <dt>{@code ignored}</dt>
 * <dd>Ignore generated keys support. Any attempt to use generated keys will be ignored and executed as a
 * normal non-generated keys statement.</dd>
 * <dt>Comma-separated list of query types</dt>
 * <dd>Only enable support for the specified query types. All other query types are handled as non-generated
 * keys statement</dd>
 * </dl>
 * </p>
 * <p>
 * The last option is a comma-separated list of query types to enable for support. Primary use-case is to enable
 * only {@code insert} to avoid the singleton limitation for the other DML types. Other example
 * {@code insert,update} enables only insert and update. Supported query type values (case insensitive) are:
 * <ul>
 * <li>{@code insert}</li>
 * <li>{@code update}</li>
 * <li>{@code delete}</li>
 * <li>{@code update_or_insert}</li>
 * <li>{@code merge}</li>
 * </ul>
 * </p>
 * <p>
 * Supplying a list of query types will only enable the query types that are specified in the list (if supported by
 * the connected Firebird version). Unknown query types are ignored. If all specified query types are unknown or not
 * supported, then this behaves as {@code ignored}. NOTE: For Firebird 1.5 and earlier (unsupported) this will -
 * same as for {@code default} - behave as {@code disabled} and attempts to use generated keys (except
 * {@code Statement.RETURN_NO_GENERATED_KEYS}) will always throw a {@code SQLFeatureNotSupportedException}.
 * </p>
 *
 * @param generatedKeysEnabled
 *         Generated keys enabled value (case insensitive: {@code disabled}, {@code ignored},
 *         {@code default} / {@code null} / empty string, or a list of query types to enable
 * @param fbDatabaseMetaData
 *         Database metadata object
 * @return Appropriate generated keys support determined by config value, Firebird feature support and availability
 * of ANTLR on the the classpath.
 * @throws SQLException
 *         if a database access error occurs while determining feature support
 */
static GeneratedKeysSupport createFor(String generatedKeysEnabled, FirebirdDatabaseMetaData fbDatabaseMetaData)
        throws SQLException {
    String normalizedConfigValue = generatedKeysEnabled != null && !generatedKeysEnabled.isEmpty()
            ? generatedKeysEnabled.toLowerCase(Locale.ROOT)
            : GENERATED_KEYS_ENABLED_DEFAULT;
    if (GENERATED_KEYS_DISABLED.equals(normalizedConfigValue)) {
        return DisabledGeneratedKeysSupport.EXPLICITLY_DISABLED;
    } else if (GENERATED_KEYS_IGNORED.equals(normalizedConfigValue)) {
        return IgnoredGeneratedKeysSupport.INSTANCE;
    } else if (!isGeneratedKeysSupportLoaded()) {
        return DisabledGeneratedKeysSupport.PARSER_NOT_LOADED;
    } else {
        Set<GeneratedKeysSupport.QueryType> returningSupport =
                GeneratedKeysSupport.QueryType.returningSupportForVersion(
                        fbDatabaseMetaData.getDatabaseMajorVersion(),
                        fbDatabaseMetaData.getDatabaseMinorVersion());
        if (returningSupport.isEmpty()) {
            return new DisabledGeneratedKeysSupport(REASON_NO_RETURNING_SUPPORT);
        } else if (GENERATED_KEYS_ENABLED_DEFAULT.equals(normalizedConfigValue)) {
            return new DefaultGeneratedKeysSupport(ParserHolder.PARSER, fbDatabaseMetaData, returningSupport);
        } else {
            Set<GeneratedKeysSupport.QueryType> enabledTypes =
                    getEnabledTypes(normalizedConfigValue, returningSupport);
            if (enabledTypes.isEmpty()) {
                return IgnoredGeneratedKeysSupport.INSTANCE;
            }
            return new DefaultGeneratedKeysSupport(ParserHolder.PARSER, fbDatabaseMetaData, enabledTypes);
        }
    }
}