com.tinkerpop.blueprints.Element.removeProperty()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(7.1k)|赞(0)|评价(0)|浏览(114)

本文整理了Java中com.tinkerpop.blueprints.Element.removeProperty()方法的一些代码示例,展示了Element.removeProperty()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.removeProperty()方法的具体详情如下:
包路径:com.tinkerpop.blueprints.Element
类名称:Element
方法名:removeProperty

Element.removeProperty介绍

[英]Un-assigns a key/value property from the element. The object value of the removed property is returned.
[中]从元素中取消分配键/值属性。将返回已删除属性的对象值。

代码示例

代码示例来源:origin: com.tinkerpop.blueprints/blueprints-core

/**
 * Remove a property from all elements in the provided iterable.
 *
 * @param key      the property to remove by key
 * @param elements the elements to remove the property from
 */
public static void removeProperty(final String key, final Iterable<Element> elements) {
  for (final Element element : elements) {
    element.removeProperty(key);
  }
}

代码示例来源:origin: apache/incubator-atlas

@Override
public void removeProperty(String propertyName) {
  wrappedElement.removeProperty(propertyName);
}

代码示例来源:origin: gentics/mesh

@Override
public void deinit(final Element element) {
  element.removeProperty(this.typeResolutionKey);
}

代码示例来源:origin: com.tinkerpop.blueprints/blueprints-core

public <T> T removeProperty(final String key) {
  return this.baseElement.removeProperty(key);
}

代码示例来源:origin: com.tinkerpop.blueprints/blueprints-core

public <T> T removeProperty(final String key) {
  if (propertyBased) {
    if (key.equals(IdGraph.ID)) {
      throw new IllegalArgumentException("Unable to remove value for reserved property " + IdGraph.ID);
    }
  }
  return baseElement.removeProperty(key);
}

代码示例来源:origin: com.tinkerpop.blueprints/blueprints-core

public <T> T removeProperty(final String key) {
  if (key.equals(this.graph.getPartitionKey()))
    return null;
  return this.baseElement.removeProperty(key);
}

代码示例来源:origin: atlanmod/NeoEMF

@Override
public <T> T removeProperty(String key) {
  checkArgument(!propertyBased || !key.equals(IdGraph.ID), "Unable to remove value for reserved property %s", IdGraph.ID);
  return base.removeProperty(key);
}

代码示例来源:origin: com.tinkerpop.blueprints/blueprints-core

/**
 * Clear all the properties from an iterable of elements.
 *
 * @param elements the elements to remove properties from
 */
public static void removeProperties(final Iterable<Element> elements) {
  for (final Element element : elements) {
    final List<String> keys = new ArrayList<String>();
    keys.addAll(element.getPropertyKeys());
    for (final String key : keys) {
      element.removeProperty(key);
    }
  }
}

代码示例来源:origin: com.tinkerpop.blueprints/blueprints-core

/**
 * Renames a property by removing the old key and adding the stored value to the new key.
 * If property does not exist, nothing occurs.
 *
 * @param oldKey   the key to rename
 * @param newKey   the key to rename to
 * @param elements the elements to rename
 */
public static void renameProperty(final String oldKey, final String newKey, final Iterable<Element> elements) {
  for (final Element element : elements) {
    Object value = element.removeProperty(oldKey);
    if (null != value)
      element.setProperty(newKey, value);
  }
}

代码示例来源:origin: com.tinkerpop.blueprints/blueprints-core

/**
 * Typecasts a property value. This only works for casting to a class that has a constructor of the for new X(String).
 * If no such constructor exists, a RuntimeException is thrown and the original element property is left unchanged.
 *
 * @param key       the key for the property value to typecast
 * @param classCast the class to typecast to
 * @param elements  the elements to have their property typecasted
 */
public static void typecastProperty(final String key, final Class classCast, final Iterable<Element> elements) {
  for (final Element element : elements) {
    final Object value = element.removeProperty(key);
    if (null != value) {
      try {
        element.setProperty(key, classCast.getConstructor(String.class).newInstance(value.toString()));
      } catch (Exception e) {
        element.setProperty(key, value);
        throw new RuntimeException(e.getMessage(), e);
      }
    }
  }
}

代码示例来源:origin: com.tinkerpop.blueprints/blueprints-core

/**
 * Raises a vertexPropertyRemoved or edgePropertyRemoved event.
 */
public <T> T removeProperty(final String key) {
  final Object propertyRemoved = baseElement.removeProperty(key);
  if (this instanceof Vertex) {
    this.onVertexPropertyRemoved((Vertex) this, key, propertyRemoved);
  } else if (this instanceof Edge) {
    this.onEdgePropertyRemoved((Edge) this, key, propertyRemoved);
  }
  return (T) propertyRemoved;
}

代码示例来源:origin: BrynCooke/totorom

/**
 * Set a property value.
 * 
 * @param name
 *            The name of the property.
 * @param value
 *            The value of the property.
 */
protected void setProperty(String name, Object value) {
  if (value == null) {
    element.removeProperty(name);
  } else {
    if (value instanceof Enum) {
      element.setProperty(name, value.toString());
    } else {
      element.setProperty(name, value);
    }
  }
}

代码示例来源:origin: indexiatech/antiquity

/**
 * Sync the specified active element with the corresponding one.
 * 
 * @param a active element
 * @param h historic, latest element.
 */
public void syncActiveAndLatestHistoric(ActiveVersionedElement<V, ?> a, HistoricVersionedElement<V, ?> h) {
  Set<String> removedKeys = new HashSet<String>(h.getPropertyKeys());
  removedKeys.removeAll(VEProps.internalPreservedElementKeys);
  removedKeys.removeAll(a.getPropertyKeys());
  for (String k : a.getPropertyKeys()) {
    if (!VEProps.nonCopiableKeys.contains(k)) {
      h.getRaw().setProperty(k, a.getProperty(k));
    }
  }
  for (String k : removedKeys) {
    h.getRaw().removeProperty(k);
  }
}

代码示例来源:origin: org.jboss.windup.graph.frames/windup-frames

@Override
public Object processElement(Object frame, Method method,
    Object[] arguments, Property annotation,
    FramedGraph<?> framedGraph, Element element) {
  if (ClassUtilities.isGetMethod(method)) {
    Object value = element.getProperty(annotation.value());
    if (method.getReturnType().isEnum())
      return getValueAsEnum(method, value);
    else
      return value;
  } else if (ClassUtilities.isSetMethod(method)) {
    Object value = arguments[0];
    if (null == value) {
      element.removeProperty(annotation.value());
    } else {
      if (value.getClass().isEnum()) {
        element.setProperty(annotation.value(), ((Enum<?>) value).name());
      } else {
        element.setProperty(annotation.value(), value);
      }
    }
    if (method.getReturnType().isAssignableFrom(frame.getClass()))
    return frame;
  } else if (ClassUtilities.isRemoveMethod(method)) {
    element.removeProperty(annotation.value());
    return null;
  }
  return null;
}

代码示例来源:origin: com.tinkerpop/frames

@Override
public Object processElement(final Property annotation, final Method method, final Object[] arguments, final FramedGraph framedGraph, final Element element, final Direction direction) {
  if (ClassUtilities.isGetMethod(method)) {
    Object value = element.getProperty(annotation.value());
    if (method.getReturnType().isEnum())
      return getValueAsEnum(method, value);
    else
      return value;
  } else if (ClassUtilities.isSetMethod(method)) {
    Object value = arguments[0];
    if (null == value) {
      element.removeProperty(annotation.value());
    } else {
      if (value.getClass().isEnum()) {
        element.setProperty(annotation.value(), ((Enum<?>) value).name());
      } else {
        element.setProperty(annotation.value(), value);
      }
    }
    return null;
  } else if (ClassUtilities.isRemoveMethod(method)) {
    element.removeProperty(annotation.value());
    return null;
  }
  return null;
}

代码示例来源:origin: com.tinkerpop.blueprints/blueprints-core

for (final Element element : elements) {
  for (final String key : keys) {
    final Object value = element.removeProperty(key);
    if (null != value) {
      counter++;

代码示例来源:origin: eu.agrosense.server/storage-tinkerpop

if (modelElement.getProperty(propName) != null) {
  LOGGER.log(Level.FINEST, "attribute {0} has a null value, clearing old value", propName);
  modelElement.removeProperty(propName);
} else {
  LOGGER.log(Level.FINEST, "attribute {0} has a null value, not storing it!", propName);

相关文章