本文整理汇总了Java中com.tinkerpop.frames.modules.typedgraph.TypeField类的典型用法代码示例。如果您正苦于以下问题:Java TypeField类的具体用法?Java TypeField怎么用?Java TypeField使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TypeField类属于com.tinkerpop.frames.modules.typedgraph包,在下文中一共展示了TypeField类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findTypeHoldingTypeField
import com.tinkerpop.frames.modules.typedgraph.TypeField; //导入依赖的package包/类
@Override
protected Class<?> findTypeHoldingTypeField(final Class<?> type) {
Class<?> typeHoldingTypeField = type.getAnnotation(TypeField.class) == null ? null : type;
for (Class<?> parentType : type.getInterfaces()) {
Class<?> parentTypeHoldingTypeField = findTypeHoldingTypeField(parentType);
Validate.assertArgument(
parentTypeHoldingTypeField == null || typeHoldingTypeField == null
|| parentTypeHoldingTypeField == typeHoldingTypeField,
"You have multiple TypeField annotations in your class-hierarchy for %s", type.getName());
if (typeHoldingTypeField == null)
typeHoldingTypeField = parentTypeHoldingTypeField;
}
return typeHoldingTypeField;
}
示例2: resolve
import com.tinkerpop.frames.modules.typedgraph.TypeField; //导入依赖的package包/类
public Class<?> resolve(final Element e, final Class<?> defaultType) {
// System.out.println("Resolving element with default type " + defaultType.getName());
Class<?> result = defaultType;
Class<?> typeHoldingTypeField = typeRegistry_.getTypeHoldingTypeField(defaultType);
if (typeHoldingTypeField != null) {
String value = ((DElement) e).getProperty(typeHoldingTypeField.getAnnotation(TypeField.class).value(), String.class);
// System.out.println("TEMP DEBUG: Found type value: " + (value == null ? "null" : value));
Class<?> type = null;
try {
type = value == null ? null : typeRegistry_.getType(typeHoldingTypeField, value, e);
} catch (Throwable t) {
if (defaultType == DVertexFrame.class) {
type = DVertexFrame.class;
}
}
if (type != null) {
// System.out.println("TEMP DEBUG: Returning type: " + type.getName());
if (type.getSimpleName().equalsIgnoreCase(defaultType.getSimpleName())) {
// System.out.println("Simple name collision on vertex for name " + defaultType.getSimpleName()
// + ". Using requested type: " + defaultType.getName());
result = defaultType;
} else {
result = type;
}
}
}
// System.out.println("TEMP DEBUG returning type " + result.getName());
return result;
}