Examples of JavaMethod


Examples of com.thoughtworks.qdox.model.JavaMethod

     *
     * @see org.jibx.binding.model.IClassItem#getReturnJavaDoc()
     */
    public String getReturnJavaDoc() {
        if (isMethod()) {
            JavaMethod jm = (JavaMethod)getItemSource();
            if (jm != null) {
                DocletTag tag = jm.getTagByName("return");
                if (tag != null) {
                    return docText(tag.getValue());
                }
            }
            return null;
View Full Code Here

Examples of com.thoughtworks.qdox.model.JavaMethod

     *
     * @see org.jibx.binding.model.IClassItem#getParameterJavaDoc(int)
     */
    public String getParameterJavaDoc(int index) {
        if (isMethod()) {
            JavaMethod jm = (JavaMethod)getItemSource();
            if (jm != null) {
                String name = jm.getParameters()[index].getName();
                DocletTag[] tags = jm.getTagsByName("param");
                for (int i = 0; i < tags.length; i++) {
                    DocletTag tag = tags[i];
                    String[] parms = tag.getParameters();
                    if (parms != null && parms.length > 0 && name.equals(parms[0])) {
                        String text = tag.getValue().trim();
View Full Code Here

Examples of com.thoughtworks.qdox.model.JavaMethod

     * (non-Javadoc)
     *
     * @see org.jibx.binding.model.IClassItem#getParameterName(int)
     */
    public String getParameterName(int index) {
        JavaMethod jm = (JavaMethod)getItemSource();
        String name;
        if (jm != null) {
            JavaParameter[] parameters = jm.getParameters();
            name = parameters[index].getName();
        } else {
            name = super.getParameterName(index);
        }
        return name;
View Full Code Here

Examples of com.thoughtworks.qdox.model.JavaMethod

     *
     * @see org.jibx.binding.model.IClassItem#getExceptionJavaDoc(int)
     */
    public String getExceptionJavaDoc(int index) {
        if (isMethod()) {
            JavaMethod jm = (JavaMethod)getItemSource();
            if (jm != null) {
                String name = getExceptions()[index];
                DocletTag[] tags = jm.getTagsByName("throws");
                for (int i = 0; i < tags.length; i++) {
                    DocletTag tag = tags[i];
                    String[] parms = tag.getParameters();
                    if (parms != null && parms.length > 0 && name.equals(parms[0])) {
                        return docText(tag.getValue());
View Full Code Here

Examples of com.thoughtworks.qdox.model.JavaMethod

            // retLst.addAll(ContainerTransaction.unroll(permType, transTag.getType()));
        }

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

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

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

Examples of com.thoughtworks.qdox.model.JavaMethod

            return (left != null) ? left.getMethod() : null;
        }

        public boolean isLeftMany() {
            boolean retVal = false;
            JavaMethod method = getLeftMethod();
            EjbRelationTag tag = getRightTag();

            if (method != null) {
                retVal |= method.getReturns().isA(new Type(Collection.class.getName()));
                retVal |= method.getReturns().isA(new Type(Set.class.getName()));
            } else {
                retVal = tag.isTargetMultiple();
            }

            return retVal;
View Full Code Here

Examples of com.thoughtworks.qdox.model.JavaMethod

            return retVal;
        }

        public boolean isRightMany() {
            boolean retVal = false;
            JavaMethod method = getRightMethod();
            EjbRelationTag tag = getLeftTag();

            if (method != null) {
                retVal |= method.getReturns().isA(new Type(Collection.class.getName()));
                retVal |= method.getReturns().isA(new Type(Set.class.getName()));
            } else {
                retVal = tag.isTargetMultiple();
            }

            return retVal;
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.setInterface(true);
        retVal.setModifiers(new String[]{"public"});
        String[] extendz = getExtends(metadata);
        Type[] extendzTypes = new Type[extendz.length];
        for (int j = 0; j < extendz.length; j++) {
            extendzTypes[j] = new Type(extendz[j]);
        }
        retVal.setImplementz(extendzTypes);

        field = new JavaField(new Type("java.lang.String"), ejbHomeUtils.getCompleteNameConst());
        field.setModifiers(new String[]{"public","static","final"});
        retVal.addField(field);

        field = new JavaField(new Type("java.lang.String"), ejbHomeUtils.getJndiNameConst());
        field.setModifiers(new String[]{"public","static","final"});
        retVal.addField(field);

        Collection methods = getCreateMethods(metadata);
        for (Iterator iter = methods.iterator(); iter.hasNext();) {
            method = new DuplicatedJavaMethod((JavaMethod)iter.next());
            method.setModifiers(new String[0]);
            retVal.addMethod(method);
        }

        if (ejbUtils.isEntityBean(metadata)) {
            methods = getFinderMethods(metadata);
            for (Iterator iter = methods.iterator(); iter.hasNext();) {
                method = new DuplicatedJavaMethod((JavaMethod)iter.next());
                method.setModifiers(new String[0]);
                retVal.addMethod(method);
            }
        }
        methods = getHomeMethods(metadata);
        for (Iterator iter = methods.iterator(); iter.hasNext();) {
            method = new DuplicatedJavaMethod((JavaMethod)iter.next());
            method.setModifiers(new String[0]);
            retVal.addMethod(method);
        }

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

Examples of com.thoughtworks.qdox.model.JavaMethod

                // Lets start rolling
                //            retVal.setUpdatable(valueTag.isUpdatable());
                // TODO: Are we supporting hierarchaly generated files
                // similar to PrimaryKeys ?
                JavaMethod[] methods = javaClass.getMethods(true);
                JavaMethod method;

                for (int i = 0; i < methods.length; i++) {
                    method = methods[i];

                    if (log.isTraceEnabled()) {
                        // log.trace(method.getName() + " = " + method);
                        log.trace(method.getName() + " seeing if this is a value-object-field");
                    }

                    // Obtain extra method flags
                    int metaFlags = ejbUtils.getMethodMetadata(javaClass, method);

                    if (EjbUtils.hasFlag(metaFlags, EjbUtils.METADATA_METHOD_PRIMARY_KEY_FIELD) ||
                            EjbUtils.hasFlag(metaFlags, EjbUtils.METADATA_METHOD_PERSISTENCE_FIELD) ||
                            EjbUtils.hasFlag(metaFlags, EjbUtils.METADATA_METHOD_RELATION_FIELD)) {
                        if (log.isDebugEnabled()) {
                            log.debug(method.getName() +
                                " is candidate for checking. It's a persistence field, relation field or primary key field");
                        }

                        // Por aqui o resto das valida��es e l�gica
                        boolean isValueObjectField = isSelectedValueObjectField(valueTag.getMatch(), method);

                        // Primary key field must ALLWAYS be included ! (or then they must be checked if ....)
                        isValueObjectField = isValueObjectField ||
                            EjbUtils.hasFlag(metaFlags, EjbUtils.METADATA_METHOD_PRIMARY_KEY_FIELD);

                        if (isValueObjectField) {
                            EjbValueObjectFieldTag vTag = findMatchedTag(valueTag.getMatch(), method);
                            BeanProperty prop = javaClass.getBeanProperty(method.getPropertyName(), true);

                            if (log.isDebugEnabled()) {
                                log.debug(method.getName() + " is a value-object-field: matches or is a pk-field.");
                            }

                            // XXX: Todo, if we have a relation found by the RelationManager, then we must have
                            // it's treatment as such, or should be ignored
                            // Maybe just check if is a EjbUtils.METADATA_METHOD_RELATION_FIELD
                            Relation relation = getRelationManager().getRelationFor(method, javaClass);

                            if ((relation != null) ||
                                    ((vTag != null) && ((vTag.getAggregate() != null) || (vTag.getCompose() != null)))) {
                                // This is a value-object relation
                                // vTag must be non-null, because we need values from it
                                if ((vTag != null) && ((vTag.getAggregate() != null) ^ (vTag.getCompose() != null))) {
                                    JavaClass relationEjb = null;
                                    Type collectionType = null;

                                    if (relation != null) {
                                        if (!method.equals(relation.getLeftMethod())) {
                                            log.debug(
                                                "Current method doesn't match relations' left method. Reversing relation");
                                            relation = relation.reverse();

                                            if (log.isDebugEnabled()) {
                                                log.debug("Reversed relation is relation=" + relation);
                                            }
                                        }

                                        if (log.isDebugEnabled()) {
                                            log.debug("Using relation information. relation=" + relation);
                                            log.debug("1# Left bean=" +
                                                ((relation.getLeftBean() != null)
                                                ? relation.getLeftBean().getFullyQualifiedName() : null));
                                            log.debug("1# Rigth bean=" +
                                                ((relation.getRightBean() != null)
                                                ? relation.getRightBean().getFullyQualifiedName() : null));
                                        }

                                        String relationEjbName = relation.getRightEJBName();
                                        relationEjb = getBeanResolver().findEjbByName(relationEjbName);
                                        collectionType = relation.getLeftMethod().getReturns();
                                    } else {
                                        log.debug("We don't have relation information for this method");
                                        Type returnType = method.getReturns();
                                        Type relationType = null;

                                        if (returnType.isA(COLLECTION_TYPE) || returnType.isA(SET_TYPE)) {
                                            String members = vTag.getMembers();
View Full Code Here

Examples of com.thoughtworks.qdox.model.JavaMethod

                propType = new Type(getAggregate());
            }

            retVal = new BeanProperty(propName);
            retVal.setType(propType);
            JavaMethod getter = new JavaMethod(propType, getGetterName(retVal));
            JavaMethod setter = new JavaMethod(propType, getSetterName(retVal));
            setter.setParameters(new JavaParameter[] {new JavaParameter(propType, propName)});
            retVal.setAccessor(getter);
            retVal.setMutator(setter);
            return retVal;
        }
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.