< prev index next >

## src/com/sun/javatest/cof/COFItem.java

Print this page

      36 import java.util.Arrays;
      37 import java.util.Collection;
      38 import java.util.Comparator;
      39 import java.util.Date;
      40 import java.util.Iterator;
      41 import java.util.LinkedHashMap;
      42
      43 import com.sun.javatest.util.XMLWriter;
      44
      45 abstract class COFItem
      46 {
      47     BeanInfo bi = null;
      48     LinkedHashMap itemAttributes = getItemAttributes();
      49     LinkedHashMap itemElements = getItemElements();
      50     String itemTagName = getItemTagName();
      51     PropertyDescriptor [] pds = null;
      52
      53     private String[] getAttributeProperties() {
      54         return itemAttributes == null? null: (String []) itemAttributes.keySet().toArray(new String[itemAttributes.size()]);
      55     }
      56     LinkedHashMap getItemAttributes(){
      57         return null;
      58     }
      59     LinkedHashMap getItemElements() {
      60         return null;
      61     };
      62
      63     String getItemTagName(){
      64         return null;
      65     }
      66
      67     Object getProperty(String name) {
      68         if (bi == null) {
      69             try {
      70                 bi = Introspector.getBeanInfo(this.getClass());
      71                 pds = bi.getPropertyDescriptors();
      72                 Arrays.sort(pds, new Comparator() {
      73                     public int compare(Object o1, Object o2) {
      74                         PropertyDescriptor pd1 = (PropertyDescriptor) o1;
      75                         PropertyDescriptor pd2 = (PropertyDescriptor) o2;
      76                         return pd1.getName().compareTo(pd2.getName());
      77                     }
      78                 });
      79             } catch (IntrospectionException e) {
      36 import java.util.Arrays;
      37 import java.util.Collection;
      38 import java.util.Comparator;
      39 import java.util.Date;
      40 import java.util.Iterator;
      41 import java.util.LinkedHashMap;
      42
      43 import com.sun.javatest.util.XMLWriter;
      44
      45 abstract class COFItem
      46 {
      47     BeanInfo bi = null;
      48     LinkedHashMap itemAttributes = getItemAttributes();
      49     LinkedHashMap itemElements = getItemElements();
      50     String itemTagName = getItemTagName();
      51     PropertyDescriptor [] pds = null;
      52
      53     private String[] getAttributeProperties() {
      54         return itemAttributes == null? null: (String []) itemAttributes.keySet().toArray(new String[itemAttributes.size()]);
      55     }
      56     LinkedHashMap<String, String> getItemAttributes(){
      57         return null;
      58     }
      59     LinkedHashMap<String, String> getItemElements() {
      60         return null;
      61     };
      62
      63     String getItemTagName(){
      64         return null;
      65     }
      66
      67     Object getProperty(String name) {
      68         if (bi == null) {
      69             try {
      70                 bi = Introspector.getBeanInfo(this.getClass());
      71                 pds = bi.getPropertyDescriptors();
      72                 Arrays.sort(pds, new Comparator() {
      73                     public int compare(Object o1, Object o2) {
      74                         PropertyDescriptor pd1 = (PropertyDescriptor) o1;
      75                         PropertyDescriptor pd2 = (PropertyDescriptor) o2;
      76                         return pd1.getName().compareTo(pd2.getName());
      77                     }
      78                 });
      79             } catch (IntrospectionException e) {

< prev index next >