/** * 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 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 Value mapToValue(Object value) { return new LongValue(mapToRawType(value)); }
/** * 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 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; }
/** * Allows a bulk set operation of the properties. The properties map contains a key * value pair, the values can be of type {@link java.lang.Integer} , {@link java.lang.Long} * or {@link java.lang.String}. Any unknown types will be called by using the toString operation. * * @param newProperties The properties containing key value pairs * @return The entity the properties have been set on */ @Override public SimpleEntity setProperties(Map<String, Object> newProperties) { this.properties.clear(); for(Map.Entry<String, Object> entry : newProperties.entrySet()) { if(entry.getValue() instanceof Integer) { addValueToProperty(entry.getKey(), new IntegerValue((Integer) entry.getValue())); } else if(entry.getValue() instanceof Long) { addValueToProperty(entry.getKey(), new LongValue((Long) entry.getValue())); } else { addValueToProperty(entry.getKey(), new StringValue(entry.getValue().toString())); } } return this; }