| | |
| | | * |
| | | * @return The constructed value set. |
| | | */ |
| | | private static LinkedHashSet<AttributeValue> getValueSet(long intValue, |
| | | private static LinkedHashSet<ByteString> getValueSet(long intValue, |
| | | String unit) |
| | | { |
| | | if (unit == null) |
| | |
| | | return null; |
| | | } |
| | | |
| | | LinkedHashSet<AttributeValue> valueSet = |
| | | new LinkedHashSet<AttributeValue>(1); |
| | | |
| | | String valueString = intValue + " " + unit; |
| | | valueSet.add(AttributeValues.create(ByteString.valueOf(valueString), |
| | | ByteString.valueOf(valueString))); |
| | | |
| | | LinkedHashSet<ByteString> valueSet = new LinkedHashSet<ByteString>(1); |
| | | valueSet.add(ByteString.valueOf(intValue + " " + unit)); |
| | | return valueSet; |
| | | } |
| | | |
| | |
| | | * @return <CODE>true</CODE> if the provided value is acceptable for use in |
| | | * this attribute, or <CODE>false</CODE> if not. |
| | | */ |
| | | public boolean valueIsAcceptable(AttributeValue value, |
| | | public boolean valueIsAcceptable(ByteString value, |
| | | StringBuilder rejectReason) |
| | | { |
| | | // Get a string representation of the value and convert it to lowercase. |
| | | String lowerValue = value.getValue().toString().toLowerCase(); |
| | | |
| | | String lowerValue = value.toString().toLowerCase(); |
| | | return valueIsAcceptable(lowerValue, rejectReason); |
| | | } |
| | | |
| | |
| | | * @throws ConfigException If an unrecoverable problem occurs while |
| | | * performing the conversion. |
| | | */ |
| | | public LinkedHashSet<AttributeValue> |
| | | public LinkedHashSet<ByteString> |
| | | stringsToValues(List<String> valueStrings, boolean allowFailures) |
| | | throws ConfigException |
| | | { |
| | |
| | | } |
| | | else |
| | | { |
| | | return new LinkedHashSet<AttributeValue>(); |
| | | return new LinkedHashSet<ByteString>(); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | LinkedHashSet<AttributeValue> valueSet = |
| | | new LinkedHashSet<AttributeValue>(numValues); |
| | | LinkedHashSet<ByteString> valueSet = new LinkedHashSet<ByteString>(numValues); |
| | | for (String valueString : valueStrings) |
| | | { |
| | | if ((valueString == null) || (valueString.length() == 0)) |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | valueSet.add(AttributeValues.create(ByteString.valueOf(valueString), |
| | | ByteString.valueOf(valueString))); |
| | | valueSet.add(ByteString.valueOf(valueString)); |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | else |
| | | { |
| | | Iterator<AttributeValue> iterator = a.iterator(); |
| | | |
| | | String valueString = iterator.next().getValue().toString(); |
| | | |
| | | Iterator<ByteString> iterator = a.iterator(); |
| | | String valueString = iterator.next().toString(); |
| | | if (iterator.hasNext()) |
| | | { |
| | | // This is illegal -- the attribute is single-valued. |
| | |
| | | } |
| | | else |
| | | { |
| | | Iterator<AttributeValue> iterator = a.iterator(); |
| | | |
| | | String valueString = iterator.next().getValue().toString(); |
| | | |
| | | Iterator<ByteString> iterator = a.iterator(); |
| | | String valueString = iterator.next().toString(); |
| | | if (iterator.hasNext()) |
| | | { |
| | | // This is illegal -- the attribute is single-valued. |