Builds an action instance from given class.

@param cls action class.
@return instance of action.
511621
public Action build(Class<?> cls) {
        EdmAction edmAction = cls.getAnnotation(EdmAction.class);
        EdmReturnType edmReturnType = cls.getAnnotation(EdmReturnType.class);
        Set<Parameter> parameters = new HashSet<>();
        for (Field field : cls.getDeclaredFields()) {
            EdmParameter parameterAnnotation = field.getAnnotation(EdmParameter.class);
            if (parameterAnnotation != null) {

                String parameterName = isNullOrEmpty(parameterAnnotation.name())
                        ? field.getName() : parameterAnnotation.name();
                String parameterType = isNullOrEmpty(parameterAnnotation.type())
                        ? field.getType().getSimpleName() : parameterAnnotation.type();
                parameters.add(new ParameterImpl.Builder()
                        .setMaxLength(parameterAnnotation.maxLength())
                        .setName(parameterName)
                        .setNullable(parameterAnnotation.nullable())
                        .setPrecision(parameterAnnotation.precision())
                        .setScale(parameterAnnotation.scale())
                        .setSRID(parameterAnnotation.srid())
                        .setType(parameterType)
                        .setUnicode(parameterAnnotation.unicode())
                        .setJavaField(field)
                        .build());
            }
        }

        return new ActionImpl.Builder()
                .setName(getTypeName(edmAction, cls))
                .setNamespace(getNamespace(edmAction, cls))
                .setBound(edmAction.isBound())
                .setEntitySetPath(edmAction.entitySetPath())
                .setParameters(parameters)
                .setReturnType(edmReturnType.type())
                .setJavaClass(cls)
                .build();
    }
479627
public static Class<?> loadGenClass(Class<?> cls) throws ClassNotFoundException
    {
        Class<?> parserClass = map.get(cls);
        if (parserClass == null)
        {
            GenClassname genClassname = cls.getAnnotation(GenClassname.class);
            if (genClassname == null)
            {
                throw new IllegalArgumentException("@GenClassname not set in "+cls);
            }
            parserClass = Class.forName(genClassname.value());
            map.put(cls, parserClass);
        }
        return parserClass;
    }
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);
		}
	}
629180
@Override
	public ZooClass addClass(Class<?> cls) {
		DBTracer.logCall(this, cls);
    	checkValidity(true);
		return sm.createSchema(null, cls);
	}
1106089
public static <T> ActionPredicate<T> fromAction
	(final Action<T> action,
	 final boolean predicateResult) {
	
	return new ActionPredicate<T>() {
	    public boolean actionPredicate(T obj) {
		action.action(obj);
		return predicateResult;
	    }
	};
    }
557890
public static Collection<Field> fields(final Class<?> cls) {
		Map<String, Field> fieldMap = new HashMap<>();
		walkFields(cls, fieldMap);
		return fieldMap.values();
	}
28599
public static ClassLoader getClassLoader(Class<?> cls) {
        ClassLoader cl = cls.getClassLoader();
        if (cl == null) {
            cl = getClassLoader();
        }
        return cl;
    }
28341
public static Map<String, Method> getPropGetMethodList(final Class<?> cls) {
        Map<String, Method> getterMethodList = entityDeclaredPropGetMethodPool.get(cls);

        if (getterMethodList == null) {
            loadPropGetSetMethodList(cls);
            getterMethodList = entityDeclaredPropGetMethodPool.get(cls);
        }

        return getterMethodList;
    }
482785
protected static Object newInstance(String className) {
        ClassLoader cl = Thread.currentThread().getContextClassLoader();
        log.debug("Conversion utils classloader: {}", cl);
        Object instance = null;
        try {
            Class<?> clazz = cl.loadClass(className);
            instance = clazz.newInstance();
        } catch (Exception ex) {
            log.error("Error loading class: {}", className, ex);
        }
        return instance;
    }
166129
public static <V> CmsBeanTableBuilder<V> newInstance(Class<V> cls) {

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

    }
17945
public static Object createDynamicInstance(Class<?> cls) throws IOException
    {
        GenClassCompiler pc = GenClassCompiler.compile(El.getTypeElement(cls.getCanonicalName()), null);
        return pc.loadDynamic();
    }
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;
    }
1142402
public static <T> Codec<T> create(Class<T> cls) {
        return create(cls, false);
    }
707837
private static Object newInstance(Class<?> clazz) {
        Object instance = null;
        try {
            instance = clazz.newInstance();
        } catch (Exception ex) {
            log.error("Error loading class: {}", clazz.getName(), ex);
        }
        return instance;
    }
1128633
def BuildService(self, cls):
    

    # CallMethod needs to operate with an instance of the Service class. This
    # internal wrapper function exists only to be able to pass the service
    # instance to the method that does the real CallMethod work.
    def _WrapCallMethod(srvc, method_descriptor,
                        rpc_controller, request, callback):
      return self._CallMethod(srvc, method_descriptor,
                       rpc_controller, request, callback)
    self.cls = cls
    cls.CallMethod = _WrapCallMethod
    cls.GetDescriptor = staticmethod(lambda: self.descriptor)
    cls.GetDescriptor.__doc__ = "Returns the service descriptor."
    cls.GetRequestClass = self._GetRequestClass
    cls.GetResponseClass = self._GetResponseClass
    for method in self.descriptor.methods:
      setattr(cls, method.name, self._GenerateNonImplementedMethod(method))
611485
public T create(ActionContext actionContext) {
		try {
			T action;
			Class[] actionConstructorParams = actionConstructor.getParameterTypes();
			switch (actionConstructorParams.length) {
				case 0:
					action = actionConstructor.newInstance();
					break;
				case 1:
					if (actionConstructorParams[0].equals(ActionContext.class)) {
						action = actionConstructor.newInstance(actionContext);
					} else {
						throw new IllegalStateException("Unknown argument type in action constructor " + actionConstructorParams[0].getName());
					}
					break;
				default:
					throw new IllegalStateException("Invalid argument number in action constructor: " + actionConstructorParams.length);
			}
			return action;
		} catch (InstantiationException | InvocationTargetException | IllegalAccessException instantiationException) {
			throw new IllegalStateException("Failed to create action", instantiationException);
		}
	}
211714
public <T> Action1<T> getOnNextAction() {
    return new Action1<T>() {
      @Override
      public void call(T objectt) {
        if (operationTime == null) {
          operationTime = new Date().getTime();
        }
      }
    };
  }