本文整理匯總了Java中com.buschmais.xo.spi.reflection.PropertyMethod類的典型用法代碼示例。如果您正苦於以下問題:Java PropertyMethod類的具體用法?Java PropertyMethod怎麽用?Java PropertyMethod使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
PropertyMethod類屬於com.buschmais.xo.spi.reflection包,在下文中一共展示了PropertyMethod類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: createRelationMetadata
import com.buschmais.xo.spi.reflection.PropertyMethod; //導入依賴的package包/類
@Override
public DuctileEdgeMetadata createRelationMetadata(AnnotatedElement<?> annotatedElement,
Map<Class<?>, TypeMetadata> metadataByType) {
EdgeDefinition relationAnnotation;
if (annotatedElement instanceof PropertyMethod) {
relationAnnotation = ((PropertyMethod) annotatedElement).getAnnotationOfProperty(EdgeDefinition.class);
} else {
relationAnnotation = annotatedElement.getAnnotation(EdgeDefinition.class);
}
String name = null;
if (relationAnnotation != null) {
String value = relationAnnotation.value();
if (!EdgeDefinition.DEFAULT_VALUE.equals(value)) {
name = value;
}
}
if (name == null) {
name = StringUtils.uncapitalize(annotatedElement.getName());
}
return new DuctileEdgeMetadata(name);
}
示例3: 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);
}
示例4: createRelationMetadata
import com.buschmais.xo.spi.reflection.PropertyMethod; //導入依賴的package包/類
@Override
public TitanEdgeMetadata createRelationMetadata(
AnnotatedElement<?> annotatedElement,
Map<Class<?>, TypeMetadata> metadataByType) {
EdgeDefinition relationAnnotation;
if (annotatedElement instanceof PropertyMethod) {
relationAnnotation = ((PropertyMethod) annotatedElement)
.getAnnotationOfProperty(EdgeDefinition.class);
} else {
relationAnnotation = annotatedElement
.getAnnotation(EdgeDefinition.class);
}
String name = null;
if (relationAnnotation != null) {
String value = relationAnnotation.value();
if (!EdgeDefinition.DEFAULT_VALUE.equals(value)) {
name = value;
}
}
if (name == null) {
name = StringUtils.uncapitalize(annotatedElement.getName());
}
return new TitanEdgeMetadata(name);
}
示例5: createRelationMetadata
import com.buschmais.xo.spi.reflection.PropertyMethod; //導入依賴的package包/類
@Override
public RelationshipMetadata<R> createRelationMetadata(AnnotatedElement<?> annotatedElement, Map<Class<?>, TypeMetadata> metadataByType) {
Relation relationAnnotation;
boolean batchable;
if (annotatedElement instanceof PropertyMethod) {
relationAnnotation = ((PropertyMethod) annotatedElement).getAnnotationOfProperty(Relation.class);
batchable = true;
} else if (annotatedElement instanceof AnnotatedType) {
AnnotatedType annotatedType = (AnnotatedType) annotatedElement;
relationAnnotation = annotatedType.getAnnotation(Relation.class);
batchable = annotatedType.getAnnotatedElement().isAnnotation() || isBatchable(annotatedElement);
} else {
throw new XOException("Annotated element is not supported: " + annotatedElement);
}
String name = null;
if (relationAnnotation != null) {
String value = relationAnnotation.value();
if (!Relation.DEFAULT_VALUE.equals(value)) {
name = value;
}
}
if (name == null) {
name = CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, annotatedElement.getName());
}
return new RelationshipMetadata<>(createRelationshipType(name), batchable);
}
示例6: RowProxyMethodService
import com.buschmais.xo.spi.reflection.PropertyMethod; //導入依賴的package包/類
public RowProxyMethodService(SortedSet<Class<?>> types) {
for (Class<?> type : types) {
BeanMethodProvider beanMethodProvider = BeanMethodProvider.newInstance(type);
Collection<AnnotatedMethod> typeMethodsOfType = beanMethodProvider.getMethods();
for (AnnotatedMethod typeMethod : typeMethodsOfType) {
if (!(typeMethod instanceof GetPropertyMethod)) {
throw new XOException("Only get methods are supported for projections: '" + typeMethod.getAnnotatedElement().getName() + "'.");
}
PropertyMethod propertyMethod = (PropertyMethod) typeMethod;
GetMethod proxyMethod = new GetMethod(propertyMethod.getName(), propertyMethod.getType());
addProxyMethod(proxyMethod, propertyMethod.getAnnotatedElement());
}
}
addMethod(new AsMethod(), CompositeObject.class, "as", Class.class);
addMethod(new GetDelegateMethod<>(), CompositeObject.class, "getDelegate");
addMethod(new com.buschmais.xo.impl.proxy.query.row.GetMethod(), CompositeRowObject.class, "get", String.class, Class.class);
addMethod(new GetColumnsMethod(), CompositeRowObject.class, "getColumns");
addMethod(new HashCodeMethod(), Object.class, "hashCode");
addMethod(new EqualsMethod(), Object.class, "equals", Object.class);
addMethod(new ToStringMethod(), Object.class, "toString");
}
示例7: 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;
}
}
示例8: createCollectionPropertyMetadata
import com.buschmais.xo.spi.reflection.PropertyMethod; //導入依賴的package包/類
@Override
public TitanCollectionPropertyMetadata createCollectionPropertyMetadata(
PropertyMethod propertyMethod) {
String name = determinePropertyName(propertyMethod);
Direction direction = determineEdgeDirection(propertyMethod);
return new TitanCollectionPropertyMetadata(name, direction);
}
示例9: createReferencePropertyMetadata
import com.buschmais.xo.spi.reflection.PropertyMethod; //導入依賴的package包/類
@Override
public TitanReferencePropertyMetadata createReferencePropertyMetadata(
PropertyMethod propertyMethod) {
String name = determinePropertyName(propertyMethod);
Direction direction = determineEdgeDirection(propertyMethod);
return new TitanReferencePropertyMetadata(name, direction);
}
示例10: createPropertyMetadata
import com.buschmais.xo.spi.reflection.PropertyMethod; //導入依賴的package包/類
@Override
public TitanPropertyMetadata createPropertyMetadata(
PropertyMethod propertyMethod) {
Property property = propertyMethod
.getAnnotationOfProperty(Property.class);
String name = property != null ? property.value() : propertyMethod
.getName();
return new TitanPropertyMetadata(name);
}
示例11: 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;
}
}
示例12: createCollectionPropertyMetadata
import com.buschmais.xo.spi.reflection.PropertyMethod; //導入依賴的package包/類
@Override
public DuctileCollectionPropertyMetadata createCollectionPropertyMetadata(PropertyMethod propertyMethod) {
String name = determinePropertyName(propertyMethod);
EdgeDirection direction = determineEdgeDirection(propertyMethod);
return new DuctileCollectionPropertyMetadata(name, direction);
}
示例13: createReferencePropertyMetadata
import com.buschmais.xo.spi.reflection.PropertyMethod; //導入依賴的package包/類
@Override
public DuctileReferencePropertyMetadata createReferencePropertyMetadata(PropertyMethod propertyMethod) {
String name = determinePropertyName(propertyMethod);
EdgeDirection direction = determineEdgeDirection(propertyMethod);
return new DuctileReferencePropertyMetadata(name, direction);
}
示例14: createPropertyMetadata
import com.buschmais.xo.spi.reflection.PropertyMethod; //導入依賴的package包/類
@Override
public DuctilePropertyMetadata createPropertyMetadata(PropertyMethod propertyMethod) {
Property property = propertyMethod.getAnnotationOfProperty(Property.class);
String name = property != null ? property.value() : propertyMethod.getName();
return new DuctilePropertyMetadata(name);
}
示例15: createCollectionPropertyMetadata
import com.buschmais.xo.spi.reflection.PropertyMethod; //導入依賴的package包/類
@Override
public <CollectionPropertyMetadata> CollectionPropertyMetadata createCollectionPropertyMetadata(PropertyMethod propertyMethod) {
return null;
}