Create a new Point Build build to create a new Point in a fluent manner from a POJO.

@param clazz Class of the POJO
@return the Builder instance
172624
public static Builder measurementByPOJO(final Class<?> clazz) {
    Objects.requireNonNull(clazz, "clazz");
    throwExceptionIfMissingAnnotation(clazz, Measurement.class);
    String measurementName = findMeasurementName(clazz);
    return new Builder(measurementName);
  }
1274493
public static AtomixBuilder builder(AtomixConfig config, ClassLoader classLoader) {
    return new AtomixBuilder(config, AtomixRegistry.registry(classLoader));
  }
363753
public String build(Class<?> clazz) {
		String packageName = clazz.getPackage().getName();
		String formattedPackageName = packageName.replace(".", "/");
		return formattedPackageName + "/" + clazz.getSimpleName()
				+ "-BeanohContext.xml";
	}
459182
@Override
    public ZuulFilter newInstance(Class clazz) throws InstantiationException, IllegalAccessException {
        return (ZuulFilter) clazz.newInstance();
    }
1175277
public static Builder builder() {
    return new AutoValue_MapboxDirections.Builder()
      .baseUrl(Constants.BASE_API_URL)
      .profile(DirectionsCriteria.PROFILE_DRIVING)
      .user(DirectionsCriteria.PROFILE_DEFAULT_USER)
      .geometries(DirectionsCriteria.GEOMETRY_POLYLINE6);
  }
753558
public static JobBuilder newJobBuilder(Class<? extends Job> jobClass) {

    JobBuilder b = new JobBuilder();
    b.ofType(jobClass);
    return b;
  }
853941
public static <T> JsonCodec<T> create(Class<T> clazz) {
    return new JsonCodec<T>(clazz, DefaultGsonHolder.INSTANCE);
  }
376018
@SuppressWarnings("unchecked")
    public static <T> Constructor<T>[] collectConstructors(Class<T> clazz) {
        return (Constructor<T>[]) clazz.getConstructors();
    }
1045706
public static Object constructByNamedParams(Class clazz, Map params) throws Exception {
        Object obj = clazz.getConstructor().newInstance();

        Method[] allMethods = clazz.getMethods();
        for(Method method : allMethods) {
            if(method.getName().startsWith("set")) {
                Object [] o = new Object [1];
                String propertyName = Introspector.decapitalize(method.getName().substring(3));
                if (params.containsKey(propertyName)) {
                    o[0] = params.get(propertyName);
                    method.invoke(obj, o);
                }
            }
        }
        return obj;
    }
957071
public static <T> Supplier<T> newInstance(Class<T> clazz, Object... parameters) {
        return new ClassConstructorNewInstanceSupplier<T>(clazz, parameters);
    }
65536
public Object createObject(String className, Class clazz) throws ClassNotFoundException {
        Object object;
        try {
            object = 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);
        }

        return object;
    }
472420
public PojoBuilder withCompleteConstructor() {
		pojoCreationCheck();

		// first we need to check if there are any fields to add to constructor
		// because default constructor (without fields) is already present
		Map<String, JFieldVar> nonTransientAndNonStaticFields = getNonTransientAndNonStaticFields();

		// if nonTransientAndNonStaticFields is not empty
		if (!Optional.ofNullable(nonTransientAndNonStaticFields).map(Map::isEmpty).orElse(true)) {
			// Create complete constructor
			JMethod constructor = this.pojo.constructor(JMod.PUBLIC);
			Map<String, JVar> superParametersToAdd = getSuperParametersToAdd(this.pojo);
			addSuperConstructorInvocation(constructor, superParametersToAdd);
			constructor.javadoc().add("Creates a new " + this.pojo.name() + ".");

			Iterator<Map.Entry<String, JFieldVar>> iterator = nonTransientAndNonStaticFields.entrySet().iterator();

			while (iterator.hasNext()) {
				Map.Entry<String, JFieldVar> pair = iterator.next();

				constructor.param(pair.getValue().type(), pair.getKey());
				constructor.body().assign(JExpr._this().ref(pair.getKey()), JExpr.ref(pair.getKey()));
			}
		}

		return this;
	}
95727
public static <T extends JsonBuilder> T create(Class<T> clz, String payload) {
    T ret = create(clz);
    ret.load(payload);
    return ret;
  }
261373
protected List<ResultConfig> buildResultConfigs(Class<?> clazz, PackageConfig.Builder pcb) {
    List<ResultConfig> configs = CollectUtils.newArrayList();
    // load annotation results
    Result[] results = new Result[0];
    Results rs = clazz.getAnnotation(Results.class);
    if (null == rs) {
      org.beangle.struts2.annotation.Action an = clazz
          .getAnnotation(org.beangle.struts2.annotation.Action.class);
      if (null != an) results = an.results();
    } else {
      results = rs.value();
    }
    Set<String> annotationResults = CollectUtils.newHashSet();
    if (null != results) {
      for (Result result : results) {
        String resultType = result.type();
        if (Strings.isEmpty(resultType)) resultType = "dispatcher";
        ResultTypeConfig rtc = pcb.getResultType(resultType);
        ResultConfig.Builder rcb = new ResultConfig.Builder(result.name(), rtc.getClassName());
        if (null != rtc.getDefaultResultParam()) rcb.addParam(rtc.getDefaultResultParam(), result.location());
        configs.add(rcb.build());
        annotationResults.add(result.name());
      }
    }

    // load ftl convension results
    if (!preloadftl || null == profileService) return configs;
    String extention = profileService.getProfile(clazz.getName()).getViewExtension();
    if (!extention.equals("ftl")) return configs;
    ResultTypeConfig rtc = pcb.getResultType("freemarker");
    for (Method m : clazz.getMethods()) {
      String methodName = m.getName();
      if (!annotationResults.contains(methodName) && shouldGenerateResult(m)) {
        String path = templateFinder.find(clazz, methodName, methodName, extention);
        if (null != path) {
          configs.add(new ResultConfig.Builder(m.getName(), rtc.getClassName())
              .addParam(rtc.getDefaultResultParam(), path).build());
        }
      }
    }
    return configs;
  }
167721
public static <T> Instantiator<T> newInstantiator(Class<T> clazz)
    {
        final Constructor<T> constructor = getConstructor(clazz);
        if(constructor == null)
        {
            // non-sun jre
            if(newInstanceFromObjectInputStream == null)
            {
                if(objectConstructorId == -1)
                    throw new RuntimeException("Could not resolve constructor for " + clazz);

                return new Android3Instantiator<T>(clazz);
            }
            
            return new Android2Instantiator<T>(clazz);
        }
        
        return new DefaultInstantiator<T>(constructor);
    }
1133911
public static Constructor<?> getEmptyConstructor(Class<?> clazz) {
        Constructor<?> c = clazz.getDeclaredConstructors()[0];
        for (int i = 0; i < clazz.getDeclaredConstructors().length; i++) {
            if (clazz.getDeclaredConstructors()[i].getParameterTypes().length < 1) {
                c = clazz.getDeclaredConstructors()[i];
                break;
            }
        }

        return c;
    }
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);
        }
    }