Package java.beans

Examples of java.beans.PropertyDescriptor


    }
  }
 
  private static PropertyDescriptor buildPropertyDescriptor(Class clazz, String name, String displayName, Class propertyEditorClass, boolean bound) throws IntrospectionException
  {
    final PropertyDescriptor pd = new PropertyDescriptor(name, clazz);
    pd.setDisplayName(displayName);
    pd.setPropertyEditorClass(propertyEditorClass);
    pd.setBound(bound)
    return pd;
  }
View Full Code Here


      if (i >= pds2.length)
      {
        print(pds[i]);
        continue;
      }
      PropertyDescriptor a = pds[i];
      PropertyDescriptor b = pds2[i];
      if (!a.equals(b))
      {
        print(a);
        print(b);
        System.out.println("eq: " + eq(a, b));
View Full Code Here

    return true;
  }
 
  private static PropertyDescriptor buildPropertyDescriptor(Class clazz, String name, String displayName, Class propertyEditorClass, boolean bound) throws IntrospectionException
  {
    final PropertyDescriptor pd = new PropertyDescriptor(name, clazz);
    pd.setDisplayName(displayName);
    pd.setPropertyEditorClass(propertyEditorClass);
    pd.setBound(bound)
    return pd;
  }
View Full Code Here

  }

  PropertyDescriptor[] props = desc.getPropertyDescriptors();
  ArrayList<PropertyDescriptor> list = new ArrayList<PropertyDescriptor>();
  for (int i = 0; i < props.length; i++) {
      PropertyDescriptor pd = props[i];
      if (!isIgnoreProperty(pd)) {
    list.add(pd);
      }
  }
  props = new PropertyDescriptor[list.size()];
  list.toArray(props);

  BeansFieldEntry[] entries = new BeansFieldEntry[props.length];
  for (int i = 0; i < props.length; i++) {
      PropertyDescriptor p = props[i];
      int index = getPropertyIndex(p);
      if (index >= 0) {
    if (entries[index] != null) {
        throw new TemplateBuildException("duplicated index: "
          + index);
    }
    if (index >= entries.length) {
        throw new TemplateBuildException("invalid index: " + index);
    }
    entries[index] = new BeansFieldEntry(p);
    props[index] = null;
      }
  }
  int insertIndex = 0;
  for (int i = 0; i < props.length; i++) {
      PropertyDescriptor p = props[i];
      if (p != null) {
    while (entries[insertIndex] != null) {
        insertIndex++;
    }
    entries[insertIndex] = new BeansFieldEntry(p);
View Full Code Here

    } catch (ClassNotFoundException e) {
      throw new LayerException(ExceptionCode.FEATURE_MODEL_PROBLEM, "Feature class "
          + vectorLayerInfo.getFeatureInfo().getDataSourceName() + " was not found", e);
    }
    this.srid = srid;
    PropertyDescriptor d = BeanUtils.getPropertyDescriptor(beanClass, getGeometryAttributeName());
    Class geometryClass = d.getPropertyType();
    if (Geometry.class.isAssignableFrom(geometryClass)) {
      wkt = false;
    } else if (geometryClass == String.class) {
      wkt = true;
    } else {
View Full Code Here

      writeProperty(bean, name, value);
    }

    private Object readProperty(Object object, String name) throws LayerException {
      if (object != null) {
        PropertyDescriptor d = BeanUtils.getPropertyDescriptor(object.getClass(), name);
        if (d != null && d.getReadMethod() != null) {
          BeanUtils.getPropertyDescriptor(object.getClass(), name);
          Method m = d.getReadMethod();
          if (!Modifier.isPublic(m.getDeclaringClass().getModifiers())) {
            m.setAccessible(true);
          }
          Object value;
          try {
View Full Code Here

      }
    }

    private void writeProperty(Object object, String name, Object value) throws LayerException {
      if (object != null) {
        PropertyDescriptor d = BeanUtils.getPropertyDescriptor(object.getClass(), name);
        if (d != null && d.getWriteMethod() != null) {
          Method m = d.getWriteMethod();
          if (!Modifier.isPublic(m.getDeclaringClass().getModifiers())) {
            m.setAccessible(true);
          }
          try {
            m.invoke(object, value);
View Full Code Here

    if(descriptors != null)
    {
      ArrayList fields = new ArrayList(descriptors.length);
     
      for (int i = 0; i < descriptors.length; i++) {
        PropertyDescriptor descriptor = descriptors[i];
       
        if (!(descriptor instanceof IndexedPropertyDescriptor) && descriptor.getReadMethod() != null)
        {
          JRDesignField field = new JRDesignField();
          field.setValueClassName(normalizeClass(descriptor.getPropertyType()).getName());
          field.setName(descriptor.getName());
         
          fields.add(field);
        }
      }
 
View Full Code Here

        associationAttributeInfo.getFeature().getIdentifier());
    return new AssociationValue(id, attributes, primitiveOnly);
  }

  private Object getBeanProperty(Object bean, String property) throws GeomajasException {
    PropertyDescriptor d = BeanUtils.getPropertyDescriptor(bean.getClass(), property);
    if (d != null) {
      Method m = d.getReadMethod();
      if (m != null) {
        if (!Modifier.isPublic(m.getDeclaringClass().getModifiers())) {
          m.setAccessible(true);
        }
        Object value;
View Full Code Here

  }

  @edu.umd.cs.findbugs.annotations.SuppressWarnings(value = "REC_CATCH_EXCEPTION")
  private void assignId(Object bean, String beanName, boolean override) {
    try {
      PropertyDescriptor descriptor = BeanUtils.getPropertyDescriptor(bean.getClass(), "id");
      if (descriptor != null) {
        if (override || (descriptor.getReadMethod().invoke(bean, null) == null)) {
          descriptor.getWriteMethod().invoke(bean, beanName);
        }
      }
    } catch (Exception be) {
      // ignore if no id property
    }
    try {
      PropertyDescriptor descriptor = BeanUtils.getPropertyDescriptor(bean.getClass(), "name");
      if (descriptor != null) {
        if (override || (descriptor.getReadMethod().invoke(bean, null) == null)) {
          descriptor.getWriteMethod().invoke(bean, beanName);
        }
      }
    } catch (Exception be) {
      // ignore if no name property
    }
View Full Code Here

TOP

Related Classes of java.beans.PropertyDescriptor

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.