Package xjavadoc

Examples of xjavadoc.XMethod


         * TYPE is added only if the parameter appears on struts.validator tag
         * which indicates it's only associated with a specific validator type.
         */
        args = new SequencedHashMap();

        XMethod method = getCurrentMethod();

        // Collect all general args
        Collection argTags = method.getDoc().getTags("struts.validator-args");

        for (Iterator argsIterator = argTags.iterator(); argsIterator.hasNext(); ) {
            XTag tag = (XTag) argsIterator.next();
            Collection attributeNames = tag.getAttributeNames();

            for (Iterator attributesIterator = attributeNames.iterator(); attributesIterator.hasNext(); ) {
                String name = (String) attributesIterator.next();

                if (name.startsWith("arg")) {
                    args.put(name, tag.getAttributeValue(name));
                }
            }
        }

        // Collect all type-specific args
        Collection argTypeTags = method.getDoc().getTags("struts.validator");

        for (Iterator typeTagsIterator = argTypeTags.iterator(); typeTagsIterator.hasNext(); ) {
            XTag tag = (XTag) typeTagsIterator.next();
            Collection attributeNames = tag.getAttributeNames();
            String type = tag.getAttributeValue("type");
View Full Code Here


    {
        if (currentMember == null || !(currentMember instanceof XMethod)) {
            throw new XDocletException("XDtEjbEnv:methodSignature can only be used inside forAllMemberTags or forAllMethodTags");
        }

        XMethod method = (XMethod) currentMember;
        StringBuffer sb = new StringBuffer();

        if (Modifier.isProtected(method.getModifierSpecifier())) {
            sb.append("protected ");
        }
        if (Modifier.isPublic(method.getModifierSpecifier())) {
            sb.append("public ");
        }
        sb.append(method.getReturnType().getType().getQualifiedName());
        sb.append(' ');
        sb.append(method.getNameWithSignature(true));

        List exceptions = method.getThrownExceptions();

        if (exceptions.size() > 0) {
            sb.append(" throws ");
            for (Iterator it = exceptions.iterator(); it.hasNext(); ) {
                XClass exception = (XClass) it.next();
View Full Code Here

            currentTagType = FOR_METHOD;

            Collection methods = getCurrentClass().getMethods(superclasses);

            for (Iterator it = methods.iterator(); it.hasNext(); ) {
                XMethod method = (XMethod) it.next();

                setCurrentMethod(method);

                Collection tags = method.getDoc().getTags(tagName);

                for (Iterator it2 = tags.iterator(); it2.hasNext(); ) {
                    currentTag = (XTag) it2.next();
                    if (tagMatches(currentTag, paramName, paramValue)) {
                        setCurrentMethodTag(currentTag);
View Full Code Here

    {
        XClass clazz = getCurrentClass();
        Iterator methodIterator = clazz.getMethods(true).iterator();

        // iterate through all the methods defined in this class
        XMethod method;

        while (methodIterator.hasNext()) {
            method = (XMethod) methodIterator.next();

            if (method.getDoc().hasTag("hibernate.id")) {
                return method;
            }
        }
        return null;
    }
View Full Code Here

     */
    void hasCompositeId_Impl(String template, boolean composite) throws XDocletException
    {
        XClass oldClass = getCurrentClass();

        XMethod method = getIdMethod();

        // bomb politely if no ID method could be found
        if (method == null) {
            throw new XDocletException(
                Translator.getString(XDocletModulesHibernateMessages.class,
                XDocletModulesHibernateMessages.NO_ID_PROPERTY,
                new String[]{getCurrentClass().getQualifiedName()}));
        }

        // Determine whether or not the ID is a user-defined type.
        // If it is then it is not a composite id.
        boolean isUserType = false;

        String typeStr = method.getDoc().getTagAttributeValue("hibernate.id", "type");

        if (typeStr != null) {
            // The type attribute was supplied, so check
            // whether it implements cirrus.hibernate.UserType
            XClass typeClass = getXJavaDoc().getXClass(typeStr);

            if (typeClass != null) {
                isUserType = typeClass.isA("cirrus.hibernate.UserType") || typeClass.isA("net.sf.hibernate.UserType");
            }
        }
        else {
            typeStr = method.getReturnType().getType().getQualifiedName();
        }

        // decide whether we have composite or primitive ID
        boolean isPrimitive = TypeTagsHandler.isPrimitiveType(typeStr) ||
            "java.lang.Byte".equals(typeStr) ||
            "java.lang.Double".equals(typeStr) ||
            "java.lang.Float".equals(typeStr) ||
            "java.lang.Integer".equals(typeStr) ||
            "java.lang.Long".equals(typeStr) ||
            "java.lang.Short".equals(typeStr) ||
            "java.lang.String".equals(typeStr) ||
            "java.math.BigDecimal".equals(typeStr) ||
            "java.math.BigInteger".equals(typeStr) ||
            isUserType;

        if (isPrimitive && !composite) {
            setCurrentMethod(method);
            generate(template);
        }

        if (composite && !isPrimitive) {
            // check whether specified type satisfies us
            // it has to be serializable,
            // and implement equals itself.
            // bomb if not.
            XClass returnType = method.getReturnType().getType();

            if (returnType.isA("java.io.Serializable") && !returnType.isAbstract() &&
                !"java.lang.Object".equals(returnType.getMethod("equals(java.lang.Object)", true).getContainingClass().getQualifiedName())) {
                setCurrentMethod(method);
                generate(template);
View Full Code Here

        Map setters = getFields(clazz);

        for (Iterator iterator = setters.keySet().iterator(); iterator.hasNext(); ) {
            curFieldName = (String) iterator.next();

            XMethod field = (XMethod) setters.get(curFieldName);

            setCurrentMethod(field);
            loadFieldArguments();
            generate(template);
        }
View Full Code Here

     * @return       validator type list
     * @doc.tag      type="content"
     */
    public String validatorList(Properties props)
    {
        XMethod method = getCurrentMethod();
        Collection tags = method.getDoc().getTags("spring.validator");
        StringBuffer buffer = new StringBuffer();

        for (Iterator iterator = tags.iterator(); iterator.hasNext(); ) {
            XTag tag = (XTag) iterator.next();

View Full Code Here

        // TODO: nested forms currently won't work unless
        // there is a setter for it, but that is not needed
        // as only the sub-forms must have setters.  The top-level
        // only requires a getter.
        for (Iterator iterator = curFields.iterator(); iterator.hasNext(); ) {
            XMethod setter = (XMethod) iterator.next();

            if (MethodTagsHandler.isSetterMethod(setter)) {
                if (setter.getDoc().getTag("spring.validator") != null) {
                    String name = MethodTagsHandler.getPropertyNameFor(setter);
                    XParameter param = (XParameter) setter.getParameters().iterator().next();
                    String type = param.getType().getQualifiedName();

                    if (supportedTypes.contains(type)) {
                        fields.put(prefix + name, setter);
                    }
View Full Code Here

         * TYPE is added only if the parameter appears on spring.validator tag
         * which indicates its only associated with a specific validator type.
         */
        args = new SequencedHashMap();

        XMethod method = getCurrentMethod();

        // Collect all general args
        Collection argTags = method.getDoc().getTags("spring.validator-args");

        for (Iterator argsIterator = argTags.iterator(); argsIterator.hasNext(); ) {
            XTag tag = (XTag) argsIterator.next();
            Collection attributeNames = tag.getAttributeNames();

            for (Iterator attributesIterator = attributeNames.iterator(); attributesIterator.hasNext(); ) {
                String name = (String) attributesIterator.next();

                if (name.startsWith("arg")) {
                    args.put(name, tag.getAttributeValue(name));
                }
            }
        }

        // Collect all type-specific args
        Collection argTypeTags = method.getDoc().getTags("spring.validator");

        for (Iterator typeTagsIterator = argTypeTags.iterator(); typeTagsIterator.hasNext(); ) {
            XTag tag = (XTag) typeTagsIterator.next();
            Collection attributeNames = tag.getAttributeNames();
            String type = tag.getAttributeValue("type");
View Full Code Here

            String fieldName = getPrimkeyFieldFor(clazz);
            String getter = "get" + fieldName.substring(0, 1).toUpperCase() + fieldName.substring(1);

            // the getter might be in a superclass, so check those as well
            //
            XMethod method = PropertyTagsHandler.getXMethodForMethodName(getter, true);

            if (method == null) {
                throw new XDocletException("Could not find method " + getter + " that is supposed to return the PrimKeyField.");
            }

            return method.getReturnType().getType().getQualifiedName();
        }

        String fileName = clazz.getContainingPackage().getName();

        String pkClass = clazz.getDoc().getTagAttributeValue("ejb:pk", "class", false);
View Full Code Here

TOP

Related Classes of xjavadoc.XMethod

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.