public void setProperty(final String key, final Object value) { if (key.isEmpty()) throw ExceptionFactory.propertyKeyCanNotBeEmpty(); if (key.equals(StringFactory.ID)) throw ExceptionFactory.propertyKeyIdIsReserved(); if (key.equals(StringFactory.LABEL)) throw ExceptionFactory.propertyKeyLabelIsReservedForEdges(); final Map<String, Object> properties = this.getPropertyMapClone(); properties.put(key, value); this.graph.getRawGraph().setRelationshipProperties(this.id, properties); }
public void setProperty(final String key, final Object value) { if (key.isEmpty()) throw ExceptionFactory.elementKeyCanNotBeEmpty(); if (key.equals(StringFactory.ID)) throw ExceptionFactory.propertyKeyIdIsReserved(); if (key.equals(StringFactory.LABEL)) throw ExceptionFactory.propertyKeyLabelIsReservedForEdges(); final Map<String, Object> properties = this.getPropertyMapClone(); properties.put(key, value); this.graph.getRawGraph().setRelationshipProperties(this.id, properties); }
/** * Ensure that the given key/value don't conflict with * Blueprints reserved words. * @param key * @param value */ public static void validateProperty(String key, Object value) { nullCheckProperty(key, value); if (key.equals(StringFactory.ID)) { throw ExceptionFactory.propertyKeyIdIsReserved(); } else if (key.equals(StringFactory.LABEL)) { throw ExceptionFactory.propertyKeyLabelIsReservedForEdges(); } else if (value == null) { throw ExceptionFactory.propertyValueCanNotBeNull(); } }
/** * Ensure that the given key/value don't conflict with * Blueprints reserved words. * @param key * @param value */ public static void validateProperty(String key, Object value) { nullCheckProperty(key, value); if (key.equals(StringFactory.ID)) { throw ExceptionFactory.propertyKeyIdIsReserved(); } else if (key.equals(StringFactory.LABEL)) { throw ExceptionFactory.propertyKeyLabelIsReservedForEdges(); } else if (value == null) { throw ExceptionFactory.propertyValueCanNotBeNull(); } }
/** * Determines whether the property key/value for the specified element can be legally set. * This is typically used as a pre-condition check prior to setting a property. * * @param element the element for the property to be set * @param key the key of the property * @param value the value of the property * @throws IllegalArgumentException whether the triple is legal and if not, a clear reason message is provided */ public static final void validateProperty(final Element element, final String key, final Object value) throws IllegalArgumentException { if (null == value) throw ExceptionFactory.propertyValueCanNotBeNull(); if (null == key) throw ExceptionFactory.propertyKeyCanNotBeNull(); if (key.equals(StringFactory.ID)) throw ExceptionFactory.propertyKeyIdIsReserved(); if (element instanceof Edge && key.equals(StringFactory.LABEL)) throw ExceptionFactory.propertyKeyLabelIsReservedForEdges(); if (key.isEmpty()) throw ExceptionFactory.propertyKeyCanNotBeEmpty(); }
/** * (Blueprints Extension) Validates an Element property. * * @param element Element instance * @param key Property name * @param value property value * @throws IllegalArgumentException */ public final void validateProperty(final Element element, final String key, final Object value) throws IllegalArgumentException { if (settings.isStandardElementConstraints() && null == value) throw ExceptionFactory.propertyValueCanNotBeNull(); if (null == key) throw ExceptionFactory.propertyKeyCanNotBeNull(); if (settings.isStandardElementConstraints() && key.equals(StringFactory.ID)) throw ExceptionFactory.propertyKeyIdIsReserved(); if (element instanceof Edge && key.equals(StringFactory.LABEL)) throw ExceptionFactory.propertyKeyLabelIsReservedForEdges(); if (key.isEmpty()) throw ExceptionFactory.propertyKeyCanNotBeEmpty(); }