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


Java Property.getName方法代码示例

本文整理汇总了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);
}
 
开发者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: 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


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