本文整理汇总了Java中org.apache.cayenne.exp.Property.getName方法的典型用法代码示例。如果您正苦于以下问题:Java Property.getName方法的具体用法?Java Property.getName怎么用?Java Property.getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.cayenne.exp.Property
的用法示例。
在下文中一共展示了Property.getName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: byKey
import org.apache.cayenne.exp.Property; //导入方法依赖的package包/类
public static ByKeyObjectMapperFactory byKey(Property<?> key) {
return new ByKeyObjectMapperFactory(key.getName());
}