@Override public String randomValueAsString(Field<TYPE> field) { TYPE randomValue = randomValue(field); String stringValue = randomValue.toString(); if (field.getPadding() != null) { long maxLength = field.getMaxLength() != 0 ? field.getMaxLength() : field.getFixedLength(); stringValue = paddedRandomValue(field.getPadding(), randomValue, maxLength); } return stringValue; }
protected String getValueWithPadding(String value, Field field) { int paddingLength = field.getFixedLength() - value.length(); StringBuilder valueWithPadding = new StringBuilder(); for (int i = 0; i < paddingLength; i++) { valueWithPadding.append(field.getPadding()); } return valueWithPadding.append(value).toString(); }