@Test public void shouldCreatePropertyByNameAndValue() throws Exception { assertProperty(PropertyBuilder.create("test", 100L, Long.class.getName()), "test", 100L); }
public static Property create(Field field, Object value) { String name = field.getName(); Type type = field.getType(); if (type.isCombobox()) { ComboboxHolder holder = new ComboboxHolder(field); if (holder.isCollection()) { if (holder.getTypeClassName().equals(List.class.getName())) { return new CollectionProperty(name, value, new ArrayList(), holder.getUnderlyingType()); } else if (holder.getTypeClassName().equals(Set.class.getName())) { return new CollectionProperty(name, value, new HashSet(), holder.getUnderlyingType()); } } } return create(name, value, field.getType().getTypeClassName()); }
PropertyBuilder { public static Property create(Field field, Object value) { String name = field.getName(); Type type = field.getType(); if (type.isCombobox()) { ComboboxHolder holder = new ComboboxHolder(field); if (holder.isCollection()) { if (holder.getTypeClassName().equals(List.class.getName())) { return new CollectionProperty(name, value, new ArrayList(), holder.getUnderlyingType()); } else if (holder.getTypeClassName().equals(Set.class.getName())) { return new CollectionProperty(name, value, new HashSet(), holder.getUnderlyingType()); } } } return create(name, value, field.getType().getTypeClassName()); } }
PropertyBuilder { public static Property create(Field field, Object value) { String name = field.getName(); Type type = field.getType(); if (type.isCombobox()) { ComboboxHolder holder = new ComboboxHolder(field); if (holder.isCollection()) { if (holder.getTypeClassName().equals(List.class.getName())) { return new CollectionProperty(name, value, new ArrayList(), holder.getUnderlyingType()); } else if (holder.getTypeClassName().equals(Set.class.getName())) { return new CollectionProperty(name, value, new HashSet(), holder.getUnderlyingType()); } } } return create(name, value, field.getType().getTypeClassName()); } private  PropertyBuilder(); }
PropertyBuilder { public static Property create(Field field, Object value) { String name = field.getName(); Type type = field.getType(); if (type.isCombobox()) { ComboboxHolder holder = new ComboboxHolder(field); if (holder.isCollection()) { if (holder.getTypeClassName().equals(List.class.getName())) { return new CollectionProperty(name, value, new ArrayList(), holder.getUnderlyingType()); } else if (holder.getTypeClassName().equals(Set.class.getName())) { return new CollectionProperty(name, value, new HashSet(), holder.getUnderlyingType()); } } } return create(name, value, field.getType().getTypeClassName()); } private  PropertyBuilder(); static Property create(Field field, Object value); static Property create(String name, Object value, Class type); static Property create(String name, Object value, String type); static Property create(String name, Object value, String type, String operator); static Property createRelationProperty(String jdoVariableName, String name, Object value, String type); static Property createRelationProperty(String jdoVariableName, String name, Object value, String type, String operator); static CollectionProperty createRelationPropertyForComboboxCollection(String jdoVariable, String name, Object value, String type); }
PropertyBuilder { public static Property create(Field field, Object value) { String name = field.getName(); Type type = field.getType(); if (type.isCombobox()) { ComboboxHolder holder = new ComboboxHolder(field); if (holder.isCollection()) { if (holder.getTypeClassName().equals(List.class.getName())) { return new CollectionProperty(name, value, new ArrayList(), holder.getUnderlyingType()); } else if (holder.getTypeClassName().equals(Set.class.getName())) { return new CollectionProperty(name, value, new HashSet(), holder.getUnderlyingType()); } } } return create(name, value, field.getType().getTypeClassName()); } private  PropertyBuilder(); static Property create(Field field, Object value); static Property create(String name, Object value, Class type); static Property create(String name, Object value, String type); static Property create(String name, Object value, String type, String operator); static Property createRelationProperty(String jdoVariableName, String name, Object value, String type); static Property createRelationProperty(String jdoVariableName, String name, Object value, String type, String operator); static CollectionProperty createRelationPropertyForComboboxCollection(String jdoVariable, String name, Object value, String type);  }