Package java.beans

Examples of java.beans.BeanInfo


        }
       
        // HACK: comp.getAttributes() only returns attributes, that are NOT backed
        // by a corresponding component property. So, we must explicitly get the
        // available properties by Introspection:
        BeanInfo beanInfo;
        try
        {
            beanInfo = Introspector.getBeanInfo(comp.getClass());
        }
        catch (IntrospectionException e)
        {
            throw new RuntimeException(e);
        }

        if (!compType.startsWith("org.apache.myfaces.view.facelets.compiler"))
        {
            PropertyDescriptor propDescriptors[] = beanInfo.getPropertyDescriptors();
            for (int i = 0; i < propDescriptors.length; i++)
            {
                if (propDescriptors[i].getReadMethod() != null)
                {
                    String name = propDescriptors[i].getName();
View Full Code Here


         * Obtain a reference to the composite component metadata for this composite component by calling
         * ViewDeclarationLanguage.getComponentMetadata(javax.faces.context.FacesContext,
         * javax.faces.application.Resource), passing the facesContext and componentResource arguments to this method.
         * This version of JSF specification uses JavaBeans as the API to the component metadata.
         */
        BeanInfo metadata = vdl.getComponentMetadata(context, componentResource);
        if (metadata == null)
        {
            throw new FacesException("Could not get component metadata for "
                    + componentResource.getResourceName()
                    + ". Did you forget to specify <composite:interface>?");
        }

        /*
         * Determine if the component author declared a component-type for this component instance by obtaining the
         * BeanDescriptor from the component metadata and calling its getValue() method, passing
         * UIComponent.COMPOSITE_COMPONENT_TYPE_KEY as the argument. If non-null, the result must be a ValueExpression
         * whose value is the component-type of the UIComponent to be created for this Resource component. Call through
         * to createComponent(java.lang.String) to create the component.
         */
        BeanDescriptor descriptor = metadata.getBeanDescriptor();
        ValueExpression componentType = (ValueExpression) descriptor.getValue(UIComponent.COMPOSITE_COMPONENT_TYPE_KEY);
        boolean annotationsApplied = false;
        if (componentType != null)
        {
            component = application.createComponent((String) componentType.getValue(context.getELContext()));
View Full Code Here

                        _isCompositeComponent = getUnderlyingMap().containsKey(Resource.COMPONENT_RESOURCE_KEY);
                        _isCompositeComponentSet = true;
                    }
                    if (_isCompositeComponent)
                    {
                        BeanInfo ccBeanInfo = (BeanInfo) getUnderlyingMap().get(UIComponent.BEANINFO_KEY);
                        if (ccBeanInfo != null)
                        {
                            for (PropertyDescriptor attribute : ccBeanInfo.getPropertyDescriptors())
                            {
                                if (attribute.getName().equals(key))
                                {
                                    String attributeName = attribute.getName();
                                    boolean isKnownMethod = "action".equals(attributeName)
View Full Code Here

            _propertyDescriptorMap = propertyDescriptorCache.get(_component.getClass());
            // Cache miss: create descriptor map and put it in cache
            if (_propertyDescriptorMap == null)
            {
                // Create descriptor map...
                BeanInfo beanInfo;
                try
                {
                    beanInfo = Introspector.getBeanInfo(_component.getClass());
                }
                catch (IntrospectionException e)
                {
                    throw new FacesException(e);
                }
                PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
                _propertyDescriptorMap = new HashMap<String, _PropertyDescriptorHolder>();
                for (int i = 0; i < propertyDescriptors.length; i++)
                {
                    PropertyDescriptor propertyDescriptor = propertyDescriptors[i];
                    Method readMethod = propertyDescriptor.getReadMethod();
View Full Code Here

        // Unfortunately, we can't check it on constructor because we need to call
        // ViewDeclarationLanguage.getComponentMetadata() and on that point it is possible to not
        // have a viewId.
        if (!facesContext.isProjectStage(ProjectStage.Production))
        {
            BeanInfo beanInfo = (BeanInfo) component.getAttributes().get(UIComponent.BEANINFO_KEY);
            for (PropertyDescriptor propertyDescriptor : beanInfo.getPropertyDescriptors())
            {
                ValueExpression ve = (ValueExpression) propertyDescriptor.getValue("required");
                if (ve != null)
                {
                    Object value = ve.getValue (facesContext.getELContext());
View Full Code Here

            Class<?> type = instance.getClass();
            if (_mapper == null || !_lastType.equals(type))
            {
                _lastType = type;
                BeanInfo beanInfo = (BeanInfo)component.getAttributes().get(UIComponent.BEANINFO_KEY);
                _mapper = createMetaRuleset(type , beanInfo).finish();
            }
           
            _mapper.applyMetadata(ctx, instance);
        }       
View Full Code Here

    if (base == null) {
      return null;
    }

    try {
      BeanInfo info = Introspector.getBeanInfo(base.getClass());
      PropertyDescriptor[] pds = info.getPropertyDescriptors();
      for (int i = 0; i < pds.length; i++) {
        pds[i].setValue(RESOLVABLE_AT_DESIGN_TIME, Boolean.TRUE);
        pds[i].setValue(TYPE, pds[i].getPropertyType());
      }
      return Arrays.asList((FeatureDescriptor[]) pds).iterator();
View Full Code Here

    public BeanProperties(Class<?> type) throws ELException {
      this.type = type;
      this.properties = new HashMap<String, BeanProperty>();
      try {
        BeanInfo info = Introspector.getBeanInfo(this.type);
        PropertyDescriptor[] pds = info.getPropertyDescriptors();
        for (int i = 0; i < pds.length; i++) {
          this.properties.put(pds[i].getName(), new BeanProperty(
              type, pds[i]));
        }
      } catch (IntrospectionException ie) {
View Full Code Here

        Class beanClass = getBeanClass();
        Set processedProperties = getProcessedPropertyNameSet();
        if ( beanClass != null ) {
            try {
                boolean attributesForPrimitives = getXMLInfoDigester().isAttributesForPrimitives();
                BeanInfo beanInfo = Introspector.getBeanInfo( beanClass );
                PropertyDescriptor[] descriptors = beanInfo.getPropertyDescriptors();
                if ( descriptors != null ) {
                    for ( int i = 0, size = descriptors.length; i < size; i++ ) {
                        PropertyDescriptor descriptor = descriptors[i];
                        // have we already created a property for this
                        String propertyName = descriptor.getName();
View Full Code Here

     * Sub is IndexedPropertyDescriptor, Super is PropertyDescriptor sub set,
     * indexed get. Super get
     */
    public void testIntrospection_7() throws IntrospectionException {
        Class<FakeFox501> beanClass = FakeFox501.class;
        BeanInfo info = Introspector.getBeanInfo(beanClass);
        PropertyDescriptor[] propertyDesc;
       
        assertEquals(0, info.getEventSetDescriptors().length);
        assertEquals(12, info.getMethodDescriptors().length);

        propertyDesc = info.getPropertyDescriptors();
        assertEquals(2, propertyDesc.length);

        for (PropertyDescriptor element : propertyDesc) {
            if (element.getName().equals("class")) {
                assertNull(element.getWriteMethod());
View Full Code Here

TOP

Related Classes of java.beans.BeanInfo

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.