本文整理匯總了Java中com.buschmais.xo.spi.reflection.PropertyMethod.getAnnotation方法的典型用法代碼示例。如果您正苦於以下問題:Java PropertyMethod.getAnnotation方法的具體用法?Java PropertyMethod.getAnnotation怎麽用?Java PropertyMethod.getAnnotation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.buschmais.xo.spi.reflection.PropertyMethod
的用法示例。
在下文中一共展示了PropertyMethod.getAnnotation方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createIndexedPropertyMetadata
import com.buschmais.xo.spi.reflection.PropertyMethod; //導入方法依賴的package包/類
@Override
public DuctileIndexedPropertyMetadata createIndexedPropertyMetadata(PropertyMethod propertyMethod) {
Property property = propertyMethod.getAnnotationOfProperty(Property.class);
String name = property != null ? property.value() : propertyMethod.getName();
Class<?> declaringClass = propertyMethod.getAnnotatedElement().getDeclaringClass();
Class<? extends Element> type = null;
if (declaringClass.getAnnotation(VertexDefinition.class) != null) {
type = DuctileVertex.class;
} else if (declaringClass.getAnnotation(EdgeDefinition.class) != null) {
type = DuctileEdge.class;
} else {
throw new XOException("Property '" + name
+ "' was found with index annotation, but the declaring type is neither a vertex nor an edge.");
}
Indexed indexedAnnotation = propertyMethod.getAnnotation(Indexed.class);
boolean unique = indexedAnnotation.unique();
Class<?> dataType = propertyMethod.getType();
if (Serializable.class.isAssignableFrom(dataType)) {
@SuppressWarnings("unchecked")
Class<? extends Serializable> serializableDataType = (Class<? extends Serializable>) dataType;
return new DuctileIndexedPropertyMetadata(name, unique, serializableDataType, type);
} else {
throw new XOException("Illegal data type '" + dataType.getName() + "' found. Type is not serializable.");
}
}
示例2: createIndexedPropertyMetadata
import com.buschmais.xo.spi.reflection.PropertyMethod; //導入方法依賴的package包/類
@Override
public TitanIndexedPropertyMetadata createIndexedPropertyMetadata(
PropertyMethod propertyMethod) {
Property property = propertyMethod
.getAnnotationOfProperty(Property.class);
String name = property != null ? property.value() : propertyMethod
.getName();
Class<?> declaringClass = propertyMethod.getAnnotatedElement()
.getDeclaringClass();
Class<? extends Element> type = null;
if (declaringClass.getAnnotation(VertexDefinition.class) != null) {
type = Vertex.class;
} else if (declaringClass.getAnnotation(EdgeDefinition.class) != null) {
type = Edge.class;
} else {
throw new XOException(
"Property '"
+ name
+ "' was found with index annotation, but the declaring type is neither a vertex nor an edge.");
}
Indexed indexedAnnotation = propertyMethod.getAnnotation(Indexed.class);
boolean unique = indexedAnnotation.unique();
Class<?> dataType = propertyMethod.getType();
return new TitanIndexedPropertyMetadata(name, unique, dataType, type);
}
示例3: determineEdgeDirection
import com.buschmais.xo.spi.reflection.PropertyMethod; //導入方法依賴的package包/類
/**
* This method is a helper method to extract the edge direction from a
* {@link PropertyMethod}.
*
* @param propertyMethod
* is the {@link PropertyMethod} object which represents the
* method for which the edge direction is to be checked.
* @return A {@link EdgeDirection} object is returned containing the
* direction of the edge.
*/
private static EdgeDirection determineEdgeDirection(PropertyMethod propertyMethod) {
Outgoing outgoingAnnotation = propertyMethod.getAnnotation(Outgoing.class);
Incoming incomingAnnotation = propertyMethod.getAnnotation(Incoming.class);
if ((outgoingAnnotation != null) && (incomingAnnotation != null)) {
return EdgeDirection.BOTH;
} else if (incomingAnnotation != null) {
return EdgeDirection.IN;
} else {
return EdgeDirection.OUT;
}
}
示例4: determineEdgeDirection
import com.buschmais.xo.spi.reflection.PropertyMethod; //導入方法依賴的package包/類
/**
* This method is a helper method to extract the edge direction from a
* {@link PropertyMethod}.
*
* @param propertyMethod
* is the {@link PropertyMethod} object which represents the
* method for which the edge direction is to be checked.
* @return A {@link Direction} object is returned containing the direction
* of the edge.
*/
private static Direction determineEdgeDirection(
PropertyMethod propertyMethod) {
Outgoing outgoingAnnotation = propertyMethod
.getAnnotation(Outgoing.class);
Incoming incomingAnnotation = propertyMethod
.getAnnotation(Incoming.class);
if ((outgoingAnnotation != null) && (incomingAnnotation != null)) {
return Direction.BOTH;
} else if (incomingAnnotation != null) {
return Direction.IN;
} else {
return Direction.OUT;
}
}
示例5: createIndexedPropertyMetadata
import com.buschmais.xo.spi.reflection.PropertyMethod; //導入方法依賴的package包/類
@Override
public IndexedPropertyMetadata createIndexedPropertyMetadata(PropertyMethod propertyMethod) {
Indexed indexed = propertyMethod.getAnnotation(Indexed.class);
return new IndexedPropertyMetadata(indexed.create(), indexed.unique());
}