Examples of JavaMethod


Examples of com.thoughtworks.qdox.model.JavaMethod

        public ValueObjectFieldMetadata(Type propertyType, String propertyName, int metaFlags) {
            this.metaFlags = metaFlags;
            this.property = new BeanProperty(propertyName);
            this.property.setType(propertyType);
            JavaMethod getter = new JavaMethod(propertyType, getGetterName(this.property));
            JavaMethod setter = new JavaMethod(propertyType, getSetterName(this.property));
            setter.setParameters(new JavaParameter[] {new JavaParameter(propertyType, propertyName)});
            this.property.setAccessor(getter);
            this.property.setMutator(setter);
        }
View Full Code Here

Examples of com.thoughtworks.qdox.model.JavaMethod

        if (!shouldGenerate(metadata)) {
            return null;
        }

        JavaField field;
        JavaMethod method;
        JavaClass retVal = createDynamicJavaClass(getDestinationClassname(metadata),
                getDestinationPackage(metadata), null, getMetadataProvider());
        retVal.setModifiers(new String[] { "public" });
        if (getEjbUtils().isMessageDrivenBean(metadata)) {
            field = new JavaField(new Type(String.class.getName()), "DESTINATION_JNDI_NAME");
            field.setModifiers(new String[] { "private", "final", "static" });
            retVal.addField(field);
            field = new JavaField(new Type(String.class.getName()), "CONNECTION_FACTORY_JNDI_NAME");
            field.setModifiers(new String[] { "private", "final", "static" });
            retVal.addField(field);
        }
        if (isCachehomes()) {
            if (getEjbUtils().isMessageDrivenBean(metadata)) {
                field = new JavaField(new Type("javax.jms.Queue"), "cachedQueue");
                field.setModifiers(new String[] { "private", "static" });
                retVal.addField(field);
                field = new JavaField(new Type("javax.jms.QueueConnectionFactory"), "cachedConnectionFactory");
                field.setModifiers(new String[] { "private", "static" });
                retVal.addField(field);
            } else {
                if (hasRemoteView(metadata)) {
                    field = new JavaField(new Type(getRemoteHomeInterfacePlugin().getVirtualType(metadata)
                            .toString()), "cachedRemoteHome");
                    field.setModifiers(new String[] { "private", "static" });
                    retVal.addField(field);
                }
                if (hasLocalView(metadata)) {
                    field = new JavaField(new Type(getLocalHomeInterfacePlugin().getVirtualType(metadata)
                            .toString()), "cachedHome");
                    field.setModifiers(new String[] { "private", "static" });
                    retVal.addField(field);
                }
            }
        }

        method = new JavaMethod(getDestinationClassname(metadata));
        method.setConstructor(true);
        method.setModifiers(new String[] { "private" });
        retVal.addMethod(method);

        if (getEjbUtils().isMessageDrivenBean(metadata)) {
            method = new JavaMethod("getQueue");
            method.setModifiers(new String[] { "public", "static" });
            method.setExceptions(new Type[] { new Type("javax.naming.NamingException") });
            method.setReturns(new Type("javax.jms.Queue"));
            retVal.addMethod(method);
            method = new JavaMethod("getQueue");
            method.setModifiers(new String[] { "public", "static" });
            method.setParameters(new JavaParameter[] { new JavaParameter(new Type("java.util.Hashtable"),
                    "environment") });
            method.setExceptions(new Type[] { new Type("javax.naming.NamingException") });
            method.setReturns(new Type("javax.jms.Queue"));
            retVal.addMethod(method);
            method = new JavaMethod("getQueueConnection");
            method.setModifiers(new String[] { "public", "static" });
            method.setExceptions(new Type[] { new Type("javax.naming.NamingException"),
                    new Type("javax.jms.JMSException") });
            method.setReturns(new Type("javax.jms.QueueConnection"));
            retVal.addMethod(method);
            method = new JavaMethod("getQueueConnection");
            method.setModifiers(new String[] { "public", "static" });
            method.setParameters(new JavaParameter[] { new JavaParameter(new Type("java.util.Hashtable"),
                    "environment") });
            method.setExceptions(new Type[] { new Type("javax.naming.NamingException"),
                    new Type("javax.jms.JMSException") });
            method.setReturns(new Type("javax.jms.QueueConnection"));
            retVal.addMethod(method);
        } else {
            if (hasRemoteView(metadata)) {
                method = new JavaMethod("getHome");
                method.setModifiers(new String[] { "public", "static" });
                method.setExceptions(new Type[] { new Type("javax.naming.NamingException") });
                method
                        .setReturns(new Type(getRemoteHomeInterfacePlugin().getVirtualType(metadata)
                                .toString()));
                retVal.addMethod(method);
                method = new JavaMethod("getHome");
                method.setModifiers(new String[] { "public", "static" });
                method.setParameters(new JavaParameter[] { new JavaParameter(new Type("java.util.Hashtable"),
                        "env") });
                method.setExceptions(new Type[] { new Type("javax.naming.NamingException") });
                method
                        .setReturns(new Type(getRemoteHomeInterfacePlugin().getVirtualType(metadata)
                                .toString()));
                retVal.addMethod(method);
            }
            if (hasLocalView(metadata)) {
                method = new JavaMethod("getLocalHome");
                method.setModifiers(new String[] { "public", "static" });
                method.setExceptions(new Type[] { new Type("javax.naming.NamingException") });
                method
                        .setReturns(new Type(getLocalHomeInterfacePlugin().getVirtualType(metadata)
                                .toString()));
                retVal.addMethod(method);
                method = new JavaMethod("getLocalHome");
                method.setModifiers(new String[] { "public", "static" });
                method.setParameters(new JavaParameter[] { new JavaParameter(new Type("java.util.Hashtable"),
                        "env") });
                method.setExceptions(new Type[] { new Type("javax.naming.NamingException") });
                method
                        .setReturns(new Type(getLocalHomeInterfacePlugin().getVirtualType(metadata)
                                .toString()));
                retVal.addMethod(method);
            }
            method = new JavaMethod("lookupHome");
            method.setModifiers(new String[] { "private", "static" });
            method.setParameters(new JavaParameter[] {
                    new JavaParameter(new Type("java.util.Hashtable"), "env"),
                    new JavaParameter(new Type("java.lang.String"), "jndiName"),
                    new JavaParameter(new Type("java.lang.Class"), "narrowTo") });
            method.setExceptions(new Type[] { new Type("javax.naming.NamingException") });
            method.setReturns(new Type("java.lang.Object"));
            retVal.addMethod(method);
        }

        method = new JavaMethod("lookup");
        method.setModifiers(new String[] { "public", "static" });
        method.setParameters(new JavaParameter[] { new JavaParameter(new Type("java.util.Hashtable"), "env"),
                new JavaParameter(new Type("java.lang.String"), "jndiName") });
        method.setExceptions(new Type[] { new Type("javax.naming.NamingException") });
        method.setReturns(new Type("java.lang.Object"));
        retVal.addMethod(method);

        if (isIncludeGUID()) {
            method = new JavaMethod("generateGUID");
            method.setModifiers(new String[] { "public", "final", "static" });
            method.setParameters(new JavaParameter[] {

            new JavaParameter(new Type("java.lang.Object"), "o") });

            method.setReturns(new Type("java.lang.String"));
            retVal.addMethod(method);
            field = new JavaField(new Type("java.lang.String"), "hexServerIP");
            field.setModifiers(new String[] { "private", "static" });
            retVal.addField(field);
            field = new JavaField(new Type("java.security.SecureRandom"), "seeder");
            field.setModifiers(new String[] { "private", "final", "static" });
            retVal.addField(field);
            method = new JavaMethod("hexFormat");
            method.setModifiers(new String[] { "private", "static" });
            method.setParameters(new JavaParameter[] {

            new JavaParameter(new Type("byte", 1), "value"), new JavaParameter(new Type("int"), "length") });

            method.setReturns(new Type("java.lang.String"));
            retVal.addMethod(method);
            method = new JavaMethod("hexFormat");
            method.setModifiers(new String[] { "private", "static" });
            method.setParameters(new JavaParameter[] {

            new JavaParameter(new Type("int"), "value"), new JavaParameter(new Type("int"), "length") });

            method.setReturns(new Type("java.lang.String"));
            retVal.addMethod(method);
        }

        return new JavaClass[] { retVal };
    }
View Full Code Here

Examples of com.thoughtworks.qdox.model.JavaMethod

        // Select all public abstract methods started by "ejbSelect" with a non-void
        // return type
        return CollectionUtils.select(Arrays.asList(clazz.getMethods(true)),
            new Predicate() {
                public boolean evaluate(Object object) {
                    JavaMethod method = (JavaMethod) object;
                    int methodType = getMethodType(method);
                    boolean retVal = hasFlag(methodType, IFACE_METHOD_SELECT);
                    retVal = retVal && method.isAbstract();
                    retVal = retVal && method.isPublic();
                    return retVal;
                }
            });
    }
View Full Code Here

Examples of com.thoughtworks.qdox.model.JavaMethod

    public JavaMethod getMethodBySignature(String signature) {
        Matcher matcher = methodPattern.matcher(signature);

        if (matcher.matches()) {
            JavaMethod method = new JavaMethod(new Type(matcher.group(1)), matcher.group(2));

            // Now let's find out the arguments
            matcher = paramPattern.matcher(matcher.group(3));
            int beginIdx = 0;
            int count = 0;
            String paramType = null;
            String paramName = null;
            List paramLst = new ArrayList();

            while (matcher.find(beginIdx)) {
                int paramDim = 0;

                if (matcher.group(1) != null) {
                    paramType = matcher.group(2) + (matcher.group(4) != null ? matcher.group(4) : "");
                    paramName = matcher.group(3);
                } else {
                    paramType = matcher.group(6);
                    paramName = "_arg" + (count++);
                }

                // Now we need to parse paramType for it's dimensions
                Matcher dMatcher = dimensionPattern.matcher(paramType);

                if (dMatcher.find()) {
                    paramType = paramType.substring(0, dMatcher.start());
                    paramDim = 1;

                    while (dMatcher.find(dMatcher.end())) {
                        paramDim++;
                    }
                }

                paramLst.add(new JavaParameter(new Type(paramType, paramDim), paramName));
                beginIdx = matcher.end();
            }

            method.setParameters((JavaParameter[]) paramLst.toArray(new JavaParameter[0]));
            return method;
        }

        throw new Error("Invalid finder signature '" + signature + "'");
    }
View Full Code Here

Examples of com.thoughtworks.qdox.model.JavaMethod

            case IFACE_METHOD_HOME:
                removeString = "ejbHome";
                break;
        }

        JavaMethod retVal = method;

        if (removeString != null) {
            retVal = removeFromMethodName(method, removeString);
        }
View Full Code Here

Examples of com.thoughtworks.qdox.model.JavaMethod

            retLst.addAll(MethodPermission.unroll(permType, permTag.getRoleNames()));
        }

        // Now let's dig into method level ejb.permission tags
        JavaMethod[] methods = javaClass.getMethods();
        JavaMethod method;

        for (int j = 0; j < methods.length; j++) {
            tags = (method = methods[j]).getTagsByName(TagLibrary.EJB_PERMISSION);

            for (int k = 0; k < tags.length; k++) {
View Full Code Here

Examples of com.thoughtworks.qdox.model.JavaMethod

        throws Exception
    {
        final DNAAttributeInterceptor interceptor = new DNAAttributeInterceptor();
        final Attribute attribute = new Attribute( "ignored" );
        final Attribute result =
            interceptor.processMethodAttribute( new JavaMethod(), attribute );
        assertNotNull( "attribute", result );
        assertEquals( "attribute.name", "ignored", result.getName() );
        assertEquals( "attribute.value", null, result.getValue() );
        assertEquals( "attribute.parameterCount", 0, result.getParameterCount() );
    }
View Full Code Here

Examples of com.thoughtworks.qdox.model.JavaMethod

        throws Exception
    {
        final DNAAttributeInterceptor interceptor = new DNAAttributeInterceptor();
        final Attribute attribute = new Attribute( "ignored" );
        final Attribute result =
            interceptor.processMethodAttribute( new JavaMethod(), attribute );
        assertNotNull( "attribute", result );
        assertEquals( "attribute.name", "ignored", result.getName() );
        assertEquals( "attribute.value", null, result.getValue() );
        assertEquals( "attribute.parameterCount", 0, result.getParameterCount() );
    }
View Full Code Here

Examples of com.thoughtworks.qdox.model.JavaMethod

        final DNAAttributeInterceptor interceptor = new DNAAttributeInterceptor();

        final MockJavaClass clazz = new MockJavaClass();
        clazz.setName( "Blah" );

        final JavaMethod javaMethod = new JavaMethod();
        javaMethod.setParentClass( clazz );
        final Attribute attribute = new Attribute( "dna.configuration" );
        final Attribute result =
            interceptor.processMethodAttribute( javaMethod, attribute );
        assertNotNull( "attribute", result );
        assertEquals( "attribute.name", "dna.configuration", result.getName() );
View Full Code Here

Examples of com.thoughtworks.qdox.model.JavaMethod

        final DNAAttributeInterceptor interceptor = new DNAAttributeInterceptor();

        final MockJavaClass clazz = new MockJavaClass();
        clazz.setName( "Blah" );

        final JavaMethod javaMethod = new JavaMethod();
        javaMethod.setParentClass( clazz );
        final Attribute attribute = new Attribute( "dna.parameters" );
        final Attribute result =
            interceptor.processMethodAttribute( javaMethod, attribute );
        assertNotNull( "attribute", result );
        assertEquals( "attribute.name", "dna.parameters", result.getName() );
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.