public PropertyValueMetadata accept()

in src/main/java/com/amazonaws/services/neptune/propertygraph/schema/PropertySchema.java [48:83]


    public PropertyValueMetadata accept(Object value, boolean updateDataType) {

        /*
        What should we do of the user specifies a datatype in a filter, but the actual values cannot be cast to that type?
        At present, neptune-export will respect the user-specified type in the output schema (config.json), and in CSV headers (if appropriate for export format).
        But perhaps the tool should seek to guarantee that the output schema allows for all values in the exported dataset?
        */

        PropertyValueMetadata propertyValueMetadata = new PropertyValueMetadata();

        int size = 1;
        if (isList(value)) {
            List<?> values = (List<?>) value;
            size = values.size();
            if (size != 1) {
                isMultiValue = true;
            }
            if (inferDataType || updateDataType) {
                for (Object v : values) {
                    DataType newType = DataType.dataTypeFor(v.getClass());
                    allTypes.add(newType);
                    propertyValueMetadata.updateFor(newType);
                    dataType = DataType.getBroadestType(dataType, newType);
                }
            }
        } else {
            if (inferDataType || updateDataType) {
                DataType newType = DataType.dataTypeFor(value.getClass());
                allTypes.add(newType);
                propertyValueMetadata.updateFor(newType);
                dataType = DataType.getBroadestType(dataType, newType);
            }
        }

        return propertyValueMetadata;
    }