コード例 #1
0
 private void ensurePropertyKnown(String methodName, Method method) {
   String capPropertyName;
   String propertyName;
   boolean getter = false;
   if (methodName.startsWith("get")) {
     capPropertyName = methodName.substring(3);
     propertyName = uncapitalize(capPropertyName);
     getter = true;
   } else if (methodName.startsWith("set")) {
     capPropertyName = methodName.substring(3);
     propertyName = uncapitalize(capPropertyName);
   } else if (methodName.startsWith("is")) {
     capPropertyName = methodName.substring(2);
     propertyName = uncapitalize(capPropertyName);
     getter = true;
   } else {
     throw new IllegalArgumentException("methodName=" + methodName);
   }
   PropertyInfo pinfo = (PropertyInfo) this.properties.get(propertyName);
   if (pinfo == null) {
     pinfo = new PropertyInfo(propertyName);
     this.properties.put(propertyName, pinfo);
   }
   if (getter) {
     pinfo.setGetter(method);
   } else {
     pinfo.setSetter(method);
   }
 }
コード例 #2
0
 private void updateNameIndexer(String methodName, Method method) {
   boolean getter = true;
   if (methodName.startsWith("set")) {
     getter = false;
   }
   PropertyInfo indexer = this.nameIndexer;
   if (indexer == null) {
     indexer = new PropertyInfo("$item");
     this.nameIndexer = indexer;
   }
   if (getter) {
     indexer.setGetter(method);
   } else {
     indexer.setSetter(method);
   }
 }
コード例 #3
0
 private void updateIntegerIndexer(String methodName, Method method) {
   boolean getter;
   if (methodName.startsWith("get")) {
     getter = true;
   } else if (methodName.startsWith("set")) {
     getter = false;
   } else {
     throw new IllegalArgumentException("methodName=" + methodName);
   }
   PropertyInfo indexer = this.integerIndexer;
   if (indexer == null) {
     indexer = new PropertyInfo("$item");
     this.integerIndexer = indexer;
   }
   if (getter) {
     indexer.setGetter(method);
   } else {
     indexer.setSetter(method);
   }
 }