Package java.beans

Examples of java.beans.BeanInfo


      throws BeanException {
      PropertyDescriptor[] result = null;

      try {
         if (fromBean != null) {
            BeanInfo beanInfo = Introspector.getBeanInfo(fromBean.getClass());

            result = beanInfo.getPropertyDescriptors();
         }
      } catch (IntrospectionException e) {
         String type = "null"; //$NON-NLS-1$
         if ( fromBean != null ) {
            type = fromBean.getClass().getName();
View Full Code Here


        if ( bean != null)
        {
            try
            {
                Map out = new HashMap();
                BeanInfo beanInfo = Introspector.getBeanInfo( bean.getClass(), Object.class ); //so we don't see getClass() as a property
                PropertyDescriptor[] pds = beanInfo.getPropertyDescriptors();
                //System.err.println("ignoreProps: " + ignoreProps );
                for( int i = 0, len = pds.length; i < len; ++i)
                {
                    PropertyDescriptor pd = pds[i];
View Full Code Here

        // In some race conditions, we may hit this method for the same class multiple times.
        // We just let it happen, replacing the old ClassPropertyAdapter with a new one.

        try
        {
            BeanInfo info = Introspector.getBeanInfo(forClass);

            List<PropertyDescriptor> descriptors = CollectionFactory.newList();

            addAll(descriptors, info.getPropertyDescriptors());

            if (forClass.isInterface())
                addPropertiesFromExtendedInterfaces(forClass, descriptors);

            addPropertiesFromScala(forClass, descriptors);
View Full Code Here

        while (!queue.isEmpty())
        {
            Class c = queue.removeFirst();

            BeanInfo info = Introspector.getBeanInfo(c);

            addAll(descriptors, info.getPropertyDescriptors());
            addAll(queue, c.getInterfaces());
        }
    }
View Full Code Here

     * {@inheritDoc}
     */
    public void buildMetaBean(MetaBean meta) throws Exception {
        if(meta.getBeanClass() == null) return; // handle only, when local class exists

        BeanInfo info = Introspector.getBeanInfo(meta.getBeanClass());
        if (info.getBeanDescriptor() != null) {
            meta.setName(
                  info.getBeanDescriptor().getName()); // (display?)name = simple class name!
        }
        for (PropertyDescriptor pd : info.getPropertyDescriptors()) {
            if (!(pd instanceof IndexedPropertyDescriptor || pd.getName().equals("class"))) {
                MetaProperty metaProp = buildMetaProperty(pd);
                meta.putProperty(pd.getName(), metaProp);
            }
        }
View Full Code Here

    }

    public PropertyDescriptor[] getPropertyDescriptors() {
        if (propertyDescriptors == null) {
            try {
                BeanInfo bi = null;
                if (clazz.isInterface()) {
                    bi = Introspector.getBeanInfo(clazz);
                }
                else {
                    bi = Introspector.getBeanInfo(clazz, Object.class);
                }
                PropertyDescriptor[] pds = bi.getPropertyDescriptors();
                propertyDescriptors = new PropertyDescriptor[pds.length];
                System.arraycopy(pds, 0, propertyDescriptors, 0, pds.length);
                Arrays.sort(propertyDescriptors, new Comparator() {
                    public int compare(Object left, Object right) {
                        return ((PropertyDescriptor) left).getName().compareTo(
View Full Code Here

            this.tagHandlerClass = tagHandlerClass;
            this.methodMaps = new Hashtable<>();
            this.propertyEditorMaps = new Hashtable<>();

            try {
                BeanInfo tagClassInfo = Introspector
                        .getBeanInfo(tagHandlerClass);
                PropertyDescriptor[] pd = tagClassInfo.getPropertyDescriptors();
                for (int i = 0; i < pd.length; i++) {
                    /*
                     * FIXME: should probably be checking for things like
                     * pageContext, bodyContent, and parent here -akv
                     */
 
View Full Code Here

    private PropertyDescriptor descriptor(Class clazz, String name)
    {

        System.err.println("descriptor(class=" + clazz.getName() + ", name="
                + name);
        BeanInfo info = null;
        try
        {
            info = Introspector.getBeanInfo(clazz);
            System.err.println("  Found BeanInfo " + info);
        }
        catch (IntrospectionException e)
        {
            throw new EvaluationException(e);
        }
        PropertyDescriptor[] descriptors = info.getPropertyDescriptors();
        for (int i = 0; i < descriptors.length; i++)
        {
            if (name.equals(descriptors[i].getName()))
            {
                System.err
View Full Code Here

  private static PropertyDescriptor getPropertyDescriptor(Class<?> type, String propertyName) {

    try {

      BeanInfo info = Introspector.getBeanInfo(type);

      for (PropertyDescriptor descriptor : info.getPropertyDescriptors()) {
        if (descriptor.getName().equals(propertyName)) {
          return descriptor;
        }
      }
View Full Code Here

    public Date convertDate(String value) throws ParseException {
        return new SimpleDateFormat("dd/MM/yyyy").parse(value);
    }

    public static Method methodFor(String methodName) throws IntrospectionException {
        BeanInfo beanInfo = Introspector.getBeanInfo(ExamplesTableBehaviour.class);
        for (MethodDescriptor md : beanInfo.getMethodDescriptors()) {
            if (md.getMethod().getName().equals(methodName)) {
                return md.getMethod();
            }
        }
        return null;
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.