Build a Singleton FXML item.

Each call to FXMLItem.get() will return the same FXML Component instance

@param fxmlParams the primitive values for the fxml resource

@return a new fresh FXML item
762125
public static FXMLItem create(final FXMLParams fxmlParams) {
        // Ensure that the uid will be unique at runtime
        return FXMLItemImpl.create(true).uid(fxmlIdGenerator.incrementAndGet()).set(fxmlParams);
    }
10914
public static <O extends Object> ParameterItem<O> create(final ObjectParameter<O> parameterParams) {
        // Ensure that the uid will be unique at runtime
        return (ParameterItem<O>) ParameterItemImpl.create(parameterParams.object()).uid(parameterIdGenerator.incrementAndGet()).set(parameterParams); // FIXME
    }
556315
public static Object buildObjectInstance(String classname, Object[] params) {
		Object rets = null;

		Class<?>[] paramTypes = new Class[params.length];
		for (int x = 0; x < params.length; x++) {
			paramTypes[x] = params[x].getClass();
		}

		try {
			Class<?> clazz = getClass(classname);
			rets = clazz.getConstructor(paramTypes).newInstance(params);

		} catch (Exception e) {
			throw new BundlingProcessException(e.getMessage() + " [The custom class " + classname
					+ " could not be instantiated, check wether it is available on the classpath and"
					+ " verify that it has a zero-arg constructor].\n" + " The specific error message is: "
					+ e.getClass().getName() + ":" + e.getMessage(), e);
		}
		return rets;
	}
1008000
private void ensureFxmlLoaderInitialized() {

		if (fxmlLoader != null) {
			return;
		}

		fxmlLoader = loadSynchronously(resource, bundle);
		presenterProperty.set(fxmlLoader.getController());
	}
991623
static RequestCreator<JmxListRequest> newCreator() {
        return new RequestCreator<JmxListRequest>() {
            /** {@inheritDoc} */
            public JmxListRequest create(Stack<String> pStack, ProcessingParameters pParams) throws MalformedObjectNameException {
                return new JmxListRequest(
                        prepareExtraArgs(pStack), // path
                        pParams);
            }

            /** {@inheritDoc} */
            public JmxListRequest create(Map<String, ?> requestMap, ProcessingParameters pParams)
                    throws MalformedObjectNameException {
                return new JmxListRequest(requestMap,pParams);
            }
        };
    }
1304677
@Override
    public Object create(ActionParameter argument, Context context, ParameterFactories engine) {
        Object object = createNewInstance(argument.getRawType(), context, engine);

        for (Method method : argument.getRawType().getMethods()) {
            if (method.getName().startsWith(SETTER_PREFIX)) {
                if (method.getParameterTypes().length != 1) {
                    LOGGER.warn("The class {} has a setter method called {} but with too many parameters to be " +
                                    "injected with the 'BeanParameter' annotation", argument.getRawType().getName(),
                            method.getName());
                    continue;
                }

                // Only 1 parameter
                Annotation[] annotation = method.getParameterAnnotations()[0];
                Class<?> typesOfParameter = method.getParameterTypes()[0];
                Type genericTypeOfParameter = method.getGenericParameterTypes()[0];
                ActionParameter parameter = ActionParameter.from(method, annotation, typesOfParameter,
                        genericTypeOfParameter);
                // An exception is thrown if we can't build the parameter object.
                Object value = Bindings.create(parameter, context, engine);
                if (value != null) {
                    inject(object, method, value);
                }
            }
        }
        return object;
    }
1081977
@SuppressWarnings("unchecked")
	public static <T> T get(Class<T> clazz, Object... params) {
		T obj = (T) pool.get(clazz);

		if (null == obj) {
			synchronized (Singleton.class) {
				obj = (T) pool.get(clazz);
				if (null == obj) {
					obj = ReflectUtil.newInstance(clazz, params);
					pool.put(clazz, obj);
				}
			}
		}

		return obj;
	}
833749
ParamBuilder getBuilderForParam(TypeMirror typeMirror) {
        ParamBuilder paramBuilder = typeBuilderMap.get(typeMirror);
        if (paramBuilder == null) {
            switch (typeMirror.getKind()) {
                case BOOLEAN:
                    paramBuilder = new BooleanParamBuilder(messager, null);
                    break;
                case BYTE:
                    paramBuilder = new ByteParamBuilder(messager, null);
                    break;
                case CHAR:
                    paramBuilder = new CharParamBuilder(messager, null);
                    break;
                case DOUBLE:
                    paramBuilder = new DoubleParamBuilder(messager, null);
                    break;
                case FLOAT:
                    paramBuilder = new FloatParamBuilder(messager, null);
                    break;
                case INT:
                    paramBuilder = new IntParamBuilder(messager, null);
                    break;
                case LONG:
                    paramBuilder = new LongParamBuilder(messager, null);
                    break;
                case SHORT:
                    paramBuilder = new ShortParamBuilder(messager, null);
                    break;
                case ARRAY:
                    paramBuilder = getBuilderForParam(((ArrayType) typeMirror).getComponentType());
                    break;
                case DECLARED:
                    TypeElement genericList = getGenericType(typeMirror);
                    if (genericList != null) {
                        paramBuilder = new ListOfParcelerParamBuilder(messager, null, genericList);
                    } else if (typeUtils.isAssignable(typeMirror, stringTypeMirror)) {
                        paramBuilder = new StringParamBuilder(messager, null);
                    } else if (typeUtils.isAssignable(typeMirror, charSequenceTypeMirror)) {
                        paramBuilder = new CharSequenceParamBuilder(messager, null);
                    } else if (typeUtils.isAssignable(typeMirror, listTypeMirror) || typeMirror.toString().equals("java.util.List<java.lang.String>")) {
                        paramBuilder = new ListParamBuilder(messager, null);
                    } else if (typeUtils.isAssignable(typeMirror, mapTypeMirror)) {
                        paramBuilder = new MapParamBuilder(messager, null);
                    } else if (typeUtils.isAssignable(typeMirror, parcellableTypeMirror)) {
                        paramBuilder = new ParcellableParamBuilder(messager, null);
                    } else {
                        String typeName = typeMirror.toString();
                        int templateStart = typeName.indexOf('<');
                        if (templateStart != -1) {
                            typeName = typeName.substring(0, templateStart).trim();
                        }
                        TypeElement typeElement = elementUtils.getTypeElement(typeName);
                        if (typeElement != null) {
                            if (typeElement.getKind() == ElementKind.INTERFACE && typeElement.getAnnotation(Remoter.class) != null) {
                                paramBuilder = new BinderParamBuilder(messager, null);
                            } else if (parcelClass != null && typeElement.getAnnotation(parcelClass) != null) {
                                paramBuilder = new ParcelerParamBuilder(messager, null);
                            }
                        }
                    }
                    break;
            }
            if (paramBuilder != null) {
                paramBuilder.setBindingManager(this);
                typeBuilderMap.put(typeMirror, paramBuilder);
            } else {
                paramBuilder = new GenericParamBuilder(messager, null);
                paramBuilder.setBindingManager(this);
                typeBuilderMap.put(typeMirror, paramBuilder);
            }
        }
        return paramBuilder;
    }
467659
public static <T> T newInstance(Class clazz, Object... args) {

        if (clazz == null) return null;

        Class[] argsClass = getArgsClasses(args);

        try {
            Constructor<T> constructor = clazz.<T>getConstructor(argsClass);
            return constructor.newInstance(args);
        } catch (InstantiationException | InvocationTargetException | NoSuchMethodException | IllegalAccessException e) {
            throw new IllegalStateException(e.getMessage(), e);
        }
    }
683920
Parameter getCreateParameter(String name) {
		if (this.parameters == null)
			this.parameters = new HashMap<String, Parameter>();
		Parameter param = this.parameters.get(name);
		if (param == null) {
			param = new Parameter(name);
			this.parameters.put(name, param);
		}
		return param;
	}
374068
public static Scene loadFxml(URL url) throws IOException {
        logger.info("load fxml from url: " + url);
        BorderPane root = FXMLLoader.load(url);
        return new Scene(root);
    }
367393
private List<Node> createStringsFromParamList(Node params) {
    Node param = params.getFirstChild();
    ArrayList<Node> names = new ArrayList<>();
    while (param != null) {
      if (param.isName()) {
        names.add(IR.string(param.getString()).srcref(param));
      } else if (param.isDestructuringPattern()) {
        compiler.report(JSError.make(param,
            INJECTED_FUNCTION_HAS_DESTRUCTURED_PARAM));
        return new ArrayList<>();
      } else if (param.isDefaultValue()) {
        compiler.report(JSError.make(param,
            INJECTED_FUNCTION_HAS_DEFAULT_VALUE));
        return new ArrayList<>();
      }
      param = param.getNext();
    }
    return names;
  }
255605
public BranchingFactorGraph buildConnectedComponent(VariableNumMap vars) {
    // Not implemented for branching graphs.
    Preconditions.checkState(isRoot && children.size() == 0);

    FactorGraph componentFactorGraph = FactorGraph.getConnectedComponent(vars, variableFactorMap,
        factorVariableMap, variables, factors, factorNames, VariableNumMap.EMPTY, Assignment.EMPTY, null);

    return new BranchingFactorGraph(componentFactorGraph.conditional(assignment), Lists.<ChildBfg>newArrayList());
  }
9997
@Override
    public final Object instantiateItem(final ViewGroup container, final int position) {
        if (Constants.DEBUG) {
            Log.i("InfiniteViewPager", String.format("instantiating position %s", position));
        }
        final PageModel<T> model = createPageModel(position);
        mPageModels[position] = model;
        container.addView(model.getParentView());
        return model;
    }
824891
public static MessageItem create(final Message messageParams) {
        // Ensure that the uid will be unique at runtime
        return MessageItemImpl.create().uid(messageIdGenerator.incrementAndGet()).set(messageParams);
    }
186690
public Parameter<T> build() {
    if (this.name == null) {
      throw new IllegalArgumentException("Name is missing.");
    }
    if (this.type == null) {
      throw new IllegalArgumentException("Type is missing.");
    }
    if (this.applicationId == null) {
      throw new IllegalArgumentException("Application id is missing.");
    }
    return new Parameter<T>(
        this.name,
        this.type,
        this.applicationId,
        this.defaultOsgiConfigProperty,
        this.defaultValue,
        ImmutableValueMap.copyOf(this.properties));
  }
1350347
private FXMLView getFXMLAnnotation() {
		final Class<? extends AbstractFxmlView> theClass = this.getClass();
		final FXMLView annotation = theClass.getAnnotation(FXMLView.class);
		return annotation;
	}