Package xjavadoc

Examples of xjavadoc.XClass


            if (refed_ejb_name == null) {
                throw new XDocletException("No ejb-name attribute found in ejb-ref specified in bean " + getCurrentClass());
            }

            XClass refed_clazz = findEjb(refed_ejb_name);
            String ejb_type = isLocalEjb(refed_clazz) ? "local" : "remote";

            ejbRefJndiName = HomeTagsHandler.getJndiNameOfTypeFor(ejb_type, refed_clazz);

//Ara: we'll uncomment it later:
View Full Code Here


    protected XClass findEjb(String ejbName) throws XDocletException
    {
        Collection classes = getXJavaDoc().getSourceClasses();

        for (Iterator i = classes.iterator(); i.hasNext(); ) {
            XClass clazz = (XClass) i.next();

            if (isEjb(clazz) && ejbName.equals(getEjbNameFor(clazz))) {
                return clazz;
            }
        }
View Full Code Here

        List exceptions = method.getThrownExceptions();

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

                sb.append(exception.getQualifiedName());
                if (it.hasNext()) {
                    sb.append(", ");
                }
            }
        }
View Full Code Here

    {
        // all fields carrying @struts:form-field form-name="<bla>" where <bla> is current
        // form name, or all persistent fields if  include-all="true" is set

        Log log = LogUtil.getLog(ActionFormTagsHandler.class, "forAllFormFields");
        XClass currentClass = getCurrentClass();
        Map foundFields = new HashMap();

        if (log.isDebugEnabled()) {
            log.debug("BEGIN-----------------------------------------");
        }

        do {
            pushCurrentClass(currentClass);

            if (log.isDebugEnabled()) {
                log.debug("-----CLASS=" + getCurrentClass().getName() + "----------------");
            }

            Collection methods = getCurrentClass().getMethods();

            for (Iterator j = methods.iterator(); j.hasNext(); ) {
                setCurrentMethod((XMethod) j.next());
                // We are interested in persistent fields and fields marked as a form-field.
                if (MethodTagsHandler.isGetter(getCurrentMethod().getName()) &&
                    !foundFields.containsKey(getCurrentMethod().getName()) &&
                    useMethodInForm(getCurrentMethod())) {
                    if (useMethodInForm(getCurrentMethod())) {
                        if (log.isDebugEnabled()) {
                            log.debug("METHOD(I=" + getCurrentMethod().getName());
                        }
                        // Store that we found this field so we don't add it twice
                        foundFields.put(getCurrentMethod().getName(), getCurrentMethod().getName());

                        generate(template);
                    }
                }
            }

            // Add super class info
            if (getCurrentClass().getSuperclass().getQualifiedName().equals("java.lang.Object")) {
                popCurrentClass();
                break;
            }

            popCurrentClass();
            currentClass = currentClass.getSuperclass();
        } while (true);

        if (log.isDebugEnabled()) {
            log.debug("END-------------------------------------------");
        }
View Full Code Here

        }

        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");
            }
        }
View Full Code Here

     * @return
     * @exception XDocletException
     */
    public XMethod getIdMethod() throws XDocletException
    {
        XClass clazz = getCurrentClass();
        Iterator methodIterator = clazz.getMethods(true).iterator();

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

        while (methodIterator.hasNext()) {
View Full Code Here

    public String mappingList() throws XDocletException
    {
        String mappingName;
        StringBuffer sb = new StringBuffer();
        Collection classes = ClassTagsHandler.getAllClasses();
        XClass clazz;

        for (Iterator i = classes.iterator(); i.hasNext(); ) {
            clazz = (XClass) i.next();

            if (clazz.getDoc().hasTag("hibernate.class", false)) {
                mappingName = getHibernateSubTask().getMappingURL(clazz);
                sb.append(mappingName);
                sb.append(",");
            }
        }
View Full Code Here

     * @doc.tag                     type="block"
     */
    public void forAllPersistentClasses(String template, Properties attributes) throws XDocletException
    {
        Collection classes = ClassTagsHandler.getAllClasses();
        XClass clazz;

        for (Iterator i = classes.iterator(); i.hasNext(); ) {
            clazz = (XClass) i.next();

            if (clazz.getDoc().hasTag("hibernate.class", false)) {
                pushCurrentClass(clazz);
                generate(template);
                popCurrentClass();
            }
        }
View Full Code Here

            if (log.isDebugEnabled())
                log.debug("typeName=" + typeName);

            Collection classes = getXJavaDoc().getSourceClasses();
            XClass clazz;

            for (Iterator i = classes.iterator(); i.hasNext(); ) {
                clazz = (XClass) i.next();

                log.debug("clazz=" + clazz);

                if (DocletSupport.isDocletGenerated(clazz)) {
                    log.debug("isDocletGenerated");
                }
                else if (clazz.getSuperclass() != null && clazz.getSuperclass().getQualifiedName().equals(typeName)) {
                    log.debug("is a subclass");

                    XClass current = getCurrentClass();

                    pushCurrentClass(clazz);
                    generate(template);
                    popCurrentClass();
View Full Code Here

     * @param composite
     * @exception XDocletException
     */
    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);

            }
            else {
                // bomb politely that given property does not qualify as composite ID
                throw new XDocletException(
                    Translator.getString(XDocletModulesHibernateMessages.class,
                    XDocletModulesHibernateMessages.WRONG_COMPOSITE_ID,
                    new String[]{returnType.getQualifiedName()}));
            }
        }

        if (getCurrentClass() != oldClass)
            setCurrentClass(oldClass);
View Full Code Here

TOP

Related Classes of xjavadoc.XClass

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.