Creates a new instance of the given class.
 Dio injects dependencies to the created instance.

 @param clazz [Class]
 @param args [Array]
 @return Instance of clazz
335769
def create(clazz, *args)
      raise ArgumentError, "#{clazz} is not a class" unless clazz.is_a?(Class)
      inject(clazz.new(*args))
    end
459182
@Override
    public ZuulFilter newInstance(Class clazz) throws InstantiationException, IllegalAccessException {
        return (ZuulFilter) clazz.newInstance();
    }
174107
public static <T> T newInstance(final Class<T> klazz) {
    try {
      return klazz.getConstructor().newInstance();
    } catch (Exception ex) {
      throw new Error(String.format("Can't create instance of %s for error %s", klazz.getCanonicalName(), ex.getMessage()), ex);
    }
  }
776929
public static <T> T newObject(Class<T> clazz) {
        return getFactory(clazz).newObject(clazz);
    }
718249
public static Object instantiateObject(Class<?> clazz) {
    try {
      Constructor<?> constructor = clazz.getConstructor();
      return constructor.newInstance();
    } catch (Exception exp) {
      throw new EntityManagerException(exp);
    }

  }
1098234
public C createObject(String className, Class clazz) throws ClassNotFoundException {
        return createObject(className, clazz, /* no dynamic init */ null);
    }
116748
public <T> T create(Class<T> clazz) {
        return create(clazz, new Class<?>[]{}, new Object[]{});
    }
1251430
public T newInstance(Object... args) {
                try {
                        con.setAccessible(true);
                        return con.newInstance(args);
                } catch (Exception e) {
                        throw $(e);
                }
        }
39498
def create(cls, this: str, super_: str=u'java/lang/Object') -> 'ClassFile':
        
        cf = ClassFile()
        cf.access_flags.acc_public = True
        cf.access_flags.acc_super = True

        cf.this = cf.constants.create_class(this)
        cf.super_ = cf.constants.create_class(super_)

        return cf
1180114
private Commandline _createCommandLine ()
  {
    /*
     * NOTE: This method is designed to work with plexus-utils:1.1 which is used
     * by all Maven versions before 2.0.6 regardless of our plugin dependency.
     * Therefore, we use setWorkingDirectory(String) rather than
     * setWorkingDirectory(File) and addArguments() rather than createArg().
     */

    final Commandline cli = new Commandline ();

    cli.setExecutable (this.executable);

    if (this.workingDirectory != null)
    {
      cli.setWorkingDirectory (this.workingDirectory.getAbsolutePath ());
    }

    final String classPath = _getClassPath ();
    if (classPath != null && classPath.length () > 0)
    {
      cli.addArguments (new String [] { "-cp", classPath });
    }

    if (this.mainClass != null && this.mainClass.length () > 0)
    {
      cli.addArguments (new String [] { this.mainClass });
    }

    cli.addArguments (_getArguments ());

    return cli;
  }
110378
public function produce(string $class, array $args, string $selector = Injector::DEFAULT_SELECTOR, Injector $injector)
    {
        $const_name = $class . '::WDI_NO_AUTO';
        if (defined($const_name) && constant($const_name) === true)
        {
            throw new DIException("Cannot instantiate $class because $class::WDI_NO_AUTO is true");
        }

        try
        {
            $reflect = new ReflectionClass($class);

            $instance = null;
            $dc = $reflect->getDocComment();
            if (!empty($dc))
            {
                $dc = new DocComment($dc);
                $gen = $dc->getAnnotationTokens("generator");
                if (!empty($gen))
                {
                    $instance = $this->attemptGeneratorMethod($gen, $class, $args, $selector, $injector);
                }
            }

            if (null === $instance)
            {
                $constructor = $reflect->getConstructor();
                if (null === $constructor)
                    return $reflect->newInstance();

                if (!$constructor->isPublic())
                    throw new DIException("Class $class does not have a public constructor");

                $constructor_args = $this->determineArgumentsFor($constructor, $class, "constructor", $args, $selector, $injector);
                $instance = $reflect->newInstanceArgs($constructor_args);
            }
        }
        catch (DIException $e)
        {
            throw new DIException("Could not instantiate class $class", 0, $e);
        }

        return $instance;
    }
515051
@SuppressWarnings("unchecked")
	private T createInstance(final String className, final Object... arguments) {
		try {
			Class<?> implementation = Class.forName(className, false, classLoader);
			if (service.isAssignableFrom(implementation)) {
				return (T) implementation.getDeclaredConstructor(argumentTypes).newInstance(arguments);
			} else {
				InternalLogger.log(Level.ERROR, "Class '" + className + "' does not implement servcie interface '" + service + "'");
			}
		} catch (ClassNotFoundException ex) {
			InternalLogger.log(Level.ERROR, "Service implementation '" + className + "' not found");
		} catch (NoSuchMethodException ex) {
			InternalLogger.log(Level.ERROR, "Service implementation '" + className + "' has no matching constructor");
		} catch (InstantiationException ex) {
			InternalLogger.log(Level.ERROR, "Service implementation '" + className + "' is not instantiable");
		} catch (IllegalAccessException ex) {
			InternalLogger.log(Level.ERROR, "Constructor of service implementation '" + className + "' is not accessible");
		} catch (IllegalArgumentException ex) {
			InternalLogger.log(Level.ERROR, "Illegal arguments for constructor of service implementation '" + className + "'");
		} catch (InvocationTargetException ex) {
			InternalLogger.log(Level.ERROR, ex.getTargetException(), "Failed creating service implementation '" + className + "'");
		}

		return null;
	}
395184
public <T> T execute(final String methodName, final Class<T> clazz, final Object... args) {
        return execute(methodName, clazz, true, args);
    }
987001
@SuppressWarnings("unchecked")
  public <T extends Entity<?>> T newInstance(final Class<T> clazz) {
    return (T) getEntityType(clazz).newInstance();
  }
940189
public static Converter<?, ?> constructConverter(Class<? extends Converter<?, ?>> clazz) {
		Constructor<? extends Converter<?, ?>> constructor;
		try {
			constructor = clazz.getConstructor();
		} catch (Exception e) {
			throw new IllegalArgumentException("Could not find public no-arg constructor for CSV converter class: "
					+ clazz, e);
		}
		try {
			return constructor.newInstance();
		} catch (Exception e) {
			throw new IllegalArgumentException("Could not construct new CSV converter: " + clazz, e);
		}
	}
781834
public static <T extends Entity<?>> T newInstance(final Class<T> clazz) {
    return meta.newInstance(clazz);
  }
355759
public static function instance($args = null)
    {
        $class = self::className();
        $instanceKey = self::instanceKey($args);

        if ( ! isset(self::$_instances[$instanceKey]))
        {
            self::$_instances[$instanceKey] = is_array($args) ? new $class($args) : new $class;
        }
        return self::$_instances[$instanceKey];
    }