本文整理汇总了Java中com.yahoo.squidb.annotations.PrimaryKey类的典型用法代码示例。如果您正苦于以下问题:Java PrimaryKey类的具体用法?Java PrimaryKey怎么用?Java PrimaryKey使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PrimaryKey类属于com.yahoo.squidb.annotations包,在下文中一共展示了PrimaryKey类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processVariableElement
import com.yahoo.squidb.annotations.PrimaryKey; //导入依赖的package包/类
@Override
public boolean processVariableElement(VariableElement field, DeclaredTypeName fieldType) {
if (field.getAnnotation(PrimaryKey.class) != null) {
return handlePrimaryKeyField(field, fieldType);
} else {
return super.processVariableElement(field, fieldType);
}
}
示例2: getColumnDefinition
import com.yahoo.squidb.annotations.PrimaryKey; //导入依赖的package包/类
/**
* @return the full column definition for this Property as a SQL string
*/
protected String getColumnDefinition() {
StringBuilder toReturn = new StringBuilder();
String constraints = extras != null ? extras.constraints() : ColumnSpec.DEFAULT_NONE;
if (!ColumnSpec.DEFAULT_NONE.equals(constraints)) {
toReturn.append(constraints);
}
if (!ColumnSpec.DEFAULT_NONE.equals(getColumnDefault())) {
String columnDefaultValue = getColumnDefinitionDefaultValue();
if (!toReturn.toString().toUpperCase().contains("DEFAULT")) {
toReturn.append(" DEFAULT ").append(columnDefaultValue);
} else {
utils.getMessager().printMessage(Kind.WARNING, "Duplicate default value definitions", field);
}
}
if (field != null && field.getAnnotation(PrimaryKey.class) != null) {
PrimaryKey primaryKeyAnnotation = field.getAnnotation(PrimaryKey.class);
if (!toReturn.toString().toUpperCase().contains("PRIMARY KEY")) {
toReturn.append(" PRIMARY KEY ");
if (TypeConstants.isIntegerType(getTypeForAccessors()) && primaryKeyAnnotation.autoincrement()) {
toReturn.append("AUTOINCREMENT");
}
} else {
utils.getMessager().printMessage(Kind.WARNING, "Duplicate primary key definition in column constraints."
+ " Use the @PrimaryKey annotation instead of declaring the constraint in ColumnSpec.");
}
}
String toReturnString = toReturn.toString().trim();
if (!AptUtils.isEmpty(toReturnString)) {
return "\"" + toReturnString + "\"";
}
return null;
}
示例3: isIntegerPrimaryKey
import com.yahoo.squidb.annotations.PrimaryKey; //导入依赖的package包/类
private boolean isIntegerPrimaryKey(VariableElement field, DeclaredTypeName fieldType) {
return field.getAnnotation(PrimaryKey.class) != null &&
TypeConstants.isIntegerType(fieldType);
}