本文整理汇总了Java中com.tinkerpop.blueprints.Element.getProperty方法的典型用法代码示例。如果您正苦于以下问题:Java Element.getProperty方法的具体用法?Java Element.getProperty怎么用?Java Element.getProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.tinkerpop.blueprints.Element
的用法示例。
在下文中一共展示了Element.getProperty方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: resolve
import com.tinkerpop.blueprints.Element; //导入方法依赖的package包/类
@Override
public <T> Class<? extends T> resolve(final Element element, final Class<T> kind) {
final String nodeClazz = element.getProperty(this.typeResolutionKey);
if (nodeClazz == null) {
return kind;
}
final Class<T> nodeKind = (Class<T>) this.reflectionCache.forName(nodeClazz);
if (kind.isAssignableFrom(nodeKind) || kind.equals(VertexFrame.class) || kind.equals(EdgeFrame.class)
|| kind.equals(AbstractVertexFrame.class) || kind.equals(AbstractEdgeFrame.class) || kind.equals(Object.class)) {
return nodeKind;
} else {
return kind;
}
}
示例2: verifyElementOrder
import com.tinkerpop.blueprints.Element; //导入方法依赖的package包/类
public static void verifyElementOrder(Iterator<? extends Element> elements, String key, Order order, int expectedCount) {
Comparable previous = null;
int count = 0;
while (elements.hasNext()) {
Element element = elements.next();
Comparable current = (Comparable)element.getProperty(key);
if (previous != null) {
int cmp = previous.compareTo(current);
assertTrue(previous + " <> " + current + " @ " + count,
order == Order.ASC ? cmp <= 0 : cmp >= 0);
}
previous = current;
count++;
}
assertEquals(expectedCount, count);
}
示例3: transform
import com.tinkerpop.blueprints.Element; //导入方法依赖的package包/类
static void transform(Iterable<? extends Element> elements) {
for (Element element: elements) {
for (String key: element.getPropertyKeys()) {
if (PROTECTED_PROPERTY_KEYS.contains(key)) {
continue;
} else {
Object value = element.getProperty(key);
if (value instanceof Iterable) {
// Leave it
} else if (value.getClass().isArray()) {
element.setProperty(key, Arrays.asList(value));
} else {
element.setProperty(key, newArrayList(value));
}
}
}
}
}
示例4: setPropertyForIndex
import com.tinkerpop.blueprints.Element; //导入方法依赖的package包/类
/**
* Add the property to this index.
*
* <p/>Note that this requires a round-trip to Accumulo to see
* if the property exists if the provided key has an index.
* So for best performance, create indices after bulk ingest.
* <p/>If the force parameter is true, set the property regardless
* of whether indexing is enabled for the given key. This is needed
* for {@link IndexableGraph} operations.
* @param element
* @param key
* @param value
* @param force
*/
public void setPropertyForIndex(Element element, String key, Object value,
boolean force) {
AccumuloGraphUtils.validateProperty(key, value);
if (force || globals.getConfig().getAutoIndex() ||
globals.getIndexMetadataWrapper()
.getIndexedKeys(elementType).contains(key)) {
BatchWriter writer = getWriter();
Object oldValue = element.getProperty(key);
if (oldValue != null && !oldValue.equals(value)) {
Mutators.apply(writer, new IndexValueMutator.Delete(element, key, oldValue));
}
Mutators.apply(writer, new IndexValueMutator.Add(element, key, value));
globals.checkedFlush();
}
}
示例5: migrateType
import com.tinkerpop.blueprints.Element; //导入方法依赖的package包/类
/**
* Change type: com.gentics.mesh.core.data.impl.UserImpl to UserImpl
*
* @param element
*/
private void migrateType(Element element) {
String type = element.getProperty("ferma_type");
if (!StringUtils.isEmpty(type)) {
int idx = type.lastIndexOf(".");
if (idx != -1) {
type = type.substring(idx + 1);
element.setProperty("ferma_type", type);
}
}
}
示例6: getProperty
import com.tinkerpop.blueprints.Element; //导入方法依赖的package包/类
public static <O> Function<Element, O> getProperty( final String key ) {
return new Function<Element, O>() {
@Override public O apply( Element input ) {
return input.getProperty( key );
}
};
}
示例7: resolve
import com.tinkerpop.blueprints.Element; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public <T extends FramedElement> Class<T> resolve(Element element, Class<T> kind) {
String clazz = element.getProperty("java_class");
if (clazz != null) {
try {
return (Class<T>) Class.forName(clazz);
} catch (ClassNotFoundException e) {
throw new RuntimeException("The class " + clazz + " cannot be found");
}
}
return kind;
}
示例8: init
import com.tinkerpop.blueprints.Element; //导入方法依赖的package包/类
@Override
public <T extends FramedElement> void init(Element element, Class<T> kind) {
String clazz = element.getProperty("java_class");
if (clazz == null) {
element.setProperty("java_class", kind.getName());
}
}
示例9: copyProperties
import com.tinkerpop.blueprints.Element; //导入方法依赖的package包/类
static void copyProperties(Element source, Element target) {
for (String key : source.getPropertyKeys()) {
Object property = source.getProperty(key);
if (property.getClass().isArray()) {
List<Object> propertyList = new ArrayList<>();
for (int i = 0; i < Array.getLength(property); i++) {
propertyList.add(Array.get(property, i));
}
property = propertyList;
}
target.setProperty(key, property);
}
}
示例10: compare
import com.tinkerpop.blueprints.Element; //导入方法依赖的package包/类
@Override
public int compare(Element o1, Element o2) {
String uuidA = o1.getProperty("uuid");
String uuidB = o2.getProperty("uuid");
return ObjectUtils.compare(uuidA, uuidB);
}
示例11: invoke
import com.tinkerpop.blueprints.Element; //导入方法依赖的package包/类
@Override
public Object invoke(Element propertyContainer, Object instance,
Object[] args) {
return propertyContainer.getProperty("test") + "_get";
}