Generate a default example value for parameter.

@param parameter parameter
@return a generated example for the parameter
162252
public static Object generateExample(AbstractSerializableParameter<?> parameter) {
        switch (parameter.getType()) {
            case "integer":
                return 0;
            case "number":
                return 0.0;
            case "boolean":
                return true;
            case "string":
                return ExamplesUtil.generateStringExample(parameter.getFormat(), parameter.getEnum());
            default:
                return parameter.getType();
        }
    }
1193705
public static void initStaticDefaultParameterValues(QueryParameter param,
                                                  Map<String, Object> parameterValues) throws QueryException {
        List<Serializable> defValues;
        if ((param.getDefaultValues() != null) && (param.getDefaultValues().size() > 0)) {
            defValues = param.getDefaultValues();
        } else {
			throw new QueryException(
					"Invalid use of method initStaticDefaultParameterValues : no static values for parameter "
							+ param.getName());
        }
        initDefaultParameterValues(param, defValues, parameterValues);
    }
497041
public static <T> T parameter(final String name, final T value) {
        final Parameter parameter = createParameter(name, value);
        getLifecycle().updateTestCase(testResult -> testResult.getParameters().add(parameter));
        return value;
    }
746268
function convertParameters(parameters) {
  return parameters.map(parameter => {
    const { required, name } = parameter;
    return {
      name,
      disabled: required !== true,
      value: `${generateParameterExample(parameter)}`,
    };
  });
}
497400
public static Map<String, ValueCommand> createParameterMap(Object... params) {
        assert params.length % 2 == 0;
        Map<String, ValueCommand> ret = new HashMap<String, ValueCommand>();
        for (int i = 0; i < params.length; i = i + 2) {
            String param = params[i].toString();
            Value value = convertFromJava(params[i + 1]);
            ret.put(param, new LiteralCommand(value));
        }
        return ret;
    }
419254
public static Class<? extends ArgumentExtractor> getArgumentExtractor(Parameter parameter) {
        for (Annotation annotation : parameter.getAnnotations()) {
            if (annotation.annotationType().isAnnotationPresent(ExtractWith.class)) {
                ExtractWith with = annotation.annotationType().getAnnotation(ExtractWith.class);
                Class<? extends ArgumentExtractor> extractorClass = with.value();
                return extractorClass;
            }
        }
        // if unspecified we use the ParamExtractor
        return ParamExtractor.class;
    }
408183
protected String getDescription(Parameter parameter) {
        if (parameter.isAnnotationPresent(Desc.class)) {
            Desc annotation = parameter.getAnnotation(Desc.class);
            return translate(annotation.key(), annotation.value());
        }
        return null;
    }
574128
private List<Map<Class<? extends Annotation>, ParameterInfo<?>>> createParametersInfos(Method method) {
    if (method.getParameterTypes().length <= 2) {
      return Collections.emptyList();
    }

    List<Map<Class<? extends Annotation>, ParameterInfo<?>>> result = new ArrayList<>();
    Type[] parameterTypes = method.getGenericParameterTypes();
    Annotation[][] parameterAnnotations = method.getParameterAnnotations();

    for (int i = 2; i < parameterAnnotations.length; i++) {
      Annotation[] annotations = parameterAnnotations[i];
      Map<Class<? extends Annotation>, ParameterInfo<?>> paramAnnotations = new IdentityHashMap<>();

      for (Annotation annotation : annotations) {
        Class<? extends Annotation> annotationType = annotation.annotationType();
        ParameterInfo<?> parameterInfo;

        if (PathParam.class.isAssignableFrom(annotationType)) {
          parameterInfo = ParameterInfo.create(annotation,
                                               ParamConvertUtils.createPathParamConverter(parameterTypes[i]));
        } else if (QueryParam.class.isAssignableFrom(annotationType)) {
          parameterInfo = ParameterInfo.create(annotation,
                                               ParamConvertUtils.createQueryParamConverter(parameterTypes[i]));
        } else if (HeaderParam.class.isAssignableFrom(annotationType)) {
          parameterInfo = ParameterInfo.create(annotation,
                                               ParamConvertUtils.createHeaderParamConverter(parameterTypes[i]));
        } else {
          parameterInfo = ParameterInfo.create(annotation, null);
        }

        paramAnnotations.put(annotationType, parameterInfo);
      }

      // Must have either @PathParam, @QueryParam or @HeaderParam, but not two or more.
      int presence = 0;
      for (Class<? extends Annotation> annotationClass : paramAnnotations.keySet()) {
        if (SUPPORTED_PARAM_ANNOTATIONS.contains(annotationClass)) {
          presence++;
        }
      }
      if (presence != 1) {
        throw new IllegalArgumentException(
          String.format("Must have exactly one annotation from %s for parameter %d in method %s",
                        SUPPORTED_PARAM_ANNOTATIONS, i, method));
      }

      result.add(Collections.unmodifiableMap(paramAnnotations));
    }

    return Collections.unmodifiableList(result);
  }
49198
@Override
	public Parameter doParameter(final Parameter parameter) {
		if (skipFilter || parameter == null) {
			return parameter;
		}

		if (Parameter.class.equals(parameter.getClass())) {
			// 通常のパラメータの場合
			String key = parameter.getParameterName();
			if (getCryptParamKeys().contains(CaseFormat.CAMEL_CASE.convert(key))) {
				Object obj = parameter.getValue();
				if (obj != null && obj instanceof String) {
					String objStr = obj.toString();
					if (StringUtils.isNotEmpty(objStr)) {
						try {
							synchronized (encryptCipher) {
								return new Parameter(key, encrypt(encryptCipher, secretKey, objStr));
							}
						} catch (Exception ex) {
							return parameter;
						}
					}
				}
			}
		}

		return parameter;
	}
905271
@Override
	public O withParameters(Configuration parameters) {
		this.parameters = parameters;

		@SuppressWarnings("unchecked")
		O returnType = (O) this;
		return returnType;
	}
1177609
public static String getExample(TypeDeclaration type) {
		if (type == null || type.example() == null) {
			return null;
		} else {
			return type.example().value();
		}
	}
683920
Parameter getCreateParameter(String name) {
		if (this.parameters == null)
			this.parameters = new HashMap<String, Parameter>();
		Parameter param = this.parameters.get(name);
		if (param == null) {
			param = new Parameter(name);
			this.parameters.put(name, param);
		}
		return param;
	}
346356
public T withParameter(ConfigurationParameters parameter, Object value) {
        configMap.put(parameter, value);
        return getThis();
    }
53382
public static boolean exampleHasAtLeastOneCriteriaCheck(Object parameter) {
        if (parameter != null) {
            try {
                if (parameter instanceof Example) {
                    List<Example.Criteria> criteriaList = ((Example) parameter).getOredCriteria();
                    if (criteriaList != null && criteriaList.size() > 0) {
                        return true;
                    }
                } else {
                    Method getter = parameter.getClass().getDeclaredMethod("getOredCriteria");
                    Object list = getter.invoke(parameter);
                    if(list != null && list instanceof List && ((List) list).size() > 0){
                        return true;
                    }
                }
            } catch (Exception e) {
                throw new MapperException(SAFE_DELETE_ERROR, e);
            }
        }
        throw new MapperException(SAFE_DELETE_EXCEPTION);
    }
344662
private String getParameter(String paramKey, String defaultValue) {
        String paramValue = defaultValue;
        if (StringUtils.isNotBlank(paramKey) && args != null && args.length > 0) {
            for (String arg : args) {
                String[] parameter = arg.split("=");
                if (parameter != null && parameter.length == 2 && paramKey.equals(parameter[0])) {
                    paramValue = parameter[1];
                    break;
                }
            }
        }
        return paramValue;
    }
1300325
private static Object getExamplesFromBodyParameter(Parameter parameter) {
        Object examples = ((BodyParameter) parameter).getExamples();
        if (examples == null) {
            examples = parameter.getVendorExtensions().get("x-examples");
        }
        return examples;
    }
505850
private function getParameterValue(array $parameter, $name, $default = null)
    {
        if (!array_key_exists($name, $parameter)) {
            return $default;
        }

        return $parameter[$name]->getValue();
    }