本文整理汇总了Java中com.tinkerpop.blueprints.util.ExceptionFactory.vertexIdCanNotBeNull方法的典型用法代码示例。如果您正苦于以下问题:Java ExceptionFactory.vertexIdCanNotBeNull方法的具体用法?Java ExceptionFactory.vertexIdCanNotBeNull怎么用?Java ExceptionFactory.vertexIdCanNotBeNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.tinkerpop.blueprints.util.ExceptionFactory
的用法示例。
在下文中一共展示了ExceptionFactory.vertexIdCanNotBeNull方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getVertex
import com.tinkerpop.blueprints.util.ExceptionFactory; //导入方法依赖的package包/类
@Override
public TitanVertex getVertex(final Object id) {
if (null == id)
throw ExceptionFactory.vertexIdCanNotBeNull();
if (id instanceof Vertex) //allows vertices to be "re-attached" to the current transaction
return getVertex(((Vertex) id).getId());
final long longId;
if (id instanceof Long) {
longId = (Long) id;
} else if (id instanceof Number) {
longId = ((Number) id).longValue();
} else {
try {
longId = Long.valueOf(id.toString()).longValue();
} catch (NumberFormatException e) {
return null;
}
}
return getVertex(longId);
}
示例2: addVertex
import com.tinkerpop.blueprints.util.ExceptionFactory; //导入方法依赖的package包/类
public Vertex addVertex(final Object id, String type, final Object... properties) {
if (id == null) throw ExceptionFactory.vertexIdCanNotBeNull();
if (retrieveFromCache(id) != null) throw ExceptionFactory.vertexWithIdAlreadyExists(id);
nextElement();
Vertex v = baseGraph.addVertexWithLabel(type);
if (vertexIdKey != null) {
v.setProperty(vertexIdKey, id);
}
cache.set(v, id);
final BatchVertex newVertex = new BatchVertex(id);
setProperties(newVertex, properties);
return newVertex;
}
示例3: load
import com.tinkerpop.blueprints.util.ExceptionFactory; //导入方法依赖的package包/类
/**
* Creates a vertex by loading it
*
* @param graph
* a ArangoDBGraph
* @param id
* the id (key) of the vertex (can be null)
*
* @throws IllegalArgumentException
*/
static ArangoDBVertex load(ArangoDBGraph graph, Object id) {
if (id == null) {
throw ExceptionFactory.vertexIdCanNotBeNull();
}
String key = id.toString();
try {
ArangoDBSimpleVertex v = graph.getClient().getVertex(graph.getRawGraph(), key);
return build(graph, v);
} catch (ArangoDBException e) {
// nothing found
logger.debug("graph not found", e);
return null;
}
}
示例4: load
import com.tinkerpop.blueprints.util.ExceptionFactory; //导入方法依赖的package包/类
/**
* Creates a vertex by loading it
*
* @param graph
* a ArangoDBGraph
* @param id
* the id (key) of the vertex (can be null)
*/
static ArangoDBBatchVertex load(ArangoDBBatchGraph graph, Object id) {
if (id == null) {
throw ExceptionFactory.vertexIdCanNotBeNull();
}
String key = id.toString();
ArangoDBBatchVertex vert = graph.vertexCache.get(key);
if (vert != null) {
return vert;
}
try {
ArangoDBSimpleVertex v = graph.client.getVertex(graph.getRawGraph(), key);
return build(graph, v);
} catch (ArangoDBException e) {
logger.warn("could read batch vertex", e);
return null;
}
}
示例5: getVertex
import com.tinkerpop.blueprints.util.ExceptionFactory; //导入方法依赖的package包/类
@Override
public Vertex getVertex(Object id) {
if (id == null) {
throw ExceptionFactory.vertexIdCanNotBeNull();
}
String myID = id.toString();
Vertex vertex = globals.getCaches().retrieve(myID, Vertex.class);
if (vertex != null) {
return vertex;
}
vertex = new AccumuloVertex(globals, myID);
if (!globals.getConfig().getSkipExistenceChecks()) {
// In addition to just an "existence" check, we will also load
// any "preloaded" properties now, which saves us a round-trip
// to Accumulo later.
String[] preload = globals.getConfig().getPreloadedProperties();
if (preload == null && !globals.getConfig().getPreloadAllProperties()) {
preload = new String[]{};
}
Map<String, Object> props = globals.getVertexWrapper()
.readProperties(vertex, preload);
if (props == null) {
return null;
}
for (Entry<String, Object> ents : props.entrySet()) {
((AccumuloElement) vertex).setPropertyInMemory(ents.getKey(), ents.getValue());
}
}
globals.getCaches().cache(vertex, Vertex.class);
return vertex;
}