本文整理汇总了Java中org.apache.cayenne.exp.Property类的典型用法代码示例。如果您正苦于以下问题:Java Property类的具体用法?Java Property怎么用?Java Property使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Property类属于org.apache.cayenne.exp包,在下文中一共展示了Property类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getRelatedDbEntities
import org.apache.cayenne.exp.Property; //导入依赖的package包/类
static Stream<DbEntity> getRelatedDbEntities(EntityResolver resolver, Class<?> entityType, Property<?> relationship) {
ObjEntity entity = resolver.getObjEntity(entityType);
if (entity == null) {
throw new IllegalArgumentException("Not a Cayenne entity class: " + entityType.getName());
}
ObjRelationship objRelationship = entity.getRelationship(relationship.getName());
if (objRelationship == null) {
throw new IllegalArgumentException("No relationship '" + relationship.getName() + "' in entity " + entityType.getName());
}
List<DbRelationship> path = objRelationship.getDbRelationships();
if (path.size() < 2) {
return Stream.empty();
}
return path.subList(1, path.size()).stream().map(DbRelationship::getSourceEntity);
}
示例2: getRelatedTable
import org.apache.cayenne.exp.Property; //导入依赖的package包/类
/**
* Returns a Table related to a given entity via the specified relationship. Useful for navigation to join tables
* that are not directly mapped to Java classes.
*
* @param entityType a root entity used to resolve a join table.
* @param relationship a Property indicating an ObjRelationship.
* @param tableIndex An index in a list of tables spanned by 'relationship'. Index of 0 corresponds to the target
* DbEntity of the first object in a chain of DbRelationships for a given ObjRelationship.
* @return a Table related to a given entity via the specified relationship.
* @since 0.24
*/
public Table getRelatedTable(Class<?> entityType, Property<?> relationship, int tableIndex) {
ObjEntity entity = resolver.getObjEntity(entityType);
if (entity == null) {
throw new IllegalArgumentException("Not a Cayenne entity class: " + entityType.getName());
}
ObjRelationship flattened = entity.getRelationship(relationship.getName());
if (flattened == null) {
throw new IllegalArgumentException("No relationship '" + relationship.getName() + "' in entity " + entityType.getName());
}
List<DbRelationship> path = flattened.getDbRelationships();
if (path.size() < tableIndex + 1) {
throw new IllegalArgumentException("Index " + tableIndex + " is out of bounds for relationship '" + relationship.getName());
}
return getTable(path.get(tableIndex).getTargetEntityName());
}
示例3: matchBy
import org.apache.cayenne.exp.Property; //导入依赖的package包/类
public MapperBuilder matchBy(Property<?>... paths) {
if (paths == null) {
throw new NullPointerException("Null 'paths'");
}
for (Property<?> p : paths) {
this.paths.add(p.getName());
}
return this;
}
示例4: matchBy
import org.apache.cayenne.exp.Property; //导入依赖的package包/类
/**
* @since 1.1
*/
@Override
public DefaultCreateOrUpdateBuilder<T> matchBy(Property<?>... matchAttributes) {
this.mapper = null;
this.mapperBuilder.matchBy(matchAttributes);
return this;
}
示例5: testMatchBy_Additivity
import org.apache.cayenne.exp.Property; //导入依赖的package包/类
@Test
public void testMatchBy_Additivity() {
Map<String, Mapper> mappers = builder.matchBy(Property.create("a", Object.class), Property.create("b", Object.class))
.matchBy("c").createPathMappers();
assertEquals(3, mappers.size());
assertTrue(mappers.containsKey("db:a"));
assertTrue(mappers.containsKey("db:b"));
assertTrue(mappers.containsKey("db:c"));
}
示例6: excludeProperties
import org.apache.cayenne.exp.Property; //导入依赖的package包/类
/**
* @param attributesOrRelationships an array of properties to exclude.
* @return a new instance of Constraints.
*/
public ConstraintsBuilder<T> excludeProperties(Property<?>... attributesOrRelationships) {
String[] names = new String[attributesOrRelationships.length];
for (int i = 0; i < attributesOrRelationships.length; i++) {
names[i] = attributesOrRelationships[i].getName();
}
return excludeProperties(names);
}
示例7: relatedTables
import org.apache.cayenne.exp.Property; //导入依赖的package包/类
public CayenneTestDataManagerBuilder relatedTables(Class<?> entityType, Property<?> relationship) {
CayenneModelUtils.getRelatedDbEntities(resolver, entityType, relationship).forEach(dbEntities::add);
return this;
}
示例8: matchBy
import org.apache.cayenne.exp.Property; //导入依赖的package包/类
@Override
public DefaultDeleteBuilder<T> matchBy(Property<?>... matchAttributes) {
this.mapper = null;
this.mapperBuilder.matchBy(matchAttributes);
return this;
}
示例9: testCreateMapper_ByPropreties_Single
import org.apache.cayenne.exp.Property; //导入依赖的package包/类
@Test
public void testCreateMapper_ByPropreties_Single() {
Mapper mapper = builder.matchBy(Property.create("a", Object.class)).createMapper();
assertNotNull(mapper);
assertTrue(mapper instanceof PathMapper);
}
示例10: testCreateMapper_ByPropreties_Multi
import org.apache.cayenne.exp.Property; //导入依赖的package包/类
@Test
public void testCreateMapper_ByPropreties_Multi() {
Mapper mapper = builder.matchBy(Property.create("a", Object.class), Property.create("b", Object.class)).createMapper();
assertNotNull(mapper);
assertTrue(mapper instanceof MultiPathMapper);
}
示例11: unrelate
import org.apache.cayenne.exp.Property; //导入依赖的package包/类
/**
* @since 1.2
*/
@Override
public SimpleResponse unrelate(Class<?> type, Object sourceId, Property<?> relationship) {
return unrelate(type, sourceId, relationship.getName());
}
示例12: byKey
import org.apache.cayenne.exp.Property; //导入依赖的package包/类
public static ByKeyObjectMapperFactory byKey(Property<?> key) {
return new ByKeyObjectMapperFactory(key.getName());
}
示例13: parent
import org.apache.cayenne.exp.Property; //导入依赖的package包/类
@Override
public SelectBuilder<T> parent(Class<?> parentType, Object parentId, Property<T> relationshipFromParent) {
context.setParent(new EntityParent<>(parentType, parentId, relationshipFromParent.getName()));
return this;
}
示例14: toManyParent
import org.apache.cayenne.exp.Property; //导入依赖的package包/类
@Override
public SelectBuilder<T> toManyParent(Class<?> parentType, Object parentId,
Property<? extends Collection<T>> relationshipFromParent) {
return parent(parentType, parentId, relationshipFromParent.getName());
}
示例15: autocompleteOn
import org.apache.cayenne.exp.Property; //导入依赖的package包/类
@Override
public SelectBuilder<T> autocompleteOn(Property<?> autocompleteProperty) {
context.setAutocompleteProperty(autocompleteProperty != null ? autocompleteProperty.getName() : null);
return this;
}