本文整理匯總了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;
}