本文整理匯總了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);
}