in eclipse/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/views/PropertyTypeSupport.java [96:142]
public static String encodeValueAsString(Object value, int propertyType) {
switch(propertyType) {
case PropertyType.BOOLEAN: {
return Boolean.toString(value.equals((Integer)1));
}
case PropertyType.DECIMAL:
case PropertyType.DOUBLE:
case PropertyType.LONG:
case PropertyType.NAME:
case PropertyType.PATH:
case PropertyType.STRING: {
return String.valueOf(value);
}
case PropertyType.BINARY: {
//TODO: how to handle binary here
return "";
}
case PropertyType.DATE: {
if (value instanceof Date) {
Date date = (Date)value;
Calendar c = Calendar.getInstance();
c.setTime(date);
return DateTimeSupport.print(c);
} else if (value instanceof GregorianCalendar) {
GregorianCalendar date = (GregorianCalendar)value;
return DateTimeSupport.print(date);
} else {
return String.valueOf(value);
}
}
case PropertyType.URI: {
if (value instanceof URI) {
URI uri = (URI)value;
return uri.toString();
} else {
return String.valueOf(value);
}
}
case PropertyType.REFERENCE:
case PropertyType.WEAKREFERENCE: {
return String.valueOf(value);
}
default: {
return String.valueOf(value);
}
}
}