Package java.beans

Examples of java.beans.PropertyDescriptor


    }
  }

  public boolean addProperty(String name, String value) throws Exception {
    if (name.startsWith("#")) name = name.substring(1);
    PropertyDescriptor pd[] = info.getPropertyDescriptors();
    for (int i = 0; i < pd.length; i++) {
      if (getPublicName(pd[i]).equals(name)) {
        // array properties (append value)
        if (pd[i].getPropertyType().isArray()
            && pd[i].getPropertyType().getComponentType() == String.class) {
View Full Code Here


      return dname;
    } else return pd.getName();
  }

  public String[] getPropertyValues(String name) throws Exception {
    PropertyDescriptor pd[] = info.getPropertyDescriptors();
    for (int i = 0; i < pd.length; i++) {
      if (pd[i].getName().equals(name)) {
        if (pd[i].getPropertyType().isArray()
            && pd[i].getPropertyType().getComponentType() == String.class) {
          return (String[]) getGetter(pd[i]).invoke(this,
View Full Code Here

    return null;
  }

  public boolean addContent(XMLBean b) throws Exception {
    if (b == null) return false;
    PropertyDescriptor pd[] = info.getPropertyDescriptors();
    String bName = b.info.getBeanDescriptor().getDisplayName();
    if (pd.length > 0 && _any == null)
      _any = new Vector<XMLBean>();
    for (int i = 0; i < pd.length; i++) {
      // compare fully qualified names
View Full Code Here

  }

  public NodeList getChildNodes(XMLBean bean, Document doc)
    throws Exception {
    ContentNodeList nl = new ContentNodeList();
    PropertyDescriptor pd[] = bean.info.getPropertyDescriptors();
    for (int i = 0; i < pd.length; i++) {
      if (pd[i].getPropertyType().isArray()) {
        Class c = pd[i].getPropertyType().getComponentType();
        if (XMLBean.class.isAssignableFrom(c)) {
          // multiple elements
View Full Code Here

  }

  public NamedNodeMap getAttributes(XMLBean bean, Document doc)
    throws Exception {
    NamedNodeMap map = new ContentNamedNodeMap();
    PropertyDescriptor pd[] = bean.info.getPropertyDescriptors();
    for (int i = 0; i < pd.length; i++) {
      if (!pd[i].getPropertyType().isArray()
        && pd[i].getPropertyType() == String.class) {
        Method getter = bean.getGetter(pd[i]);
        String value = (String) getter.invoke(bean, new Object[] {
View Full Code Here

    qNames = new QName[size];
    readMethods = new Method[size];
    writeMethods = new Method[size];

    for (int i = 0; i < size; i++) {
      PropertyDescriptor propertyDescriptor = propertyDescriptors[i];
      String name = propertyDescriptor.getName();
      QName qName = DOCUMENT_FACTORY.createQName(name);
      qNames[i] = qName;
      readMethods[i] = propertyDescriptor.getReadMethod();
      writeMethods[i] = propertyDescriptor.getWriteMethod();

      Integer index = new Integer(i);
      nameMap.put(name, index);
      nameMap.put(qName, index);
    }
View Full Code Here

  }

  public NodeList getChildNodes(XMLBean bean, Document doc)
    throws Exception {
    ContentNodeList nl = new ContentNodeList();
    PropertyDescriptor pd[] = bean.info.getPropertyDescriptors();
    for (int i = 0; i < pd.length; i++) {
      // The property display name is fully qualified, unlike name which refers to the java attribute
      if (pd[i].getDisplayName() == null
        || !pd[i].getDisplayName().equals(name))
        continue;
View Full Code Here

  /**
   * @see java.beans.BeanInfo#getPropertyDescriptors()
   */
  public PropertyDescriptor[] getPropertyDescriptors() {
    PropertyDescriptor lang, pcdata;
    try {
      lang = new PropertyDescriptor("lang", BEAN);
      lang.setDisplayName("xml:lang");
      pcdata = new PropertyDescriptor("_pcdata", BEAN);
      return new PropertyDescriptor[] {
        lang,
        pcdata
      };
    } catch (IntrospectionException e) {
View Full Code Here

      return null;
    }
  }

  protected PropertyDescriptor describeAttribute(String name, Class bean) throws IntrospectionException {
    return new PropertyDescriptor(name, bean)
  }
View Full Code Here

  protected PropertyDescriptor describeAttribute(String name, Class bean) throws IntrospectionException {
    return new PropertyDescriptor(name, bean)
  }

  protected PropertyDescriptor describeAttributeReserved(String name, Class bean) throws IntrospectionException {
    PropertyDescriptor pd;
    pd = new PropertyDescriptor("_"+name, bean)
    pd.setDisplayName(name);
    return pd;
  }
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.