Package org.apache.hivemind.service

Examples of org.apache.hivemind.service.MethodSignature


    {
        MethodIterator mi = new MethodIterator(commandInterface);

        while (mi.hasNext())
        {
            MethodSignature sig = mi.next();

            addMethod(cf, commandInterface, sig);
        }

        if (!mi.getToString())
View Full Code Here


        cf.addMethod(Modifier.PUBLIC, sig, builder.toString());
    }

    void addToString(ClassFab cf)
    {
        MethodSignature sig = new MethodSignature(String.class, "toString", null, null);

        cf.addMethod(Modifier.PUBLIC, sig, "return _toString;");
    }
View Full Code Here

        cf.addConstructor(new Class[]
        { StrategyRegistry.class }, null, "_registry = $1;");

        // TODO: Should we add a check for $1 == null?

        cf.addMethod(Modifier.PRIVATE, new MethodSignature(serviceInterface, "_getStrategy",
                new Class[]
                { Object.class }, null), "return (" + serviceInterface.getName()
                + ") _registry.getStrategy($1.getClass());");

        MethodIterator i = new MethodIterator(serviceInterface);

        while (i.hasNext())
        {
            MethodSignature sig = i.next();

            if (proper(sig))
            {
                addAdaptedMethod(cf, sig);
            }
View Full Code Here

    private void addClearCachedMethod(ClassFab classFab)
    {
        classFab.addMethod(
            Modifier.PROTECTED,
            new MethodSignature(void.class, "_clearCachedReferences", null, null),
            "_remote = null;");
    }
View Full Code Here

        builder.end();

        classFab.addMethod(
            Modifier.SYNCHRONIZED + Modifier.PRIVATE,
            new MethodSignature(
                remoteInterface,
                "_lookupRemote",
                null,
                new Class[] { RemoteException.class }),
            builder.toString());
View Full Code Here

        Method[] methods = target.getMethods();

        for (int i = 0; i < methods.length; i++)
        {
            if (methods[i].getName().equals(name))
                return new MethodSignature(methods[i]);
        }

        unreachable();
        return null;
    }
View Full Code Here

    private void assertPosition(String methodName, int expected)
    {
        FilterMethodAnalyzer a = new FilterMethodAnalyzer(SampleService.class);

        MethodSignature ms = find(SampleService.class, methodName);
        MethodSignature fms = find(SampleFilter.class, methodName);

        assertEquals(expected, a.findServiceInterfacePosition(ms, fms));
    }
View Full Code Here

    }

    /** @since 1.1 */
    private void tryAddNoOpMethod(Class returnClass, String expectedBody)
    {
        MethodSignature sig = new MethodSignature(returnClass, "run", null, null);

        MockControl control = newControl(ClassFab.class);
        ClassFab cf = (ClassFab) control.getMock();
        MethodFab mf = (MethodFab) newMock(MethodFab.class);

View Full Code Here

        // service implementation.

        classFab.addField("_inner", getConfigurationType());
        classFab.addMethod(
                Modifier.PUBLIC | Modifier.SYNCHRONIZED | Modifier.FINAL,
                new MethodSignature(void.class, "_setInner", new Class[]
                { getConfigurationType() }, null),
                "{ _inner = $1; }");

        BodyBuilder builder = new BodyBuilder();
        builder.begin();

        builder.addln("return _inner;");
        builder.end();

        classFab.addMethod(Modifier.PRIVATE, new MethodSignature(getConfigurationType(), "_getInner",
                null, null), builder.toString());

        proxyBuilder.addServiceMethods("_getInner()", false);

        // The toString calls the toString method of the configuration if it is
        // created already
        // TODO: Implement like described
//        String proxyToStringMessage = "<LazyConstructionProxy for "
//            + getExtensionPointId() + "(" + configurationInterface.getName() + ")>";
        builder.clear();
        builder.begin();
        builder.addln(" return _inner.toString();");
        builder.end();

        MethodSignature toStringSignature = new MethodSignature(String.class, "toString", null,
                null);
        if (!classFab.containsMethod(toStringSignature)) {
            classFab.addMethod(Modifier.PUBLIC, toStringSignature, builder.toString());
        }
View Full Code Here

        body.end();

        classFab.addMethod(
                Modifier.PRIVATE | Modifier.FINAL | Modifier.SYNCHRONIZED,
                new MethodSignature(getConfigurationType(), "_configuration", null, null),
                body.toString());

        builder.addServiceMethods("_configuration()");

        // Build the implementation of interface SingletonInnerProxy

        body.clear();
        body.begin();

        body.add("_configuration();");

        body.end();

        classFab.addMethod(Modifier.PUBLIC | Modifier.FINAL, new MethodSignature(void.class,
                "_instantiateServiceImplementation", null, null), body.toString());

        classFab.addInterface(SingletonInnerProxy.class);

        return classFab.createClass();
View Full Code Here

TOP

Related Classes of org.apache.hivemind.service.MethodSignature

Copyright © 2018 www.massapicom. 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.