1 19 24 25 package org.netbeans.modules.j2ee.sun.share.configbean.customizers.data; 26 27 31 public class ParamMapping implements Comparable { 32 33 private PropertyParam param; 34 36 39 public ParamMapping(final PropertyParam pp) { 40 param = pp; 41 } 42 43 48 public boolean equals(Object obj) { 49 boolean result = false; 50 51 if(obj instanceof ParamMapping) { 55 if(this == obj) { 56 result = true; 57 } else { 58 ParamMapping targetMapping = (ParamMapping) obj; 59 PropertyParam targetParam = targetMapping.getParam(); 60 if(param != null) { 61 if(targetParam != null) { 62 result = param.getParamName().equals(targetParam.getParamName()); 63 } 64 } else if(targetParam == null) { 65 result = true; 66 } 67 } 68 } 69 return result; 70 } 71 72 76 public int hashCode() { 77 int hashcode = 509; if(param != null) { 79 hashcode = param.getParamName().hashCode(); 80 } 81 return hashcode; 82 } 83 84 88 public String toString() { 89 String result = ""; 90 if(param != null) { 91 result = param.getParamName(); 92 } 93 return result; 94 } 95 96 100 public PropertyParam getParam() { 101 return param; 102 } 103 104 110 public int compareTo(Object obj) { 111 int result = -1; 112 113 if(obj instanceof ParamMapping) { 120 if(this == obj) { 121 result = 0; 122 } else { 123 ParamMapping targetMapping = (ParamMapping) obj; 124 PropertyParam targetParam = targetMapping.getParam(); 125 if(param != null) { 126 if(targetParam != null) { 127 result = param.getParamName().compareTo(targetParam.getParamName()); 128 } else { 129 result = 1; 130 } 131 } else if(targetParam == null) { 132 result = 0; 133 } 134 } 135 } 136 137 return result; 138 } 139 } 140 | Popular Tags |