Exemplo n.º 1
0
 @Override
 public void set(Object object, int methodIndex, Object value) {
   switch (methodIndex) {
     case 0: // privIntValue;
       ((BTest) object).setPrivIntValue(((Number) value).intValue());
       break;
     case 1: // privStrValue;
       ((BTest) object).setPrivStrValue((String) value);
       break;
     case 2: // pubStrValue;
       ((BTest) object).pubStrValue = (String) value;
       break;
     case 3: // pubIntValue;
       ((BTest) object).pubIntValue = ((Number) value).intValue();
       break;
     case 4: // pubBoolValue;
       ((BTest) object).pubBoolValue = ((Boolean) value).booleanValue();
       break;
     case 5:
       ((BTest) object).pubIntegerValue = DefaultConverter.convertToInt(value);
       break;
     case 6:
       ((BTest) object).pubTEnum = TEnum.valueOf((String) value);
       break;
     default:
       break;
   }
 }
Exemplo n.º 2
0
  /** set field value by fieldname */
  @Override
  public void set(Object object, String methodName, Object value) {
    if ("privIntValue".equals(methodName)) {
      ((BTest) object).setPrivIntValue(DefaultConverter.convertToint(value));
      return;
    }
    if ("privStrValue".equals(methodName)) {
      if (value != null) value = value.toString();
      ((BTest) object).setPrivStrValue((String) value);
      return;
    }

    if ("pubStrValue".equals(methodName)) {
      if (value != null) value = value.toString();
      ((BTest) object).pubStrValue = (String) value;
      return;
    }
    if ("pubIntValue".equals(methodName)) {
      ((BTest) object).pubIntValue = DefaultConverter.convertToint(value);
      return;
    }
    if ("pubBoolValue".equals(methodName)) {
      ((BTest) object).pubBoolValue = DefaultConverter.convertTobool(value);
      return;
    }
    if ("pubIntegerValue".equals(methodName)) {
      ((BTest) object).pubIntegerValue = DefaultConverter.convertToInt(value);
      return;
    }
    if ("pubTEnum".equals(methodName)) {
      ((BTest) object).pubTEnum = TEnum.valueOf((String) value);
      return;
    }
  }
Exemplo n.º 3
0
 public void setInt(Object object, int methodIndex, Object value) {
   if (methodIndex == 0) {
     ((BTest) object).setPrivIntValue(((Number) value).intValue());
     return;
   }
   if (methodIndex == 1) {
     ((BTest) object).setPrivStrValue((String) value);
     return;
   }
   if (methodIndex == 2) {
     ((BTest) object).pubStrValue = (String) value;
     return;
   }
   if (methodIndex == 3) {
     ((BTest) object).pubIntValue = ((Number) value).intValue();
     return;
   }
   if (methodIndex == 4) {
     ((BTest) object).pubBoolValue = ((Boolean) value).booleanValue();
     return;
   }
   if (methodIndex == 5) {
     ((BTest) object).pubBoolValue = ((Boolean) value).booleanValue();
     return;
   }
   if (methodIndex == 0) {
     ((BTest) object).pubBoolValue = ((Boolean) value).booleanValue();
     return;
   }
   if (methodIndex == 7) {
     ((BTest) object).pubBoolValue = ((Boolean) value).booleanValue();
     return;
   }
   if (methodIndex == 8) {
     ((BTest) object).pubBoolValue = ((Boolean) value).booleanValue();
     return;
   }
 }