Examples of ConstantParameter


Examples of org.jquantlib.model.ConstantParameter

            throw new UnsupportedOperationException("Work in progress");
        }

        corrMatrix_ = new Matrix(size, size);
        factors = factors != 0 ? 0 : size;
        arguments_.set(0, new ConstantParameter(rho, new BoundaryConstraint(-1.0, 1.0)));
        arguments_.set(1, new ConstantParameter(beta, new PositiveConstraint()));
        generateArguments();
    }
View Full Code Here

Examples of org.picocontainer.defaults.ConstantParameter

    }

    private Touchable getTouchableFromSerializedContainer() throws IOException, ClassNotFoundException {
        MutablePicoContainer pico = createPicoContainerWithTouchableAndDependsOnTouchable();
        // Add a list too, using a constant parameter
        pico.registerComponentImplementation("list", ArrayList.class, new Parameter[]{new ConstantParameter(new Integer(10))});

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ObjectOutputStream oos = new ObjectOutputStream(baos);

        oos.writeObject(pico);
View Full Code Here

Examples of org.picocontainer.defaults.ConstantParameter

    // http://jira.codehaus.org/secure/ViewIssue.jspa?key=PICO-52
    public void testPico52() {
        MutablePicoContainer pico = createPicoContainer(null);

        pico.registerComponentImplementation("foo", JMSService.class, new Parameter[]{
            new ConstantParameter("0"),
            new ConstantParameter("something"),
        });
        JMSService jms = (JMSService) pico.getComponentInstance("foo");
        assertEquals("0", jms.serverid);
        assertEquals("something", jms.path);
    }
View Full Code Here

Examples of org.picocontainer.defaults.ConstantParameter

        ComponentAdapter hashMapAdapter = parent.registerComponent(new ConstructorInjectionComponentAdapter(HashMap.class, HashMap.class));
        ComponentAdapter hashSetAdapter = parent.registerComponent(new ConstructorInjectionComponentAdapter(HashSet.class, HashSet.class));
        ComponentAdapter stringAdapter = parent.registerComponent(new InstanceComponentAdapter(String.class, "foo"));
        ComponentAdapter arrayListAdapter = child.registerComponent(new ConstructorInjectionComponentAdapter(ArrayList.class, ArrayList.class));
        Parameter componentParameter = BasicComponentParameter.BASIC_DEFAULT;
        Parameter throwableParameter = new ConstantParameter(new Throwable("bar"));
        ComponentAdapter exceptionAdapter = child.registerComponent(new ConstructorInjectionComponentAdapter(Exception.class, Exception.class, new Parameter[]{
            componentParameter,
            throwableParameter
        }));
View Full Code Here

Examples of org.picocontainer.defaults.ConstantParameter

            new ComponentParameter("Two"),
            ComponentParameter.DEFAULT,
        });
        pico.registerComponentImplementation("MultiOneString", Multi.class, new Parameter[]{
            ComponentParameter.DEFAULT,
            new ConstantParameter(""),
        });
        pico.registerComponentImplementation("MultiOneInt", Multi.class, new Parameter[]{
            ComponentParameter.DEFAULT,
            new ConstantParameter(new Integer(5)),
        });
        pico.registerComponentImplementation("MultiNone", Multi.class, new Parameter[]{});
        pico.registerComponentImplementation(One.class);
        pico.registerComponentImplementation("Two", Two.class);
View Full Code Here

Examples of org.picocontainer.defaults.ConstantParameter

        final MutablePicoContainer mutablePicoContainer = new DefaultPicoContainer();
        final int size = (wrapperDependencies != null ? wrapperDependencies.length : 0) + 1;
        final Collection allComponentAdapters = picoContainer.getComponentAdapters();
        for (final Iterator iter = allComponentAdapters.iterator(); iter.hasNext();) {
            final Parameter[] parameters = new Parameter[size];
            parameters[0] = new ConstantParameter(iter.next());
            for (int i = 1; i < parameters.length; i++) {
                parameters[i] = new ConstantParameter(wrapperDependencies[i - 1]);
            }
            final MutablePicoContainer instantiatingPicoContainer = new DefaultPicoContainer(new ConstructorInjectionComponentAdapterFactory());
            instantiatingPicoContainer.registerComponentImplementation("decorator", decoratingComponentAdapterClass, parameters);
            mutablePicoContainer.registerComponent((ComponentAdapter) instantiatingPicoContainer.getComponentInstance("decorator"));
        }
View Full Code Here

Examples of org.picocontainer.defaults.ConstantParameter

        return createComponentAdapterWithSimpleTouchable();
    }

    protected ComponentAdapter prepDEF_isAbleToTakeParameters(MutablePicoContainer picoContainer) {
        return new ThreadLocalComponentAdapter(new ConstructorInjectionComponentAdapter(
                List.class, ArrayList.class, new Parameter[]{new ConstantParameter(new Integer(10))}));
    }
View Full Code Here

Examples of org.picocontainer.defaults.ConstantParameter

                String permissionClassName = childElement.getAttribute(CLASSNAME);
                String action = childElement.getAttribute(CONTEXT);
                String value = childElement.getAttribute(VALUE);
                MutablePicoContainer mpc = new DefaultPicoContainer();
                mpc.registerComponentImplementation(Permission.class, Class.forName(permissionClassName),new Parameter[] {new ConstantParameter(action), new ConstantParameter(value)});

                Permission permission = (Permission) mpc.getComponentInstanceOfType(Permission.class);
                classPathElement.grantPermission(permission);
            }
        }
View Full Code Here

Examples of org.picocontainer.defaults.ConstantParameter

    private Parameter createConstantParameter(PicoContainer pico, Element element) throws ClassNotFoundException, MalformedURLException {
        XMLComponentInstanceFactory factory = createComponentInstanceFactory(element.getAttribute(FACTORY));

        Element instanceElement = getFirstChildElement(element);
        Object instance = factory.makeInstance(pico, instanceElement, getClassLoader());
        return new ConstantParameter(instance);
    }
View Full Code Here

Examples of org.picocontainer.defaults.ConstantParameter

        }
        return parameters;
    }

    private Parameter toParameter(Object obj) {
        return obj instanceof Parameter ? (Parameter) obj : new ConstantParameter(obj);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.