Examples of PropertyDescriptor


Examples of java.beans.PropertyDescriptor

    if (name == null)
    {
      throw new NullPointerException("Name must not be null");
    }
    final PropertySpecification ps = new PropertySpecification(name);
    final PropertyDescriptor pd = (PropertyDescriptor) properties.get(ps.getName());
    if (pd == null)
    {
      throw new BeanException("No such property:" + name);
    }
    return BeanUtility.getPropertyType(pd);
View Full Code Here

Examples of java.beans.PropertyDescriptor

  {
    final ArrayList propertyNames = new ArrayList();
    final PropertyDescriptor[] pd = getPropertyInfos();
    for (int i = 0; i < pd.length; i++)
    {
      final PropertyDescriptor property = pd[i];
      if (property.isHidden())
      {
        continue;
      }
      if (property.getReadMethod() == null ||
          property.getWriteMethod() == null)
      {
        // it will make no sense to write a property now, that
        // we can't read in later...
        continue;
      }
      if (BeanUtility.getPropertyType(property).isArray())
      {
        final int max = findMaximumIndex(property);
        for (int idx = 0; idx < max; idx++)
        {
          propertyNames.add(property.getName() + '[' + idx + ']');
        }
      }
      else
      {
        propertyNames.add(property.getName());
      }
    }
    return (String[]) propertyNames.toArray(new String[propertyNames.size()]);
  }
View Full Code Here

Examples of java.beans.PropertyDescriptor

    propertyEditorClass = attrs.getValue(getUri(), "propertyEditor");

    final PropertyDescriptor[] descriptors = expression.getPropertyDescriptors();
    for (int i = 0; i < descriptors.length; i++)
    {
      final PropertyDescriptor maybeDescriptor = descriptors[i];
      if (name.equals(maybeDescriptor.getName()))
      {
        descriptor = maybeDescriptor;
        break;
      }
    }
View Full Code Here

Examples of java.beans.PropertyDescriptor

    propertyEditorClass = attrs.getValue(getUri(), "propertyEditor"); // NON-NLS
    final PropertyDescriptor[] descriptors = expression.getPropertyDescriptors();
    for (int i = 0; i < descriptors.length; i++)
    {
      final PropertyDescriptor maybeDescriptor = descriptors[i];
      if (name.equals(maybeDescriptor.getName()))
      {
        descriptor = maybeDescriptor;
        break;
      }
    }
View Full Code Here

Examples of java.beans.PropertyDescriptor

        assertEquals(Double.class, ((CollectionType) type).getComponentType().getTypeClass());
    }
   
    public void testPDType() throws Exception
    {
        PropertyDescriptor pd =
            Introspector.getBeanInfo(MapDTO.class, Object.class).getPropertyDescriptors()[0];
        Type type = creator.createType(pd);
        tm.register(type);
        assertTrue( type instanceof MapType );
       
View Full Code Here

Examples of java.beans.PropertyDescriptor

        assertTrue(type.getTypeClass().isAssignableFrom(String.class));
    }
   
    public void testPDType() throws Exception
    {
        PropertyDescriptor pd =
            Introspector.getBeanInfo(CollectionDTO.class, Object.class).getPropertyDescriptors()[0];
        Type type = creator.createType(pd);
        tm.register(type);
        assertTrue( type instanceof CollectionType );
       
View Full Code Here

Examples of java.beans.PropertyDescriptor

    @Override public void trash(Class<? extends DomainEntity> entityClass, UUID pk, String path) throws Exception {
        Assert.notNull(entityClass);
        if (pk != null) {
            DomainEntity entity = dao.find(entityClass, pk);
            if (entity != null) {
                PropertyDescriptor property = BeanUtils.getPropertyDescriptor(entityClass, path);
                if ((property != null) && (Document.class.isAssignableFrom(property.getPropertyType()))) {
                    Document doc = (Document) property.getReadMethod().invoke(entity);
                    if (doc != null) {
                        doc.setTemporal(true);
                        dao.update(doc);
                    }
                }
View Full Code Here

Examples of java.beans.PropertyDescriptor

        return new QName(ns, name);
    }

    public boolean isNillable(QName name)
    {
        PropertyDescriptor desc = getPropertyDescriptorFromMappedName(name);
       
        if (isAnnotatedElement(desc))
        {
            XmlElement att = desc.getReadMethod().getAnnotation(XmlElement.class);
            return att.nillable();
        }
        else
        {
            return super.isNillable(name);
View Full Code Here

Examples of java.beans.PropertyDescriptor

        }
    }
   
    public int getMinOccurs ( QName name )
    {
        PropertyDescriptor desc = getPropertyDescriptorFromMappedName(name);       
        if (isAnnotatedElement(desc))
        {
            XmlElement att = desc.getReadMethod().getAnnotation(XmlElement.class);
            String minOccurs = att.minOccurs();
            if ( minOccurs != null && minOccurs.length() > 0 )
            {
                return Integer.parseInt( minOccurs );
            }
View Full Code Here

Examples of java.beans.PropertyDescriptor

    */
   private Object setInvoke(String property, Object impl, Class aClass, String[] argValuesAsStrings) throws XmlBlasterException {
      try {
         Method method = null;
         try {
            PropertyDescriptor desc = new PropertyDescriptor(property, aClass); // if property=value it looks for setValue() or getValue()
            method = desc.getWriteMethod();
         }
         catch (IntrospectionException e) { // try operations like 'addProperty' without set/get prefix
         }
         if (method == null) {
            Method[] m = aClass.getMethods();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.