Creates all registered service implementations.

@param arguments
Arguments for constructors of service implementations
@return Instances of all service implementations
484770
public Collection<T> createAll(final Object... arguments) {
		Collection<T> instances = new ArrayList<T>(classes.size());

		for (String className : classes) {
			T instance = createInstance(className, arguments);
			if (instance != null) {
				instances.add(instance);
			}
		}

		return instances;
	}
423740
public static <T> T createInstance(Class<T> type, Object... parameters) {

    // get types for parameters
    Class<?>[] parameterTypes = new Class<?>[parameters.length];
    for (int i = 0; i < parameters.length; i++) {
      Object parameter = parameters[i];
      parameterTypes[i] = parameter.getClass();
    }

    try {
      // create instance
      Constructor<T> constructor = type.getConstructor(parameterTypes);
      return constructor.newInstance(parameters);

    } catch (Exception e) {
      throw new ModelException("Exception while creating an instance of type "+type, e);
    }
  }
918658
public static Class<?>[] collectArgTypes(final Object[] args) {
        final Class<?>[] result = new Class<?>[args.length];
        collectArgTypes(args, result, 0, 0, args.length);
        return result;
    }
39818
@Override
    public void start(String[] arguments) {
        boolean notStarted = !started.getAndSet(true);
        if (notStarted) {
            start(new SingleInstanceWorkloadStrategy(job, name, arguments, endpointRegistry, execService));
        }
    }
161811
public static InputMapping<?>[] createArrayMapping( Object[] arguments ){
        if( arguments == null || arguments.length == 0 ){
            return null;
        }
        List<InputMapping<?>> list = new ArrayList<>();
        for( Object argument : arguments ){
            list.add( createInputMapping( argument ) );
        }
        return list.toArray( new InputMapping<?>[arguments.length] );

    }
234712
@SafeVarargs
  public final QueryBuilder arguments(Object...args) {
    set(Param.QUERY_ARGS, "");
    queryArgs = args.clone();
    return this;
  }
1037375
private LaunchArguments createLaunchArguments(String[] args, Map<String, String> initProps) {
        List<String> cmdArgs = processBatchFileArgs(new ArrayList<String>(Arrays.asList(args)));
        return new LaunchArguments(cmdArgs, initProps, isClient());
    }
619983
@NonNull
    public <T> List<T> create(@NonNull Collection<Class<? extends T>> classes) {
        final List<T> result = new ArrayList<>();
        for (Class<? extends T> clazz : classes) {
            final T instance = create(clazz);
            if (instance != null) {
                result.add(instance);
            }
        }
        return result;
    }
430323
public static <T> T newInstance(final Class<T> clas, final Object... params) {
		try {
			final Class<?>[] paramClasses = JKObjectUtil.toClassesFromObjects(params);
			if (paramClasses.length == 0) {
				return clas.newInstance();
			}
			return ConstructorUtils.invokeConstructor(clas, params);
		} catch (final Exception e) {
			throw new RuntimeException(e);
		}
	}
899802
private static Class[] initParamsClasses(final Object... args) {
		int count = 0;
		Class[] intArgsClass = null;
		if (args != null) {
			intArgsClass = new Class[args.length];
			for (final Object arg : args) {
				intArgsClass[count++] = arg.getClass();
			}
		}
		return intArgsClass;
	}
389350
public T newInstance(Object... args)
    {
        try
        {
            return type.cast(factoryMethod.invoke(null, args));
        }
        catch (IllegalAccessException e)
        {
            throw ExceptionImposter.imposterize( e );
        }
        catch (InvocationTargetException e)
        {
            throw ExceptionImposter.imposterize( e.getCause() );
        }
    }
433514
private void getAllServices() {
        try {
            List<ModelServiceInstance> instances = new DirectoryServiceRestfulClient().getAllInstances();
            for (ModelServiceInstance instance :instances){
                printServiceInstance(ServiceInstanceUtils.toServiceInstance(instance));
            }
        } catch (ServiceException e) {
            e.printStackTrace();
            fail(e.getServiceDirectoryError().getErrorMessage());
        }
    }
684441
@SuppressWarnings(
	{ "unchecked" })
	public static <T> List<T> toList(T...args)
	{
		if(args == null || args.length ==0)
			return null;
		
		ArrayList<T> list = new ArrayList<>(args.length);
		for (T t : args)
		{
			list.add(t);
		}
		
		return list;
	}
5566
private Map<ScopeService, Service> createServices(final Set<ScopeService> services) {
    Map<ScopeService, Service> actualServices = Maps.newTreeMap();

    for (ScopeService requiredService : services) {
      if (availableServices.containsKey(requiredService)) {
        for (ScopeService availableService : availableServices.keySet()) {
          if (availableService == requiredService) {
            actualServices.put(requiredService, requiredService.newInstance(this));
          }
        }
      }
    }

    return actualServices;
  }
283547
public List<ModelServiceInstance> getAllInstances(){
        HttpResponse result = invoker.invoke("/service" , null, HttpMethod.GET);

        if (result.getHttpCode() != HTTP_OK) {
           throw new ServiceException(ErrorCode.REMOTE_DIRECTORY_SERVER_ERROR,
                    "HTTP Code is not OK, code=%s", result.getHttpCode());
        }

        List<ModelServiceInstance> allInstances = _deserialize(result.getRetBody(), new TypeReference<List<ModelServiceInstance>>(){});
        return allInstances;
    }
841157
public void addAll(final String... args) {
        if (args != null) {
            for (String arg : args) {
                add(arg);
            }
        }
    }
480046
public static Arguments create(List<String> values, Map<String, String> params)
    {
        if (values == null)
        {
            values = emptyList();
        }
        if (params == null)
        {
            params = emptyMap();
        }
        if (values.isEmpty() && params.isEmpty())
        {
            return NONE;
        }
        return new Arguments(values, params);
    }