当前位置: 首页>>代码示例>>Java>>正文


Java PrimitivePropertyMethodMetadata类代码示例

本文整理汇总了Java中com.buschmais.xo.spi.metadata.method.PrimitivePropertyMethodMetadata的典型用法代码示例。如果您正苦于以下问题:Java PrimitivePropertyMethodMetadata类的具体用法?Java PrimitivePropertyMethodMetadata怎么用?Java PrimitivePropertyMethodMetadata使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PrimitivePropertyMethodMetadata类属于com.buschmais.xo.spi.metadata.method包,在下文中一共展示了PrimitivePropertyMethodMetadata类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createEntity

import com.buschmais.xo.spi.metadata.method.PrimitivePropertyMethodMetadata; //导入依赖的package包/类
@Override
   public DuctileVertex createEntity(TypeMetadataSet<EntityTypeMetadata<DuctileVertexMetadata>> types,
    Set<String> discriminators,
    Map<PrimitivePropertyMethodMetadata<DuctilePropertyMetadata>, Object> exampleEntity) {
DuctileVertex vertex = graph.addVertex();
for (Entry<PrimitivePropertyMethodMetadata<DuctilePropertyMetadata>, Object> propertyEntry : exampleEntity
	.entrySet()) {
    Object value = propertyEntry.getValue();
    if (value == null) {
	setProperty(vertex, propertyEntry.getKey(), value);
    }
}
for (String discriminator : discriminators) {
    vertex.getBaseVertex().addType(discriminator);
}
return vertex;
   }
 
开发者ID:PureSolTechnologies,项目名称:DuctileDB,代码行数:18,代码来源:DucileStoreVertexManager.java

示例2: createRelation

import com.buschmais.xo.spi.metadata.method.PrimitivePropertyMethodMetadata; //导入依赖的package包/类
@Override
   public DuctileEdge createRelation(DuctileVertex source, RelationTypeMetadata<DuctileEdgeMetadata> metadata,
    RelationTypeMetadata.Direction direction, DuctileVertex target,
    Map<PrimitivePropertyMethodMetadata<DuctilePropertyMetadata>, Object> exampleEntity) {
String name = metadata.getDatastoreMetadata().getDiscriminator();
Object[] keyValues = new Object[exampleEntity.size() * 2];
@SuppressWarnings("unchecked")
PrimitivePropertyMethodMetadata<DuctilePropertyMetadata> keys[] = exampleEntity.keySet()
	.toArray(new PrimitivePropertyMethodMetadata[exampleEntity.size()]);
for (int i = 0; i < exampleEntity.size(); ++i) {
    PrimitivePropertyMethodMetadata<DuctilePropertyMetadata> key = keys[i];
    String propertyName = key.getDatastoreMetadata().getName();
    keyValues[2 * i] = propertyName;
    keyValues[2 * i + 1] = exampleEntity.get(key);
}
switch (direction) {
case FROM:
    return source.addEdge(name, target);
case TO:
    return target.addEdge(name, source);
default:
    throw new XOException("Unknown direction '" + direction.name() + "'.");
}
   }
 
开发者ID:PureSolTechnologies,项目名称:DuctileDB,代码行数:25,代码来源:DucileStoreEdgeManager.java

示例3: createRelation

import com.buschmais.xo.spi.metadata.method.PrimitivePropertyMethodMetadata; //导入依赖的package包/类
@Override
   public Edge createRelation(
    Vertex source,
    RelationTypeMetadata<TitanEdgeMetadata> metadata,
    RelationTypeMetadata.Direction direction,
    Vertex target,
    Map<PrimitivePropertyMethodMetadata<TitanPropertyMetadata>, Object> exampleEntity) {
String name = metadata.getDatastoreMetadata().getDiscriminator();
switch (direction) {
case FROM:
    return source.addEdge(name, target);
case TO:
    return target.addEdge(name, source);
default:
    throw new XOException("Unknown direction '" + direction.name()
	    + "'.");
}
   }
 
开发者ID:PureSolTechnologies,项目名称:extended-objects-titan,代码行数:19,代码来源:TitanStoreEdgeManager.java

示例4: createRelation

import com.buschmais.xo.spi.metadata.method.PrimitivePropertyMethodMetadata; //导入依赖的package包/类
@Override
public EmbeddedRelationship createRelation(EmbeddedNode source, RelationTypeMetadata<RelationshipMetadata<EmbeddedRelationshipType>> metadata,
        RelationTypeMetadata.Direction direction, EmbeddedNode target, Map<PrimitivePropertyMethodMetadata<PropertyMetadata>, Object> example) {
    EmbeddedRelationship relationship;
    EmbeddedRelationshipType relationshipType = metadata.getDatastoreMetadata().getDiscriminator();
    switch (direction) {
    case FROM:
        relationship = source.createRelationshipTo(target, relationshipType);
        break;
    case TO:
        relationship = target.createRelationshipTo(source, relationshipType);
        break;
    default:
        throw new XOException("Unsupported direction " + direction);
    }
    setProperties(relationship, example);
    return relationship;
}
 
开发者ID:buschmais,项目名称:extended-objects,代码行数:19,代码来源:Neo4jRelationManager.java

示例5: invoke

import com.buschmais.xo.spi.metadata.method.PrimitivePropertyMethodMetadata; //导入依赖的package包/类
public Object invoke(DatastoreType datastoreType, Object instance, Object[] args) {
    Object value = args[0];
    PropertyManager propertyManager = getPropertyManager();
    PrimitivePropertyMethodMetadata<?> metadata = getMetadata();
    if (value != null) {
        if (Enum.class.isAssignableFrom(metadata.getAnnotatedMethod().getType())) {
            value = ((Enum) value).name();
        }
        propertyManager.setProperty(datastoreType, metadata, value);
    } else {
        if (propertyManager.hasProperty(datastoreType, metadata)) {
            propertyManager.removeProperty(datastoreType, metadata);
        }
    }
    return null;
}
 
开发者ID:buschmais,项目名称:extended-objects,代码行数:17,代码来源:AbstractPrimitivePropertySetMethod.java

示例6: prepareExample

import com.buschmais.xo.spi.metadata.method.PrimitivePropertyMethodMetadata; //导入依赖的package包/类
/**
 * Setup an example entity.
 *
 * @param type
 *            The type.
 * @param example
 *            The provided example.
 * @param <T>
 *            The type.
 * @return The example.
 */
private <T> Map<PrimitivePropertyMethodMetadata<PropertyMetadata>, Object> prepareExample(Example<T> example, Class<?> type, Class<?>... types) {
    Map<PrimitivePropertyMethodMetadata<PropertyMetadata>, Object> exampleEntity = new HashMap<>();
    ExampleProxyMethodService<T> proxyMethodService = (ExampleProxyMethodService<T>) exampleProxyMethodServices.get(type);
    if (proxyMethodService == null) {
        proxyMethodService = new ExampleProxyMethodService(type, sessionContext);
        exampleProxyMethodServices.put(type, proxyMethodService);
    }
    InstanceInvocationHandler invocationHandler = new InstanceInvocationHandler(exampleEntity, proxyMethodService);
    List<Class<?>> effectiveTypes = new ArrayList<>();
    effectiveTypes.add(type);
    effectiveTypes.addAll(Arrays.asList(types));
    CompositeType compositeType = CompositeTypeBuilder.create(CompositeObject.class, type, types);
    T instance = sessionContext.getProxyFactory().createInstance(invocationHandler, compositeType);
    example.prepare(instance);
    return exampleEntity;
}
 
开发者ID:buschmais,项目名称:extended-objects,代码行数:28,代码来源:XOManagerImpl.java

示例7: setProperty

import com.buschmais.xo.spi.metadata.method.PrimitivePropertyMethodMetadata; //导入依赖的package包/类
@Override
   public void setProperty(DuctileVertex vertex, PrimitivePropertyMethodMetadata<DuctilePropertyMetadata> metadata,
    Object value) {
if (DuctileVertexProperty.class.isAssignableFrom(value.getClass())) {
    vertex.property(metadata.getDatastoreMetadata().getName(), ((DuctileVertexProperty<?>) value).value());
} else {
    vertex.property(metadata.getDatastoreMetadata().getName(), value);
}
   }
 
开发者ID:PureSolTechnologies,项目名称:DuctileDB,代码行数:10,代码来源:DucileStoreVertexManager.java

示例8: getProperty

import com.buschmais.xo.spi.metadata.method.PrimitivePropertyMethodMetadata; //导入依赖的package包/类
@Override
   public Object getProperty(DuctileVertex vertex, PrimitivePropertyMethodMetadata<DuctilePropertyMetadata> metadata) {
VertexProperty<Object> property = vertex.property(metadata.getDatastoreMetadata().getName());
if (!property.isPresent()) {
    return null;
}
return property.value();
   }
 
开发者ID:PureSolTechnologies,项目名称:DuctileDB,代码行数:9,代码来源:DucileStoreVertexManager.java

示例9: getProperty

import com.buschmais.xo.spi.metadata.method.PrimitivePropertyMethodMetadata; //导入依赖的package包/类
@Override
   public Object getProperty(DuctileEdge edge, PrimitivePropertyMethodMetadata<DuctilePropertyMetadata> metadata) {
Property<Object> property = edge.property(metadata.getDatastoreMetadata().getName());
if (!property.isPresent()) {
    return null;
}
return property.value();
   }
 
开发者ID:PureSolTechnologies,项目名称:DuctileDB,代码行数:9,代码来源:DucileStoreEdgeManager.java

示例10: createEntity

import com.buschmais.xo.spi.metadata.method.PrimitivePropertyMethodMetadata; //导入依赖的package包/类
@Override
   public Vertex createEntity(
    TypeMetadataSet<EntityTypeMetadata<TitanVertexMetadata>> types,
    Set<String> discriminators,
    Map<PrimitivePropertyMethodMetadata<TitanPropertyMetadata>, Object> exampleEntity) {
Vertex vertex = titanGraph.addVertex(null);
for (String discriminator : discriminators) {
    vertex.setProperty(TitanStoreSession.XO_DISCRIMINATORS_PROPERTY
	    + discriminator, discriminator);
}
return vertex;
   }
 
开发者ID:PureSolTechnologies,项目名称:extended-objects-titan,代码行数:13,代码来源:TitanStoreVertexManager.java

示例11: setProperties

import com.buschmais.xo.spi.metadata.method.PrimitivePropertyMethodMetadata; //导入依赖的package包/类
protected void setProperties(Element element, Map<PrimitivePropertyMethodMetadata<PropertyMetadata>, Object> example) {
    for (Map.Entry<PrimitivePropertyMethodMetadata<PropertyMetadata>, Object> entry : example.entrySet()) {
        Object value = entry.getValue();
        if (value != null) {
            setProperty(element, entry.getKey(), value);
        }
    }
}
 
开发者ID:buschmais,项目名称:extended-objects,代码行数:9,代码来源:AbstractNeo4jPropertyManager.java

示例12: createEntity

import com.buschmais.xo.spi.metadata.method.PrimitivePropertyMethodMetadata; //导入依赖的package包/类
@Override
public EmbeddedNode createEntity(TypeMetadataSet<EntityTypeMetadata<NodeMetadata<EmbeddedLabel>>> types, Set<EmbeddedLabel> discriminators,
        Map<PrimitivePropertyMethodMetadata<PropertyMetadata>, Object> example) {
    Label[] labels = new Label[discriminators.size()];
    int i = 0;
    for (EmbeddedLabel discriminator : discriminators) {
        labels[i++] = discriminator.getDelegate();
    }
    EmbeddedNode node = new EmbeddedNode(graphDatabaseService.createNode(labels));
    setProperties(node, example);
    return node;
}
 
开发者ID:buschmais,项目名称:extended-objects,代码行数:13,代码来源:Neo4jEntityManager.java

示例13: getIndexedPropertyMetadata

import com.buschmais.xo.spi.metadata.method.PrimitivePropertyMethodMetadata; //导入依赖的package包/类
public static <L extends Neo4jLabel> PropertyMetadata getIndexedPropertyMetadata(EntityTypeMetadata<NodeMetadata<L>> type,
                                                                                 PrimitivePropertyMethodMetadata<PropertyMetadata> propertyMethodMetadata) {
    if (propertyMethodMetadata == null) {
        IndexedPropertyMethodMetadata<?> indexedProperty = type.getDatastoreMetadata().getUsingIndexedPropertyOf();
        if (indexedProperty == null) {
            throw new XOException("Type " + type.getAnnotatedType().getAnnotatedElement().getName() + " has no indexed property.");
        }
        propertyMethodMetadata = indexedProperty.getPropertyMethodMetadata();
    }
    return propertyMethodMetadata.getDatastoreMetadata();
}
 
开发者ID:buschmais,项目名称:extended-objects,代码行数:12,代码来源:MetadataHelper.java

示例14: ensureIndex

import com.buschmais.xo.spi.metadata.method.PrimitivePropertyMethodMetadata; //导入依赖的package包/类
/**
 * Ensures that an index exists for the given entity and property.
 *
 * @param entityTypeMetadata
 *            The entity.
 * @param indexedProperty
 *            The index metadata.
 */
private void ensureIndex(DS session, EntityTypeMetadata<NodeMetadata<L>> entityTypeMetadata,
        IndexedPropertyMethodMetadata<IndexedPropertyMetadata> indexedProperty) {
    if (indexedProperty != null) {
        IndexedPropertyMetadata datastoreMetadata = indexedProperty.getDatastoreMetadata();
        if (datastoreMetadata.isCreate()) {
            L label = entityTypeMetadata.getDatastoreMetadata().getDiscriminator();
            PrimitivePropertyMethodMetadata<PropertyMetadata> propertyMethodMetadata = indexedProperty.getPropertyMethodMetadata();
            if (label != null && propertyMethodMetadata != null) {
                ensureIndex(session, label, propertyMethodMetadata, datastoreMetadata.isUnique());
            }
        }
    }
}
 
开发者ID:buschmais,项目名称:extended-objects,代码行数:22,代码来源:AbstractNeo4jDatastore.java

示例15: find

import com.buschmais.xo.spi.metadata.method.PrimitivePropertyMethodMetadata; //导入依赖的package包/类
public <T> ResultIterable<T> find(Class<T> type, Object value) {
    this.xoSession.flush();
    // get the label for the type
    EntityTypeMetadata<NodeMetadata<Label>> entityMetadata = xoSession.getEntityMetadata(type);
    Label label = entityMetadata.getDatastoreMetadata().getDiscriminator();
    // get the name of the indexed property
    PrimitivePropertyMethodMetadata<PropertyMetadata> propertyMethodMetadata = entityMetadata.getIndexedProperty().getPropertyMethodMetadata();
    PropertyMetadata datastoreMetadata = propertyMethodMetadata.getDatastoreMetadata();
    Object datastoreValue = xoSession.toDatastore(value);
    return find(label, datastoreMetadata, datastoreValue);
}
 
开发者ID:buschmais,项目名称:extended-objects,代码行数:12,代码来源:AbstractNeo4jRepository.java


注:本文中的com.buschmais.xo.spi.metadata.method.PrimitivePropertyMethodMetadata类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。