當前位置: 首頁>>代碼示例>>Java>>正文


Java PropertyMethod.getAnnotation方法代碼示例

本文整理匯總了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.");
}
   }
 
開發者ID:PureSolTechnologies,項目名稱:DuctileDB,代碼行數:26,代碼來源:DuctileMetadataFactory.java

示例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);
   }
 
開發者ID:PureSolTechnologies,項目名稱:extended-objects-titan,代碼行數:26,代碼來源:TitanMetadataFactory.java

示例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;
}
   }
 
開發者ID:PureSolTechnologies,項目名稱:DuctileDB,代碼行數:22,代碼來源:DuctileMetadataFactory.java

示例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;
}
   }
 
開發者ID:PureSolTechnologies,項目名稱:extended-objects-titan,代碼行數:25,代碼來源:TitanMetadataFactory.java

示例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());
}
 
開發者ID:buschmais,項目名稱:extended-objects,代碼行數:6,代碼來源:AbstractNeo4jMetadataFactory.java


注:本文中的com.buschmais.xo.spi.reflection.PropertyMethod.getAnnotation方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。