@Override public Value mapToValue(Object value) { return new StringValue(((Enum)value).name()); }
/** * Creates an empty property object, the proeprty object can be used * to set values on, if no values are set the property object is not * serialized * @param propertyName The property name * @return The property created for the given property name */ @Override public Property createProperty(String propertyName) { if(!properties.containsKey(propertyName)) { Property property = new MultivalueProperty(propertyName); properties.put(propertyName, property); return property; } else { return properties.get(propertyName); } }
/** * Adds a property with a Long value * @param propertyName The name of the property * @param isCollection True if this is a collection, False if not * @param longValue The long value to add to the property * @return The entity the property has been added to */ @Override public SimpleEntity addProperty(String propertyName, boolean isCollection, long longValue) { addValueToProperty(propertyName, isCollection, new LongValue(longValue)); return this; }
/** * Adds an embedded entity to the current entity with the given property name * @param propertyName The name to add the embedded entity on * @param entity The entity to embed * @return The entity onto which the entity was embedded */ @Override public SimpleEntity addEntity(String propertyName, Entity entity) { addValueToProperty(propertyName, new EntityValue(entity)); return this; }
/** * Adds a property with an Integer value * @param propertyName The name of the property * @param isCollection True if this is a collection, False if not * @param intValue The integer value to add to the property * @return The entity the property has been added to */ @Override public SimpleEntity addProperty(String propertyName, boolean isCollection, int intValue) { addValueToProperty(propertyName, isCollection, new IntegerValue(intValue)); return this; }
/** * Adds a property with boolean value * @param propertyName the name of the property * @param booleanValue True or False boolean value * @return The entity the property has been added to */ @Override public SimpleEntity addProperty(String propertyName, boolean booleanValue) { addValueToProperty(propertyName, new BooleanValue(booleanValue)); return this; }
@Override public Object getFirstValueObject() { return getFirstValue().getValue(); }
/** * Adds a property with a String value * @param propertyName The name of the property * @param stringValue The string value * @return The entity the property has been added to */ @Override public SimpleEntity addProperty(String propertyName, String stringValue) { addValueToProperty(propertyName, new StringValue(stringValue)); return this; }
/** * Adds a property with a Long value * @param propertyName The name of the property * @param longValue The long value to add to the property * @return The entity the property has been added to */ @Override public SimpleEntity addProperty(String propertyName, long longValue) { addValueToProperty(propertyName, new LongValue(longValue)); return this; }
@Override public Property mapToProperty(String propertyName, Object value) { Property property = new MultivalueProperty(propertyName); property.addValue(mapToValue(value)); return property; }
/** * Adds a property with an Integer value * @param propertyName The name of the property * @param intValue The integer value to add to the property * @return The entity the property has been added to */ @Override public SimpleEntity addProperty(String propertyName, int intValue) { addValueToProperty(propertyName, new IntegerValue(intValue)); return this; }
/** * Adds a property with a String value * @param propertyName The name of the property * @param isCollection True if this is a collection, False if not * @param stringValue The string value * @return The entity the property has been added to */ @Override public SimpleEntity addProperty(String propertyName, boolean isCollection, String stringValue) { addValueToProperty(propertyName, isCollection, new StringValue(stringValue)); return this; }
/** * Adds a property with a collection of long values * @param propertyName The name of the property * @param longValues The collection of long values to add to the property * @return The entity the property has been added to */ @Override public SimpleEntity addProperty(String propertyName, long... longValues) { for(long longValue : longValues) { addValueToProperty(propertyName, new LongValue(longValue)); } return this; }
/** * Sets a property with given name to the current value, overriding any current * value and property set for that given property name * @param propertyName THe name of the property * @param value The Integer value to add or override current values * @return The entity the property has been set on */ @Override public SimpleEntity setProperty(String propertyName, int value) { removeProperty(propertyName); addValueToProperty(propertyName, new IntegerValue(value)); return this; }
/** * Adds a property with a list of String values * @param propertyName The name of the property * @param stringValues The list of string values to add to the property * @return The entity the property has been added to */ @Override public SimpleEntity addProperty(String propertyName, List<String> stringValues) { for(String value : stringValues) { addValueToProperty(propertyName, true, new StringValue(value)); } return this; }
@Override public Value mapToValue(Object value) { return new LongValue(mapToRawType(value)); }
/** * Adds a property with a colleciton of String values * @param propertyName The name of the property * @param stringValues The string values to add to the property * @return The entity the property has been added to */ @Override public SimpleEntity addProperty(String propertyName, String... stringValues) { for(String value : stringValues) { addValueToProperty(propertyName, new StringValue(value)); } return this; }
/** * Sets a property with given name to the current value, overriding any current * value and property set for that given property name * @param propertyName THe name of the property * @param longValue The long value to add or override current values * @return The entity the property has been set on */ @Override public SimpleEntity setProperty(String propertyName, long longValue) { removeProperty(propertyName); addValueToProperty(propertyName, new LongValue(longValue)); return this; }
@Override public Value mapToValue(Object value) { return new StringValue(mapToRawType(value)); }
@Override public void setInternalId(String internalId) { this.internalId = internalId; if(properties.containsKey(DOCUMENT_ID)) { removeProperty(DOCUMENT_ID); } addValueToProperty(DOCUMENT_ID, new StringValue(internalId)); }