19 package org.turro.contacts;
21 import java.util.Date;
22 import javax.persistence.Column;
23 import javax.persistence.Entity;
24 import javax.persistence.GeneratedValue;
25 import javax.persistence.Id;
26 import javax.persistence.ManyToOne;
27 import org.turro.string.ObjectString;
28 import org.turro.string.Strings;
29 import org.turro.elephant.util.BooleanFormats;
30 import org.turro.elephant.util.DateFormats;
31 import org.turro.elephant.util.DecimalFormats;
32 import org.turro.fieldit.StringList;
33 import org.turro.i18n.I_;
34 import org.turro.reflection.Reflections;
41 @org.hibernate.annotations.GenericGenerator(name =
"hibernate-uuid", strategy =
"uuid")
42 public class ValueIt implements java.io.Serializable {
45 @GeneratedValue(generator =
"hibernate-uuid")
46 @Column(name=
"IDENTIFIER")
49 @Column(name=
"VALUEIT_VALUE")
55 @Column(name=
"VALUEIT_PATH")
79 this.fieldIt = fieldIt;
93 return fieldIt !=
null && !Strings.isBlank(value);
100 value = ObjectString.formatNativeObject(obj,
false);
105 if(Reflections.of(fieldIt.getJavaClass()).canCast(
StringList.class)) {
108 return ObjectString.parseNativeString(value, fieldIt.getJavaClass(),
false);
118 if(obj instanceof Boolean) {
122 return ((Boolean) obj) ?
I_.
get(fieldIt.getName()) :
"";
124 }
else if(obj instanceof Number) {
126 }
else if(obj instanceof Date) {
128 }
else if(obj instanceof String) {
133 return obj ==
null ?
"" : obj.toString();
138 if(obj instanceof Boolean) {
139 return ((Boolean) obj) ?
I_.
get(fieldIt.getName()) :
"";
140 }
else if(obj instanceof Number) {
142 }
else if(obj instanceof Date) {
144 }
else if(obj instanceof String) {
145 return I_.
get(fieldIt.getName()) +
": " + (String) obj;
149 return obj ==
null ?
"" :
I_.
get(fieldIt.getName()) +
": " + obj.toString();
static String get(String msg)