public Object get()

in api/src/main/java/jakarta/faces/component/_ComponentAttributesMap.java [282:446]


    public Object get(Object key)
    {
        checkKey(key);
        
        Object value;

        int keyLength = ((String)key).length();
        if (keyLength >= MIN_LENGHT_CHECK)
        {
            if (MARK_CREATED.length() == keyLength &&
                MARK_CREATED.equals(key))
            {
                return _component.getOamVfMarkCreated();
            }
            else if (FACET_NAME_KEY.length() == keyLength &&
                FACET_NAME_KEY.equals(key))
            {
                return _component.getOamVfFacetName();
            }
            else if (COMPONENT_ADDED_BY_HANDLER_MARKER.length() == keyLength &&
                COMPONENT_ADDED_BY_HANDLER_MARKER.equals(key))
            {
                return _component.isOamVfAddedByHandler();
            }
            else if (FACET_CREATED_UIPANEL_MARKER.length() == keyLength &&
                FACET_CREATED_UIPANEL_MARKER.equals(key))
            {
                return _component.isOamVfFacetCreatedUIPanel();
            }
        }

        // is there a javabean property to read?
        PropertyDescriptorWrapper propertyDescriptor = getPropertyDescriptor((String) key);
        if (propertyDescriptor != null && propertyDescriptor.getReadMethod() != null)
        {
            value = getComponentProperty(propertyDescriptor);
        }
        else
        {
            // is there a literal value to read?
            value = getUnderlyingMap().get(key);
            if (value == null)
            {
                // is there a value-binding to read?
                ValueExpression ve = _component.getValueExpression((String) key);
                if (ve != null)
                {
                    value = ve.getValue(_component.getFacesContext().getELContext());
                }
                else
                {
                    if (!_isCompositeComponentSet)
                    {
                        _isCompositeComponent = getUnderlyingMap().containsKey(Resource.COMPONENT_RESOURCE_KEY);
                        _isCompositeComponentSet = true;
                    }
                    if (_isCompositeComponent)
                    {
                        BeanInfo ccBeanInfo = _ccBeanInfo != null ? _ccBeanInfo :
                            (BeanInfo) getUnderlyingMap().get(UIComponent.BEANINFO_KEY);
                        if (ccBeanInfo != null)
                        {
                            //Fast shortcut to allow fast lookup.
                            Map<String, PropertyDescriptor> attributeMap = (Map<String, PropertyDescriptor>) 
                                ccBeanInfo.getBeanDescriptor().getValue(
                                    PROPERTY_DESCRIPTOR_MAP_KEY);
                            if (attributeMap != null)
                            {
                                PropertyDescriptor attribute = attributeMap.get(key);
                                if (attribute != null)
                                {
                                    String attributeName = attribute.getName();
                                    boolean isKnownMethod = "action".equals(attributeName)
                                            || "actionListener".equals(attributeName)
                                            || "validator".equals(attributeName)
                                            || "valueChangeListener".equals(attributeName);

                                    // <composite:attribute> method-signature attribute is 
                                    // ValueExpression that must evaluate to String
                                    ValueExpression methodSignatureExpression
                                            = (ValueExpression) attribute.getValue("method-signature");
                                    String methodSignature = null;
                                    if (methodSignatureExpression != null)
                                    {
                                        // Check if the value expression holds a method signature
                                        // Note that it could be null, so in that case we don't have to 
                                        // do anything
                                        methodSignature = methodSignatureExpression.getValue(
                                                                    _component.getFacesContext().getELContext());
                                    }

                                    // either the attributeName has to be a knownMethod
                                    // or there has to be a method-signature
                                    if (isKnownMethod || methodSignature != null)
                                    {
                                        //In this case it is expecting a ValueExpression
                                        return attribute.getValue("default");
                                    }
                                    else
                                    {
                                        value = attribute.getValue("default");
                                    }
                                }
                            }
                            else
                            {
                                // Failsafe if another implementation for composite components is set
                                for (PropertyDescriptor attribute : ccBeanInfo.getPropertyDescriptors())
                                {
                                    if (attribute.getName().equals(key))
                                    {
                                        String attributeName = attribute.getName();
                                        boolean isKnownMethod = "action".equals(attributeName)
                                                || "actionListener".equals(attributeName)
                                                || "validator".equals(attributeName)
                                                || "valueChangeListener".equals(attributeName);

                                        // <composite:attribute> method-signature attribute is 
                                        // ValueExpression that must evaluate to String
                                        ValueExpression methodSignatureExpression
                                                = (ValueExpression) attribute.getValue("method-signature");
                                        String methodSignature = null;
                                        if (methodSignatureExpression != null)
                                        {
                                            // Check if the value expression holds a method signature
                                            // Note that it could be null, so in that case we don't have to 
                                            // do anything
                                            methodSignature = methodSignatureExpression.getValue(
                                                                        _component.getFacesContext().getELContext());
                                        }

                                        // either the attributeName has to be a knownMethod
                                        // or there has to be a method-signature
                                        if (isKnownMethod || methodSignature != null)
                                        {
                                            //In this case it is expecting a ValueExpression
                                            return attribute.getValue("default");
                                        }
                                        else
                                        {
                                            value = attribute.getValue("default");
                                            break;
                                        }
                                    }
                                }
                            }

                            // We have to check for a ValueExpression and also evaluate it
                            // here, because in the PropertyDescriptor the default values are
                            // always stored as (Tag-)ValueExpressions.
                            if (value != null && value instanceof ValueExpression expression)
                            {
                                return expression.getValue(_component.getFacesContext().getELContext());
                            }
                        }
                    }
                    // no value found
                    //return null;
                }
            }
        }

        // Otherwise, return the actual value from the get() method. 
        return value;
    }