1 2 12 package com.versant.core.jdo; 13 14 import java.io.Serializable ; 15 16 22 public class PropertyInfo implements Serializable , Comparable { 23 24 public static final int TYPE_SERVER_BEAN = 1; 25 public static final int TYPE_INT = 2; 26 public static final int TYPE_STRING = 3; 27 public static final int TYPE_BOOLEAN = 4; 28 29 private String name; 30 private int type; 31 private String displayName; 32 private String description; 33 private Object value; 34 private PropertyInfo[] children; 35 36 public PropertyInfo() { 37 } 38 39 public String getName() { 40 return name; 41 } 42 43 public void setName(String name) { 44 this.name = name; 45 } 46 47 public int getType() { 48 return type; 49 } 50 51 public void setType(int type) { 52 this.type = type; 53 } 54 55 public String getDisplayName() { 56 return displayName; 57 } 58 59 public void setDisplayName(String displayName) { 60 this.displayName = displayName; 61 } 62 63 public String getDescription() { 64 return description; 65 } 66 67 public void setDescription(String description) { 68 this.description = description; 69 } 70 71 public Object getValue() { 72 return value; 73 } 74 75 public void setValue(Object value) { 76 this.value = value; 77 } 78 79 public PropertyInfo[] getChildren() { 80 return children; 81 } 82 83 public void setChildren(PropertyInfo[] children) { 84 this.children = children; 85 } 86 87 90 public int compareTo(Object o) { 91 return name.compareTo(((PropertyInfo)o).name); 92 } 93 94 public String toString() { 95 if (type == TYPE_SERVER_BEAN) { 96 return displayName; 97 } 98 return displayName + ": " + value; 99 } 100 101 104 public void dump(String indent) { 105 System.out.println(indent + this); 106 if (type == TYPE_SERVER_BEAN) { 107 indent = indent + " "; 108 int n = children.length; 109 for (int i = 0; i < n; i++) children[i].dump(indent); 110 } 111 } 112 113 116 public PropertyInfo findChild(String name) { 117 if (children == null) return null; 118 for (int i = children.length - 1; i >= 0; i--) { 119 PropertyInfo child = children[i]; 120 if (child.name.equals(name)) return child; 121 } 122 return null; 123 } 124 } 125 | Popular Tags |