Creates a new instance of an object of this domain.

@param <T> Class of domain object.
@param clazz Class of object to create.
@return The new domain object instance.
776929
public static <T> T newObject(Class<T> clazz) {
        return getFactory(clazz).newObject(clazz);
    }
166129
public static <V> CmsBeanTableBuilder<V> newInstance(Class<V> cls) {

        return new CmsBeanTableBuilder<V>(cls, null);

    }
1017896
public static <T> Clazz<T> Clazz( Class<T> clazz )
	{
		return impl.Clazz( clazz );
	}
637966
public void setUpToClass(final Class<?> clazz) {
        if (clazz != null) {
            final Object object = getObject();
            if (object != null && !clazz.isInstance(object)) {
                throw new IllegalArgumentException("Specified class is not a superclass of the object");
            }
        }
        this.upToClass = clazz;
    }
767278
public HTMLForm addClass(String clazz) {
        String currentClass = this.getProperty("class");
        if (currentClass != null) {
            currentClass += " " + clazz;
        } else {
            currentClass = clazz;
        }
        this.setProperty("class", currentClass);

        return this;
    }
781834
public static <T extends Entity<?>> T newInstance(final Class<T> clazz) {
    return meta.newInstance(clazz);
  }
512331
private <T> T get(Class<T> clazz) {
    try {
      return clazz.cast(get());
    } catch (ClassCastException e) {
      return null;
    }
  }
1280762
public static <T> T newInstance(Class<T> clazz) throws SofaRpcRuntimeException {
        if (clazz.isPrimitive()) {
            return (T) getDefaultPrimitiveValue(clazz);
        }

        T t = getDefaultWrapperValue(clazz);
        if (t != null) {
            return t;
        }

        try {
            // 普通类，如果是成员类（需要多传一个父类参数）
            if (!(clazz.isMemberClass() && !Modifier.isStatic(clazz.getModifiers()))) {
                try {
                    // 先找一个空的构造函数
                    Constructor<T> constructor = clazz.getDeclaredConstructor();
                    constructor.setAccessible(true);
                    return constructor.newInstance();
                } catch (Exception ignore) { // NOPMD
                }
            }
            // 不行的话，找一个最少参数的构造函数
            Constructor<T>[] constructors = (Constructor<T>[]) clazz.getDeclaredConstructors();
            if (constructors == null || constructors.length == 0) {
                throw new SofaRpcRuntimeException("The " + clazz.getCanonicalName()
                    + " has no default constructor!");
            }
            Constructor<T> constructor = constructors[0];
            if (constructor.getParameterTypes().length > 0) {
                for (Constructor<T> c : constructors) {
                    if (c.getParameterTypes().length < constructor.getParameterTypes().length) {
                        constructor = c;
                        if (constructor.getParameterTypes().length == 0) {
                            break;
                        }
                    }
                }
            }
            constructor.setAccessible(true);
            // 虚拟构造函数的参数值，基本类型使用默认值，其它类型使用null
            Class<?>[] argTypes = constructor.getParameterTypes();
            Object[] args = new Object[argTypes.length];
            for (int i = 0; i < args.length; i++) {
                args[i] = getDefaultPrimitiveValue(argTypes[i]);
            }
            return constructor.newInstance(args);
        } catch (SofaRpcRuntimeException e) {
            throw e;
        } catch (Throwable e) {
            throw new SofaRpcRuntimeException(e.getMessage(), e);
        }
    }
964830
protected final Definition bean(Class<?> clazz) {
    Definition def = new Definition(clazz.getName(), clazz, Scope.SINGLETON.toString());
    def.beanName = clazz.getName() + "#" + Math.abs(System.identityHashCode(def));
    return def;
  }
1075030
public Object newInstance(String clazz) {
        try {
            return Class.forName(clazz).newInstance();
        } catch (Exception e) {
            error(e);
            return null;
        }
    }
9837
public static <T> Clazz<T> FindClazz( Class<T> clazz )
	{
		return impl.FindClazz( clazz );
	}
962027
public C createObject(String className, Class clazz, DynamicInitializer<C> di) throws ClassNotFoundException {
        C object;
        try {
            object = (C) clazz.newInstance();

        } catch (InstantiationException ie) {
            String info = "Could not create " + description + " object: " + className
                    + ". Could not access object constructor: ";
            info += ie.getMessage();
            throw new ClassNotFoundException(info, ie);

        } catch (IllegalAccessException iae) {
            String info = "Could not create " + description + " object: " + className
                    + ". Could not instantiate object. Does the object classname refer to an abstract class, "
                    + "an interface or the like?: ";
            info += iae.getMessage();
            throw new ClassNotFoundException(info, iae);

        } catch (ClassCastException cce) {
            String info = "Could not create " + description + " object: " + className
                    + ". The specified object classname does not refer to the proper type: ";
            info += cce.getMessage();
            throw new ClassNotFoundException(info, cce);
        }

        // Initialize object
        if (null != di) {
            di.initialize(object);
        }

        return object;
    }
632823
public I getNewInstance(Class<I> clazz) {
        Constructor<I> ctor;
        try {
            ctor = clazz.getConstructor();
            return ctor.newInstance();
        } catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException
                | IllegalArgumentException | InvocationTargetException e) {
            throw new InitializationException("Given class not found", e);
        }
    }
1001025
public static <T extends AVObject> AVQuery<T> getQuery(Class<T> clazz) {
    return new AVQuery<T>(Transformer.getSubClassName(clazz), 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;
    }
682035
public static Xml exportClass(String clazz)
    {
        Check.notNull(clazz);

        final Xml node = new Xml(ATT_CLASS);
        node.setText(clazz);

        return node;
    }
818483
@Override
  public <T extends BaseProxy> T create(final Class<T> clazz) {
    this.checkLocked();

    final SimpleProxyId<T> id = this.state.requestFactory.allocateId(clazz);
    final AutoBean<T> created = this.createProxy(clazz, id, false);
    return this.takeOwnership(created);
  }