de.greenrobot.daogenerator.Entity.getPropertiesPk()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(2.0k)|赞(0)|评价(0)|浏览(105)

本文整理了Java中de.greenrobot.daogenerator.Entity.getPropertiesPk()方法的一些代码示例,展示了Entity.getPropertiesPk()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Entity.getPropertiesPk()方法的具体详情如下:
包路径:de.greenrobot.daogenerator.Entity
类名称:Entity
方法名:getPropertiesPk

Entity.getPropertiesPk介绍

[英]Internal property used by templates, don't use during entity definition.
[中]模板使用的内部属性,在实体定义期间不使用。

代码示例

代码示例来源:origin: de.greenrobot/greendao-generator

void init2ndPass() {
  super.init2ndPass();
  List<Property> pks = sourceEntity.getPropertiesPk();
  if (pks.isEmpty()) {
    throw new RuntimeException("Source entity has no primary key, but we need it for " + this);
  }
  List<Property> pks2 = targetEntity.getPropertiesPk();
  if (pks2.isEmpty()) {
    throw new RuntimeException("Target entity has no primary key, but we need it for " + this);
  }
}

代码示例来源:origin: de.greenrobot/greendao-generator

void init2ndPass() {
  super.init2ndPass();
  if (sourceProperties == null) {
    List<Property> pks = sourceEntity.getPropertiesPk();
    if (pks.isEmpty()) {
      throw new RuntimeException("Source entity has no primary key, but we need it for " + this);
    }
    sourceProperties = new Property[pks.size()];
    sourceProperties = pks.toArray(sourceProperties);
  }
  int count = sourceProperties.length;
  if (count != targetProperties.length) {
    throw new RuntimeException("Source properties do not match target properties: " + this);
  }
  for (int i = 0; i < count; i++) {
    Property sourceProperty = sourceProperties[i];
    Property targetProperty = targetProperties[i];
    PropertyType sourceType = sourceProperty.getPropertyType();
    PropertyType targetType = targetProperty.getPropertyType();
    if (sourceType == null || targetType == null) {
      throw new RuntimeException("Property type uninitialized");
    }
    if (sourceType != targetType) {
      System.err.println("Warning to-one property type does not match target key type: " + this);
    }
  }
}

代码示例来源:origin: yangblocker/GreenDao-SQLCipher

List<Property> pks = sourceEntity.getPropertiesPk();
if (pks.isEmpty()) {
  throw new RuntimeException("Source entity has no primary key, but we need it for " + this);

相关文章