Package java.beans

Examples of java.beans.BeanInfo


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


            (PropertyDescriptor[]) descriptorsCache.get(beanClass);
  if (descriptors != null)
      return (descriptors);

  // Introspect the bean and cache the generated descriptors
  BeanInfo beanInfo = null;
  try {
      beanInfo = Introspector.getBeanInfo(bean.getClass());
  } catch (IntrospectionException e) {
      return (new PropertyDescriptor[0]);
  }
  descriptors = beanInfo.getPropertyDescriptors();
  if (descriptors == null)
      descriptors = new PropertyDescriptor[0];
        descriptorsCache.put(beanClass, descriptors);
  return (descriptors);
View Full Code Here

    }

    private static Map buildBeanClassMap(Class beanClass)
    {
        Map result = new HashMap();
        BeanInfo bi = null;

        try
        {
            bi = Introspector.getBeanInfo(beanClass);
        }
        catch (IntrospectionException ex)
        {
            throw new ApplicationRuntimeException(
                Tapestry.format("PropertyFinder.unable-to-introspect-class", beanClass.getName()),
                ex);
        }

        PropertyDescriptor[] pd = bi.getPropertyDescriptors();

        for (int i = 0; i < pd.length; i++)
        {
            PropertyDescriptor d = pd[i];
View Full Code Here

        return result;
    }

    protected Throwable buildDescription(Throwable exception)
    {
        BeanInfo info;
        Class exceptionClass;
        ExceptionProperty property;
        PropertyDescriptor[] descriptors;
        PropertyDescriptor descriptor;
        Throwable next = null;
        int i;
        Object value;
        Method method;
        ExceptionProperty[] properties;
        ExceptionDescription description;
        String stringValue;
        String message;
        String[] stackTrace = null;

        propertyDescriptions.clear();

        message = exception.getMessage();
        exceptionClass = exception.getClass();

        // Get properties, ignoring those in Throwable and higher
        // (including the 'message' property).

        try
        {
            info = Introspector.getBeanInfo(exceptionClass, Throwable.class);
        }
        catch (IntrospectionException e)
        {
            return null;
        }

        descriptors = info.getPropertyDescriptors();

        for (i = 0; i < descriptors.length; i++)
        {
            descriptor = descriptors[i];
View Full Code Here

     * specified object.
     */
    public static Object randomizeBean(Object bean)
    throws IntrospectionException, IllegalAccessException,
        InvocationTargetException, java.beans.IntrospectionException {
        BeanInfo info = Introspector.getBeanInfo(bean.getClass());
        PropertyDescriptor[] props = info.getPropertyDescriptors();
        for (int i = 0; i < props.length; i++) {
            Method write = props[i].getWriteMethod();
            if (write == null)
                continue;

View Full Code Here

    private void initialise() {
        Class  beanClass = getBean().getClass();
        try {
            //BeanInfo beanInfo = Introspector.getBeanInfo( bean, null );
            BeanInfo beanInfo = Introspector.getBeanInfo( beanClass );
            PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
            if ( propertyDescriptors != null ) {
                for ( int i = 0; i < propertyDescriptors.length; i++ ) {
                    PropertyDescriptor propertyDescriptor = propertyDescriptors[i];
                    if ( propertyDescriptor != null ) {
                        String name = propertyDescriptor.getName();
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

      try {
        Class<?> clazz = classLoader.loadClass(realClassName(cls));
        Object o = clazz.newInstance();

        // add any introspected properties
        BeanInfo beanInfo = Introspector.getBeanInfo(clazz);
        PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();

        for (PropertyDescriptor propertyDescriptor : propertyDescriptors) {
          String name = propertyDescriptor.getName();
          Class<?> type = propertyDescriptor.getPropertyType();
                    if (type == null) {
View Full Code Here

     Uses JavaBeans {@link Introspector} to computer setters of object to be
     configured.
   */
  protected void introspect() {
    try {
      BeanInfo bi = Introspector.getBeanInfo(obj.getClass());
      propertyDescriptors = bi.getPropertyDescriptors();
      methodDescriptors = bi.getMethodDescriptors();
    } catch (IntrospectionException ex) {
      getLogger().error(
        "Failed to introspect " + obj + ": " + ex.getMessage());
      propertyDescriptors = new PropertyDescriptor[0];
      methodDescriptors = new MethodDescriptor[0];
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

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.