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

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

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

Entity.getPkProperty介绍

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

代码示例

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

/** Constructs fkColumns. Depends on 2nd pass of target key properties. */
void init3ndPass() {
  Property targetPkProperty = targetEntity.getPkProperty();
  if (fkProperties.length != 1 || targetPkProperty == null) {
    throw new RuntimeException("Currently only single FK columns are supported: " + this);
  }
  Property property = fkProperties[0];
  PropertyType propertyType = property.getPropertyType();
  if (propertyType == null) {
    propertyType = targetPkProperty.getPropertyType();
    property.setPropertyType(propertyType);
    // Property is not a regular property with primitive getters/setters, so let it catch up
    property.init2ndPass();
    property.init3ndPass();
  } else if (propertyType != targetPkProperty.getPropertyType()) {
    System.err.println("Warning to-one property type does not match target key type: " + this);
  }
  resolvedKeyJavaType[0] = schema.mapToJavaTypeNullable(propertyType);
  resolvedKeyUseEquals[0] = checkUseEquals(propertyType);
}

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

/** Constructs fkColumns. Depends on 2nd pass of target key properties. */
void init3ndPass() {
  Property targetPkProperty = targetEntity.getPkProperty();
  if (fkProperties.length != 1 || targetPkProperty == null) {
    throw new RuntimeException("Currently only single FK columns are supported: " + this);
  }
  Property property = fkProperties[0];
  PropertyType propertyType = property.getPropertyType();
  if (propertyType == null) {
    propertyType = targetPkProperty.getPropertyType();
    property.setPropertyType(propertyType);
    // Property is not a regular property with primitive getters/setters, so let it catch up
    property.init2ndPass();
    property.init3ndPass();
  } else if (propertyType != targetPkProperty.getPropertyType()) {
    System.err.println("Warning to-one property type does not match target key type: " + this);
  }
  resolvedKeyJavaType[0] = schema.mapToJavaTypeNullable(propertyType);
  resolvedKeyUseEquals[0] = checkUseEquals(propertyType);
}

相关文章