Gets single arg constructor as Function.
@param clazz class to get constructor for.
@param arg constructor argument type.
@param <T> clazz.
@param <A> argument class.
@return function.
772737
public <T, A> Function<A, T> getConstructor(Class<? extends T> clazz, Class<A> arg) {
        return getConstructorAs(Function.class, "apply", clazz, arg);
    }
905465
public static Method getMethod(Class clazz, String methodName, Class<?>... parameterTypes) {
        if (clazz == null) {
            return null;
        }
        try {
            return clazz.getDeclaredMethod(methodName, parameterTypes);
        } catch (SecurityException e) {
            e.printStackTrace();
        } catch (NoSuchMethodException e) {
            e.printStackTrace();
        }
        return null;
    }
824458
public static Logger getLogger(final Class<?> clazz) {
        if (!clazz.getPackage().getName().startsWith(LOGGER.getName())) {
            throw new IllegalArgumentException(String.format("Class %s is not a child of the package %s",
                    clazz.getName(), LOGGER.getName()));
        }
        LOGGER.fine(() -> String.format("Locating logger for class %s", clazz));
        return Logger.getLogger(clazz.getName());
    }
40966
@SuppressWarnings("unchecked")
    public static <T> T instantiate(final Class<T> tClass) {
        try {
            if(tClass == null)
                return null;

            final Constructor<?> zeroArgConstructor = Arrays.stream(tClass.getDeclaredConstructors())
                    .filter(c -> c.getParameterCount() == 0)
                    .findFirst().orElse(null);

            if(zeroArgConstructor == null) {
                logger.warning("[CAN NOT INSTANTIATE] : " + tClass + ", have NO zero arg constructor.");
                return null;
            }

            return ((T) zeroArgConstructor.newInstance());
        } catch (InstantiationException | InvocationTargetException e) {
            logger.warning("[CAN NOT INSTANTIATE] : " + tClass
                    + " - class may be an abstract class, an interface, "
                    + "array, primitive." + e.getMessage());
        } catch (IllegalAccessException e) {
            logger.warning("[CAN NOT INSTANTIATE] : " + tClass
                    + " - no access to instantiating object." + e.getMessage());
        }
        return null;
    }
77774
public Fachwert getFachwert(Class<? extends Fachwert> clazz, Object... args) {
        Class[] argTypes = toTypes(args);
        try {
            Constructor<? extends Fachwert> ctor = clazz.getConstructor(argTypes);
            return ctor.newInstance(args);
        } catch (ReflectiveOperationException ex) {
            Throwable cause = ex.getCause();
            if (cause instanceof ValidationException) {
                throw (ValidationException) cause;
            } else if (cause instanceof IllegalArgumentException) {
                throw new LocalizedValidationException(cause.getMessage(), cause);
            } else {
                throw new IllegalArgumentException("cannot create " + clazz + " with " + Arrays.toString(args), ex);
            }
        }
    }
850471
private static Object callConstructor(final Class<?> cls, final Class<?>[] argTypes,
      final Object[] args) {
    try {
      final Constructor<?> cons = cls.getConstructor(argTypes);
      return cons.newInstance(args);
    } catch (final InvocationTargetException e) {
      throw getCause(e);
    } catch (final IllegalAccessException | NoSuchMethodException | InstantiationException e) {
      throw new IllegalStateException(e);
    }
  }
733812
public <T> T execute(final Object[] args, final Class<T> clazz) {
        return execute(args, clazz, true);
    }
132808
public <T> T get(String key, Class<T> clazz, T defaultValue) {
        Object obj = argMap.get(key);
        if (obj == null) {
            return defaultValue;
        }
        return Reflection.toType(obj, clazz);
    }
821083
@Nonnull
	public <V extends T> LObjIntConsumerBuilder<T> aCase(Class<V> argC1, LObjIntConsumer<V> function) {
		PartialCase.The pc = partialCaseFactoryMethod((a1, a2) -> (argC1 == null || argC1.isInstance(a1)));

		pc.evaluate(function);
		return self();
	}
329261
private static CommandLineArgument findCommandLineOption(String arg) {
        for (CommandLineArgument commandLineArgument : CommandLineArgument.values()) {
            if (commandLineArgument.match(arg)) {
                return commandLineArgument;
            }
        }
        return null;
    }
942480
private static String getParameter(
		final String args[],
		final String name) {
		for (int i = 0; i < args.length; i++) {
			if (args[i].equals(name)) {
				if ((i + 1) < args.length) {
					return args[i + 1];
				} // end if

				break;
			} // end if
		} // end for

		return null;
	}
269676
@Nonnull
	public <V extends T> BinaryOperatorBuilder<T> aCase(Class<V> argC1, Class<V> argC2, BinaryOperator<V> function) {
		PartialCaseWithProduct.The pc = partialCaseFactoryMethod((a1, a2) -> (argC1 == null || argC1.isInstance(a1)) && (argC2 == null || argC2.isInstance(a2)));

		pc.evaluate(function);
		return self();
	}
645703
public <T> Clazz<T> Clazz( Class<T> clazz )
	{
		_ensureMap();

		@SuppressWarnings( "unchecked" )
		Clazz<T> res = (Clazz<T>) clazzz.get( clazz );
		if( res == null )
			throw new IllegalArgumentException( "Class not supported by ClassInfo : " + clazz.getName() );

		return res;
	}
1078121
public static Object getGenInstance(Class<?> cls, Object... args) throws ParserException
    {
        Class<?> parserClass = getGenClass(cls);
        try
        {
            if (args.length == 0)
            {
                return parserClass.newInstance();
            }
            else
            {
                for (Constructor constructor : parserClass.getConstructors())
                {
                    Class[] parameterTypes = constructor.getParameterTypes();
                    if (parameterTypes.length == args.length)
                    {
                        boolean match = true;
                        int index = 0;
                        for (Class c : parameterTypes)
                        {
                            if (!c.isAssignableFrom(args[index++].getClass()))
                            {
                                match = false;
                                break;
                            }
                        }
                        if (match)
                        {
                            return constructor.newInstance(args);
                        }
                    }
                }
                throw new IllegalArgumentException("no required constructor for "+cls);
            }
        }

        catch (InstantiationException | IllegalAccessException | SecurityException | IllegalArgumentException | InvocationTargetException ex)
        {
            throw new ParserException(ex);
        }
    }
56785
@SuppressWarnings("unchecked")
	public static <T, L extends LoggerInformer> L getLogger(Class<T> clazz) {
		return (L)SLF4JLoggerFactory.getLogger(clazz);
	}
444595
public static Object instantiate(Class clazz) throws InstantiationException
    {
        Object result = null;
        try
        {
            result = ClassHelper.newInstance(clazz);
        }
        catch(IllegalAccessException e)
        {
            try
            {
                result = ClassHelper.newInstance(clazz, true);
            }
            catch(Exception e1)
            {
                throw new ClassNotPersistenceCapableException("Can't instantiate class '"
                        + (clazz != null ? clazz.getName() : "null")
                        + "', message was: " + e1.getMessage() + ")", e1);
            }
        }
        return result;
    }
497311
public static void instanceOf(final Object arg, final Class<?> clazz, final String name) {
        
        if(arg == null) {
            throw new IllegalArgumentException(String.format("%s should not be null.", name));
        }
        
        if(!clazz.isAssignableFrom(arg.getClass())) {
            throw new IllegalArgumentException(String.format("%s should not be class with '%s'.", name, clazz.getName()));
        }
        
    }