@Override protected Serializable getDefaultValue() { Serializable value = (Serializable) field.getDefaultValue(); if (value == null) { value = new ArrayList<Serializable>(); } return value; }
protected Serializable getDefaultValue() { return (Serializable) getField().getDefaultValue(); }
/** * @since 7.1 */ private List<ConstraintViolation> validateSimpleTypeProperty(Schema schema, List<PathNode> path, Property prop, boolean dirtyOnly) { Field field = prop.getField(); assert field.getType().isSimpleType() || prop.isScalar(); List<ConstraintViolation> violations = new ArrayList<>(); Serializable value = prop.getValue(); Object defaultValue = field.getDefaultValue(); // check nullity constraint only if field doesn't have a default value (phantom case) if (prop.isPhantom() && defaultValue == null || value == null) { if (!field.isNillable()) { addNotNullViolation(violations, schema, path); } } else { violations.addAll(validateSimpleTypeField(schema, path, field, value)); } return violations; }
Object defaultValue = field.getDefaultValue(); String typeName = type.getName(); if (attribute == null) {
@Override public Map<String, Object> newInstance() { if (TypeConstants.isContentType(this)) { // NXP-912: should return null for a blob. Since there is no // pluggable adapter mechanism on types, and since document model // properties consider that every complex property named "content" // should be dealt with a BlobProperty, this is hardcoded here. return null; } Map<String, Object> map = new HashMap<String, Object>(); for (Field field : fields.values()) { Object value; Type type = field.getType(); if (type.isComplexType()) { value = type.newInstance(); } else if (type.isListType()) { value = new ArrayList<Object>(); } else { value = field.getDefaultValue(); } map.put(field.getName().getLocalName(), value); } return map; }
Object defaultValue = field.getDefaultValue(); if (defaultValue != null) { newDocMap.put(fieldName, defaultValue);
defaultEntry.put(fieldName, (Serializable) f.getDefaultValue());
if (prefixedField != null && prefixedField.getDefaultValue() != null) { fieldMap.put(prefixedName, prefixedField.getDefaultValue()); } else { i.remove();
|| (property.isPhantom() && property.getField().getDefaultValue() != null)) {
/** * Create a schema from a ComplexType * * @since 5.7 * @param complexType * @param name * @param ns */ public SchemaImpl(ComplexType complexType, String name, Namespace ns, boolean isVersionWritabe) { super(null, SchemaNames.SCHEMAS, name, ns); this.isVersionWritabe = isVersionWritabe; if (complexType != null) { for (Field field : complexType.getFields()) { QName fieldname = QName.valueOf(field.getName().getLocalName(), ns.prefix); Type type = field.getType(); String defaultValue = type.encode(field.getDefaultValue()); Set<Constraint> constraint = field.getConstraints(); FieldImpl newField = new FieldImpl(fieldname, this, type, defaultValue, 0, constraint); newField.setConstant(field.isConstant()); addField(newField); } } }
for (Field parentField : superType.getFields()) { ct.addField(parentField.getName().getLocalName(), parentField.getType(), (String) parentField.getDefaultValue(), 0, null);