/** * Gets all parameter value instances with additional information besides parameter value string. * * @return gets all parameter value instances with additional information besides parameter value string. */ public Collection<CustomParameterValue> getAllParameters() { return format.getTmpContext().getMap().values().stream() .map((TmpParamType param) -> new CustomParameterValue(param.getValue(), param.isDeleteOnExit())) .collect(Collectors.toList()); }
/** * Gets the parameter value as {@link CustomParameterValue} instance. * The returned parameter value contains additional information about the parameter, such as whether it should be deleted on exit. * * @param templateParameter a enum defining the parameter name * @return a parameter value instance with additional information besides parameter value string. */ public CustomParameterValue getParameterValue(TemplateParameter templateParameter) { if (format.getTmpContext() == null) { throw new TemplateParameterNotFoundException( templateParameter.toString(), "Conversion.xml doesn't contain any tmp context parameters."); } TmpParamType param = format.getTmpContext().getMap().get(templateParameter.getName()); if (param == null) { throw new TemplateParameterNotFoundException( templateParameter.toString(), "Conversion.xml doesn't contain '%s' tmp parameter."); } String paramValue = param.getValue(); if (StringUtils.isEmpty(paramValue)) { throw new TemplateParameterNotFoundException( templateParameter.toString(), "Conversion.xml contains an empty '%s' tmp parameter value."); } paramValue = paramValue.trim(); if (StringUtils.isEmpty(paramValue)) { throw new TemplateParameterNotFoundException( templateParameter.toString(), "Conversion.xml contains an empty '%s' tmp parameter value."); } return new CustomParameterValue(paramValue, param.isDeleteOnExit()); }