Package xjavadoc

Examples of xjavadoc.XParameter


    }

    private static boolean isPossiblePropertyMutator(XMethod method, XType propertyType)
    {
        if (isPossiblePropertyMutator(method)) {
            XParameter firstParam = (XParameter) method.getParameters().get(0);

            return firstParam.getType().equals(propertyType);
        }
        return false;
    }
View Full Code Here


        //does the method have an explicit name attribute
        String name = method.getDoc().getTag("javabean.property").getAttributeValue("name");

        if ((name == null) || (name.length() <= 0)) {
            if (isPossiblePropertyMutator(method)) {
                XParameter parameter = (XParameter) method.getParameters().get(0);

                result = parameter.getType();
            }
            else if (isPossiblePropertyAccessor(method)) {
                result = method.getReturnType().getType();
            }
        }
View Full Code Here

            }

            if (tag != null) {
                List params = method.getParameters();
                String name = method.getPropertyName();
                XParameter param = null;

                if (MethodTagsHandler.isSetterMethod(method)) {
                    param = (XParameter) params.get(0);
                }
                else if (params.size() == 2) {
                    // Check for indexed setter setBlah(int index, <type> value)
                    if (!MethodTagsHandler.isSetter(method.getName()))
                        continue;

                    Iterator paramIter = params.iterator();

                    if (!((XParameter) paramIter.next()).getType().isA("int"))
                        continue;

                    if (name.indexOf("[]") >= 0) {
                        throw new XDocletException(Translator.getString(StrutsValidatorMessages.class,
                            StrutsValidatorMessages.ONLY_ONE_LEVEL_LIST_PROPS,
                            new String[]{clazz.getName() + '.' + name + "[]"}));
                    }

                    name = name + "[]";
                    param = (XParameter) paramIter.next();
                }
                else
                    continue;

                String type = param.getType().getQualifiedName();

                if (supportedTypes.contains(type)) {
                    fields.put(prefix + name, method);
                }
                else if ((override != null) && (override.equals("true"))) {
                    fields.put(prefix + name, method);
                }
                else {

                    boolean preDot = (prefix.length() > 0 && prefix.charAt(prefix.length() - 1) != '.');

                    fields.putAll(getFields(param.getType(), prefix + (preDot ? "." : "") + name + "."));
                }
            }
        }

        return fields;
View Full Code Here

            parameters = getCurrentMethod().getParameters();
        }

        for (Iterator iter =
            parameters.iterator(); iter.hasNext(); ) {
            XParameter parameter = (XParameter)iter.next();
            XClass type = parameter.getType();

            if (type == null) {
                throw new XDocletException("FATAL: " + parameter);
            }

            sbuf.append(CodeUtils.capitalize(type.getName()));

            for (int cnt = parameter.getDimension(); cnt > 0; cnt--) {
                sbuf.append("Array");
            }
        }

        String result = sbuf.toString();
View Full Code Here

            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);
                    }
                    else {
                        fields.putAll(getFields(param.getType(), prefix + (prefix.length() == 0 ? "" : ".") + name + "."));
                    }
                }
            }
        }
View Full Code Here

    }

    public String nestedElementType() throws XDocletException
    {
        for (Iterator i = getCurrentMethod().getParameters().iterator(); i.hasNext(); ) {
            XParameter parameter = (XParameter) i.next();

            return parameter.getType().getQualifiedName();
        }

        return "";
    }
View Full Code Here

    private void ifIsANestedElement_Impl(String template, boolean condition) throws XDocletException
    {
        if ((getCurrentMethod().getName().startsWith("set") || getCurrentMethod().getName().startsWith("add")) && getCurrentMethod().getParameters().size() == 1) {

            for (Iterator i = getCurrentMethod().getParameters().iterator(); i.hasNext(); ) {
                XParameter parameter = (XParameter) i.next();

                if (isNestedElementParameter(parameter) == condition) {
                    generate(template);
                }
            }
View Full Code Here

    }
   
    protected String getParameterTypes (Collection parameters) {
        StringBuffer sb = new StringBuffer ();
        for (Iterator params = parameters.iterator (); params.hasNext ();) {
            XParameter parameter = (XParameter) params.next ();
            getTransformedQualifiedName (parameter.getType (), sb);
            sb.append (parameter.getDimensionAsString ());
           
            if (params.hasNext ()) {
                sb.append (",");
            }
        }
View Full Code Here

                        addExpressions (member.getDoc ().getTags (), "return", pw, "attrs", sourceFile);
                        pw.println ("        bundle.add (attrs);");
                        pw.println ("        attrs = null;");
                       
                        for (Iterator parameters = member.getParameters ().iterator (); parameters.hasNext ();) {
                            XParameter parameter = (XParameter) parameters.next ();
                            pw.println ("        attrs = new java.util.HashSet ();");
                            addExpressions (member.getDoc ().getTags (), parameter.getName (), pw, "attrs", sourceFile);
                            pw.println ("        bundle.add (attrs);");
                            pw.println ("        attrs = null;");
                        }
                       
                        pw.println ("        methodAttributes.put (\"" + key + "\", bundle);");
                        pw.println ("        bundle = null;");
                        pw.println ();
                    }               
                }
                pw.println ("    }");
               
               
                // ---- Constructor Attributes
               
                pw.println ("    private void initConstructorAttributes () {");
                pw.println ("        java.util.Set attrs = null;");
                pw.println ("        java.util.List bundle = null;");
                for (Iterator iter = xClass.getConstructors ().iterator (); iter.hasNext ();) {
                    XConstructor member = (XConstructor) iter.next ();
                    if (member.getDoc ().getTags ().size () > 0) {
                        StringBuffer sb = new StringBuffer ();
                        sb.append ("(");
                        sb.append (getParameterTypes (member.getParameters ()));
                        sb.append (")");
                        String key = sb.toString ();
                       
                        pw.println ("        bundle = new java.util.ArrayList ();");
                        pw.println ("        attrs = new java.util.HashSet ();");
                        addExpressions (member.getDoc ().getTags (), null, pw, "attrs", sourceFile);
                        pw.println ("        bundle.add (attrs);");
                        pw.println ("        attrs = null;");
                       
                        for (Iterator parameters = member.getParameters ().iterator (); parameters.hasNext ();) {
                            XParameter parameter = (XParameter) parameters.next ();
                            pw.println ("        attrs = new java.util.HashSet ();");
                            addExpressions (member.getDoc ().getTags (), parameter.getName (), pw, "attrs", sourceFile);
                            pw.println ("        bundle.add (attrs);");
                            pw.println ("        attrs = null;");
                        }
                       
                        pw.println ("        constructorAttributes.put (\"" + key + "\", bundle);");
View Full Code Here

TOP

Related Classes of xjavadoc.XParameter

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.