code: public TypeConverter getTypeConverter() throws RpcException {
          if (contract == null) {
              throw new IllegalStateException("contract cannot be null");
          }
          if (type == null) {
              throw new IllegalStateException("field type cannot be null");
          }
  
          TypeConverter tc = null;
  
          if (type.equals("string"))
              tc = new StringTypeConverter(isOptional);
          else if (type.equals("int"))
              tc = new IntTypeConverter(isOptional);
          else if (type.equals("float"))
              tc = new FloatTypeConverter(isOptional);
          else if (type.equals("bool"))
              tc = new BoolTypeConverter(isOptional);
          else {
              Struct s = contract.getStructs().get(type);
              if (s != null) {
                  tc = new StructTypeConverter(s, isOptional);
              }
  
              Enum e = contract.getEnums().get(type);
              if (e != null) {
                  tc = new EnumTypeConverter(e, isOptional);
              }
          }
  
          if (tc == null) {
              throw RpcException.Error.INTERNAL.exc("Unknown type: " + type);
          }
          else if (isArray) {
              return new ArrayTypeConverter(tc, isOptional);
          }
          else {
              return tc;
          }
      }
docs: Returns a new TypeConverter appropriate for the Field's type.
  
  @throws RpcException If type is not defined in the Contract