hi jukka
i have two minor comments regarding the memory value optimization:
a) is it on purpose that the value constructors are public?
as far as i saw they are only used by the factory... (which
i would prefer)
b) the following method lists PropertyType.DECIMAL twice. not sure
if that was a copy-paste error or if you actually wanted another
type here... maybe BOOLEAN? that would make sense IMO as you
otherwise create boolean values with the GenericValue although
you have an extra object for that:
+ @Override
+ public CoreValue createValue(String value, final int type) {
+ if (type == PropertyType.BINARY) {
+ try {
+ return new BinaryValue(value.getBytes("UTF-8"));
+ } catch (UnsupportedEncodingException e) {
+ throw new IllegalStateException("UTF-8 is not supported", e);
+ }
+ } else if (type == PropertyType.DECIMAL) {
+ return createValue(createValue(value).getDecimal());
+ } else if (type == PropertyType.DECIMAL) {
+ return createValue(createValue(value).getDecimal());
+ } else if (type == PropertyType.DOUBLE) {
+ return createValue(createValue(value).getDouble());
+ } else if (type == PropertyType.LONG) {
+ return createValue(createValue(value).getLong());
+ } else if (type == PropertyType.STRING) {
+ return createValue(value);
+ } else {
+ return new GenericValue(type, value);
+ }
+ }
+
+}
regards
angela