Build an online constraint.

@param args must be 1 set of vms. The set must not be empty
@return a constraint
977844
@Override
    public List<SatConstraint> buildConstraint(BtrPlaceTree t, List<BtrpOperand> args) {
        if (checkConformance(t, args)) {
            @SuppressWarnings("unchecked")
            List<VM> s = (List<VM>) params[0].transform(this, t, args.get(0));
            if (s == null) {
                return Collections.emptyList();
            }
            return s.stream().map(Ready::new).collect(Collectors.toList());
        }
        return Collections.emptyList();
    }
623446
public SpringApplication build(String... args) {
		configureAsChildIfNecessary(args);
		this.application.addPrimarySources(this.sources);
		return this.application;
	}
810622
OrderedHashSet getDependentConstraints(Constraint constraint) {

        OrderedHashSet set = new OrderedHashSet();

        for (int i = 0, size = constraintList.length; i < size; i++) {
            Constraint c = constraintList[i];

            if (c.getConstraintType() == Constraint.MAIN) {
                if (c.core.uniqueName == constraint.getName()) {
                    set.add(c);
                }
            }
        }

        return set;
    }
514238
public DomainCommandBuilder addHostControllerJavaOption(final String arg) {
        if (arg != null && !arg.trim().isEmpty()) {
            final Argument argument = Arguments.parse(arg);
            switch (argument.getKey()) {
                case DOMAIN_BASE_DIR:
                    if (argument.getValue() != null) {
                        setBaseDirectory(argument.getValue());
                    }
                    break;
                case DOMAIN_CONFIG_DIR:
                    if (argument.getValue() != null) {
                        setConfigurationDirectory(argument.getValue());
                    }
                    break;
                case DOMAIN_LOG_DIR:
                    if (argument.getValue() != null) {
                        setLogDirectory(argument.getValue());
                    }
                    break;
                default:
                    hostControllerJavaOpts.add(argument);
                    break;
            }
        }
        return this;
    }
306937
@SuppressWarnings("unchecked")
    public static DataProviderFactory create(final Object... args) {
        // Find the implementation for the DataProviderFactory.
        final Class<? extends DataProviderFactory> dataProviderClass = findDataProviderImpl();

        // Find the constructor that matches the arguments passed.
        final DataProviderFactory factory;
        try {
            Constructor<? extends DataProviderFactory> dataProviderConstructor = null;
            final Constructor[] constructors = dataProviderClass.getDeclaredConstructors();
            for (final Constructor constructor : constructors) {
                final Class<?>[] params = constructor.getParameterTypes();
                boolean matches = false;

                // Ensure that all the argument match
                if (args.length == params.length) {
                    matches = true;
                    for (int i = 0; i < params.length; i++) {
                        if (!params[i].isAssignableFrom(args[i].getClass())) {
                            matches = false;
                        }
                    }
                }

                // If the constructor matches then break the loop, as we've found the matching constructor
                if (matches) {
                    dataProviderConstructor = constructor;
                    break;
                }
            }

            // Make sure a constructor was found
            if (dataProviderConstructor != null) {
                factory = dataProviderConstructor.newInstance(args);
            } else {
                factory = null;
            }
        } catch (Exception e) {
            throw new RuntimeException(e);
        }

        return factory;
    }
265422
public static <T> Set<T> createSet(T... args) {
        HashSet<T> newSet = new HashSet<T>();
        Collections.addAll(newSet, args);
        return newSet;
    }
185765
public static <T> Constraint
            checking(Function<String, T> check, String messageOrKey, boolean isKey, String... extraMessageArgs) {
        return mkSimpleConstraint(((label, vString, messages) -> {
            logger.debug("checking for {}", vString);

            if (isEmptyStr(vString)) return null;
            else {
                try {
                    check.apply(vString);
                    return null;
                } catch (Exception ex) {
                    String msgTemplate = isKey ? messages.get(messageOrKey) : messageOrKey;
                    List<String> messageArgs = appendList(Arrays.asList(vString), extraMessageArgs);
                    return String.format(msgTemplate, messageArgs.toArray());
                }
            }
        }), null);
    }
1001609
public static Constraint
            mkSimpleConstraint(Function3<String, String, Messages, String> validate,
                               ExtensionMeta meta) {
        return mkConstraintWithMeta(
            (name, data, messages, options) -> {
                if (options._inputMode() != InputMode.SINGLE) {
                    throw new IllegalArgumentException("The constraint should only be used to SINGLE INPUT mapping!");
                } else {
                    String label = getLabel(name, messages, options);
                    String error = validate.apply(label, data.get(name), messages);
                    return isEmptyStr(error) ? Collections.emptyList()
                            : Arrays.asList(entry(name, error));
                }
            }, meta);
        }
234712
@SafeVarargs
  public final QueryBuilder arguments(Object...args) {
    set(Param.QUERY_ARGS, "");
    queryArgs = args.clone();
    return this;
  }
730385
public <K, V> void build(CommandArgs<K, V> args, Long count, K... queues) {

        // GETJOB [NOHANG] [TIMEOUT <ms-timeout>] [COUNT <count>] [WITHCOUNTERS] FROM queue1 queue2 ... queueN

        if (noHang != null && noHang.booleanValue()) {
            args.add(CommandKeyword.NOHANG.bytes);
        }

        if (timeout != null) {
            args.add(CommandKeyword.TIMEOUT.bytes).add(timeout);
        }

        if (count != null && count.longValue() != 1L) {
            args.add(CommandKeyword.COUNT.bytes).add(count);
        }

        if (withCounters != null && withCounters.booleanValue()) {
            args.add(CommandKeyword.WITHCOUNTERS.bytes);
        }
        args.add(CommandKeyword.FROM.bytes).addKeys(queues);
    }
591081
protected GridBagConstraints createConstraints() {
        GridBagConstraints answer = new GridBagConstraints();
        answer.anchor = getAnchor();
        if (colspan < 1) {
            colspan = 1;
        }
        if (rowspan < 1) {
            rowspan = 1;
        }
        if (isColfill())  {
            answer.fill = isRowfill()
                ? GridBagConstraints.BOTH 
                : GridBagConstraints.HORIZONTAL;
        }
        else {
            answer.fill = isRowfill()
                ? GridBagConstraints.VERTICAL 
                : GridBagConstraints.NONE;
        }
        answer.weightx = 0.2;
        answer.weighty = 0;
        answer.gridwidth = colspan;
        answer.gridheight = rowspan;
        return answer;
    }
594372
private static String convertArgs(String[] args)
    {
        StringBuilder result = new StringBuilder();
        for (int i = 0; i < args.length; i++)
        {
            result.append(args[i]);
            if (i < args.length - 1)
            {
                result.append(' ');
            }
        }
        return result.toString().toUpperCase();
    }
68344
public static Constraint min(final Number min) {
		return new Constraint("min", minPayload(min)) {
			public boolean isValid(Object actualValue) {
				return actualValue == null || (actualValue instanceof Number && min != null &&
						min.longValue() <= ((Number) actualValue).longValue());
			}
		};
	}
827293
@SuppressWarnings("unchecked")
	public T create(Object[] args)
	{
		for(int i=0, n=args.length; i<n; i++)
		{
			if(arguments[i] instanceof FactoryDefinition.InjectedArgument)
			{
				args[i] = arguments[i].getValue(null);
			}
		}

		try
		{
			return (T) raw.newInstance(args);
		}
		catch(IllegalArgumentException e)
		{
			throw new SerializationException("Unable to create; " + e.getMessage(), e);
		}
		catch(InstantiationException e)
		{
			throw new SerializationException("Unable to create; " + e.getMessage(), e);
		}
		catch(IllegalAccessException e)
		{
			throw new SerializationException("Unable to create; " + e.getMessage(), e);
		}
		catch(InvocationTargetException e)
		{
			throw new SerializationException("Unable to create; " + e.getCause().getMessage(), e.getCause());
		}
	}
811001
@SuppressWarnings("rawtypes")
    public AbstractBeanDefinition bean(Class type, Object...args) {
        BeanConfiguration current = currentBeanConfig;
        try {
            Closure callable = null;
            Collection constructorArgs = null;
            if (args != null && args.length > 0) {
                int index = args.length;
                Object lastArg = args[index-1];

                if (lastArg instanceof Closure) {
                    callable = (Closure) lastArg;
                    index--;
                }
                if (index > -1) {
                    constructorArgs = resolveConstructorArguments(args, 0, index);
                }
            }
            currentBeanConfig =  constructorArgs == null ? springConfig.createSingletonBean(type) : springConfig.createSingletonBean(type, constructorArgs);
            if (callable != null) {
                callable.call(new Object[]{currentBeanConfig});
            }
            return currentBeanConfig.getBeanDefinition();

        }
        finally {
            currentBeanConfig = current;
        }
    }
1043353
public Constraint getConstraint(String constraintName) {

        int i = getConstraintIndex(constraintName);

        return (i < 0) ? null
                       : constraintList[i];
    }
738699
public Object createNewInstance(Class[] types, Object[] args)
    {
        try
        {
            Object result;
            // create an instance of the target class
            if (types != null)
            {
                result = ClassHelper.newInstance(getClassToServe(), types, args, true);
            }
            else
            {
                result = ClassHelper.newInstance(getClassToServe(), true);
            }
            // if defined in OJB.properties all instances are wrapped by an interceptor
            result = InterceptorFactory.getInstance().createInterceptorFor(result);
            return result;

        }
        catch (InstantiationException e)
        {
            getLogger().error("ConfigurableFactory can't instantiate class " +
                    getClassToServe() + buildArgumentString(types, args), e);
            throw new PersistenceBrokerException(e);
        }
        catch (IllegalAccessException e)
        {
            getLogger().error("ConfigurableFactory can't access constructor for class " +
                    getClassToServe() + buildArgumentString(types, args), e);
            throw new PersistenceBrokerException(e);
        }
        catch (Exception e)
        {
            getLogger().error("ConfigurableFactory instantiation failed for class " +
                    getClassToServe() + buildArgumentString(types, args), e);
            throw new PersistenceBrokerException(e);
        }
    }