本文整理汇总了Java中org.apache.cayenne.exp.Property类的典型用法代码示例。如果您正苦于以下问题:Java Property类的具体用法?Java Property怎么用?Java Property使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Property类属于org.apache.cayenne.exp包,在下文中一共展示了Property类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:bootique,项目名称:bootique-cayenne,代码行数:21,代码来源:CayenneModelUtils.java
示例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());
}
开发者ID:bootique,项目名称:bootique-cayenne,代码行数:32,代码来源:CayenneTableManager.java
示例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;
}
开发者ID:nhl,项目名称:link-move,代码行数:13,代码来源:MapperBuilder.java
示例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;
}
开发者ID:nhl,项目名称:link-move,代码行数:10,代码来源:DefaultCreateOrUpdateBuilder.java
示例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"));
}
开发者ID:nhl,项目名称:link-move,代码行数:10,代码来源:MapperBuilderTest.java
示例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);
}
开发者ID:nhl,项目名称:link-rest,代码行数:14,代码来源:ConstraintsBuilder.java
示例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;
}
开发者ID:bootique,项目名称:bootique-cayenne,代码行数:5,代码来源:CayenneTestDataManagerBuilder.java
示例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;
}
开发者ID:nhl,项目名称:link-move,代码行数:7,代码来源:DefaultDeleteBuilder.java
示例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);
}
开发者ID:nhl,项目名称:link-move,代码行数:7,代码来源:MapperBuilderTest.java
示例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);
}
开发者ID:nhl,项目名称:link-move,代码行数:7,代码来源:MapperBuilderTest.java
示例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());
}
开发者ID:nhl,项目名称:link-rest,代码行数:8,代码来源:DefaultLinkRestService.java
示例12: byKey
import org.apache.cayenne.exp.Property; //导入依赖的package包/类
public static ByKeyObjectMapperFactory byKey(Property<?> key) {
return new ByKeyObjectMapperFactory(key.getName());
}
开发者ID:nhl,项目名称:link-rest,代码行数:4,代码来源:ByKeyObjectMapperFactory.java
示例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;
}
开发者ID:nhl,项目名称:link-rest,代码行数:6,代码来源:DefaultSelectBuilder.java
示例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());
}
开发者ID:nhl,项目名称:link-rest,代码行数:6,代码来源:DefaultSelectBuilder.java
示例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;
}
开发者ID:nhl,项目名称:link-rest,代码行数:6,代码来源:DefaultSelectBuilder.java
示例16: parent
import org.apache.cayenne.exp.Property; //导入依赖的package包/类
@Override
public UpdateBuilder<T> parent(Class<?> parentType, Object parentId, Property<T> relationshipFromParent) {
context.setParent(new EntityParent<>(parentType, parentId, relationshipFromParent.getName()));
return this;
}
开发者ID:nhl,项目名称:link-rest,代码行数:6,代码来源:DefaultUpdateBuilder.java
示例17: toManyParent
import org.apache.cayenne.exp.Property; //导入依赖的package包/类
@Override
public UpdateBuilder<T> toManyParent(Class<?> parentType, Object parentId,
Property<? extends Collection<T>> relationshipFromParent) {
return parent(parentType, parentId, relationshipFromParent.getName());
}
开发者ID:nhl,项目名称:link-rest,代码行数:6,代码来源:DefaultUpdateBuilder.java
示例18: mapper
import org.apache.cayenne.exp.Property; //导入依赖的package包/类
/**
* @since 1.20
*/
@Override
public UpdateBuilder<T> mapper(Property<?> property) {
return mapper(ByKeyObjectMapperFactory.byKey(property));
}
开发者ID:nhl,项目名称:link-rest,代码行数:8,代码来源:DefaultUpdateBuilder.java
示例19: parent
import org.apache.cayenne.exp.Property; //导入依赖的package包/类
@Override
public DeleteBuilder<T> parent(Class<?> parentType, Object parentId, Property<T> relationshipFromParent) {
context.setParent(new EntityParent<>(parentType, parentId, relationshipFromParent.getName()));
return this;
}
开发者ID:nhl,项目名称:link-rest,代码行数:6,代码来源:DefaultDeleteBuilder.java
示例20: toManyParent
import org.apache.cayenne.exp.Property; //导入依赖的package包/类
@Override
public DeleteBuilder<T> toManyParent(Class<?> parentType, Object parentId,
Property<? extends Collection<T>> relationshipFromParent) {
return parent(parentType, parentId, relationshipFromParent.getName());
}
开发者ID:nhl,项目名称:link-rest,代码行数:6,代码来源:DefaultDeleteBuilder.java
注:本文中的org.apache.cayenne.exp.Property类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论