public void startElement()

in maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/CompositeComponentModelBuilder.java [226:404]


        public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException
        {
            if (COMPOSITE_LIBRARY_NAME.equals(uri))
            {
                if (INTERFACE_NAME.equals(localName))
                {
                    this.inCompositeInterface=true;
                    _TagAttributes attrs = this.createAttributes(attributes);
                    
                    this.component = null;
                    //1. Use componentType attribute to find the class in the model.
                    _TagAttribute type = attrs.get("componentType");
                    boolean setComponentType = false;
                    if (type != null)
                    {
                        this.component = model.findComponentByType(type.getValue());                        
                        if (this.component == null)
                        {
                            //Component not found, set component type when created
                            setComponentType = true;
                        }
                    }
                    if (this.component == null)
                    {
                        //2. Use libraryName + '.' + componentName
                        this.component = model.findComponentByClassName(alias);
                    }
                    if (this.component == null)
                    {
                        //No class bound, create
                        this.component = new ComponentMeta();
                        // Set as class name the assigned by Application.createResource, 
                        // even if not exists.
                        this.component.setClassName(alias);
                        if (!setComponentType)
                        {
                            this.component.setParentClassName("jakarta.faces.component.UINamingContainer");
                            PropertyMeta idProp = new PropertyMeta();
                            idProp.setName("id");
                            idProp.setRequired(false);
                            this.component.addProperty(idProp);
                        }
                        this.component.setModelId(model.getModelId());
                    }
                    //componentType
                    if (setComponentType)
                    {
                        component.setType(type.getValue());
                    }
                    
                    //Mark it as composite
                    component.setComposite(Boolean.TRUE);
                    
                    component.setCcLibraryName(libraryName);
                    
                    component.setCcResourceName(resourceName);
                    
                    //name: Force name to be the one derived by the composite component
                    component.setName(componentName);

                    //shortDescription
                    _TagAttribute shortDescription = attrs.get("shortDescription");
                    if (shortDescription != null)
                    {
                        component.setDescription(shortDescription.getValue());
                    }
                    
                    // Ignored properties:
                    // displayName
                    // preferred
                    // expert
                    // hidden
                    model.addComponent(component);
                }
                if (ATTRIBUTE_NAME.equals(localName))
                {
                    _TagAttributes attrs = this.createAttributes(attributes);
                    //name
                    String name = attrs.get("name").getValue();
                    
                    PropertyMeta property = component.getProperty(name);
                    
                    if (property == null)
                    {
                        property = new PropertyMeta();
                        property.setName(name);
                        component.addProperty(property);
                    }
                    
                    //default
                    _TagAttribute defaultValue = attrs.get("default");
                    if (defaultValue != null)
                    {
                        property.setDefaultValue(defaultValue.getValue());
                    }
                    //required
                    _TagAttribute required = attrs.get("required");
                    if (required != null)
                    {
                        property.setRequired(Boolean.valueOf(required.getValue()));
                    }
                    //shortDescription
                    _TagAttribute shortDescription = attrs.get("shortDescription");
                    if (shortDescription != null)
                    {
                        property.setDescription(shortDescription.getValue());
                    }
                    //type
                    _TagAttribute type = attrs.get("type");
                    if (type != null)
                    {
                        property.setDeferredValueType(type.getValue());
                    }
                    //method-signature
                    _TagAttribute methodSignature = attrs.get("method-signature");
                    if (methodSignature != null)
                    {
                        String signature = methodSignature.getValue();
                        try
                        {
                            MethodSignatureMeta msm = new MethodSignatureMeta();
                            List paramsList = _getParameters(signature);
                            for (int i = 0; i < paramsList.size(); i++)
                            {
                                msm.addParameterType((String)paramsList.get(i));
                            }
                            msm.setReturnType(_getReturnType(signature));
                            property.setMethodBindingSignature(msm);
                        }
                        catch (Exception e)
                        {
                            throw new SAXException(e);
                        }
                    }

                    // Ignored properties:
                    // preferred
                    // expert
                    // hidden
                    // targets
                    // displayName
                }
                if (FACET_NAME.equals(localName))
                {
                    _TagAttributes attrs = this.createAttributes(attributes);
                    
                    String name = attrs.get("name").getValue();
                    
                    FacetMeta facet = component.getFacet(name);
                    
                    if (facet == null)
                    {
                        facet = new FacetMeta();
                        facet.setName(name);
                        component.addFacet(facet);
                    }
                    
                    //required
                    _TagAttribute required = attrs.get("required");
                    if (required != null)
                    {
                        facet.setRequired(Boolean.valueOf(required.getValue()));
                    }
                    
                    //shortDescription
                    _TagAttribute shortDescription = attrs.get("shortDescription");
                    if (shortDescription != null)
                    {
                        facet.setDescription(shortDescription.getValue());
                    }
                    
                    // Ignored properties:
                    // preferred
                    // expert
                    // hidden
                    // displayName
                }
            }
        }