Ejemplo n.º 1
0
  /**
   * Gets the field value.
   *
   * @return the value of the field
   */
  public Object value() {
    if (!convert1st) {
      FieldAccess field = field();
      if (field != null) {
        switch (field.typeEnum()) {
          case NUMBER:
            this.value = (VALUE) Conversions.coerce(field.type(), this.value);
            return new MyNumber(this.value);

          case ARRAY:
          case ARRAY_INT:
          case ARRAY_BYTE:
          case ARRAY_SHORT:
          case ARRAY_FLOAT:
          case ARRAY_DOUBLE:
          case ARRAY_LONG:
          case ARRAY_STRING:
          case ARRAY_OBJECT:
          case COLLECTION:
          case SET:
          case LIST:
            this.value = (VALUE) Conversions.coerce(field.getComponentClass(), this.value);
            break;
          default:
            this.value = (VALUE) Conversions.coerce(field.type(), this.value);
        }
      }
      convert1st = true;
    }
    return value;
  }
Ejemplo n.º 2
0
 /**
  * Gets the field value.
  *
  * @return the value of the field
  */
 public Object value() {
   if (!convert1st) {
     FieldAccess field = field();
     if (field != null) {
       switch (field.typeEnum()) {
         case ARRAY:
         case COLLECTION:
         case SET:
         case LIST:
           this.value = (VALUE) Conversions.coerce(field.getComponentClass(), this.value);
           break;
         default:
           this.value = (VALUE) Conversions.coerce(field.type(), this.value);
       }
     }
     convert1st = true;
   }
   return value;
 }