本文整理匯總了Java中com.j256.ormlite.field.ForeignCollectionField類的典型用法代碼示例。如果您正苦於以下問題:Java ForeignCollectionField類的具體用法?Java ForeignCollectionField怎麽用?Java ForeignCollectionField使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ForeignCollectionField類屬於com.j256.ormlite.field包,在下文中一共展示了ForeignCollectionField類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: fromForeignCollection
import com.j256.ormlite.field.ForeignCollectionField; //導入依賴的package包/類
public static FieldBindings fromForeignCollection(Element field, ForeignCollectionField foreignCollection) {
FieldBindings bindings = new FieldBindings();
bindings.fieldName = field.getSimpleName().toString();
if (foreignCollection.columnName().length() > 0) {
bindings.columnName = foreignCollection.columnName();
}
bindings.foreignCollection = true;
bindings.foreignCollectionEager = foreignCollection.eager();
@SuppressWarnings("deprecation")
int maxEagerLevel = foreignCollection.maxEagerForeignCollectionLevel();
if (maxEagerLevel != ForeignCollectionField.MAX_EAGER_LEVEL) {
bindings.foreignCollectionMaxEagerLevel = maxEagerLevel;
} else {
bindings.foreignCollectionMaxEagerLevel = foreignCollection.maxEagerLevel();
}
bindings.foreignCollectionOrderColumnName = valueIfNotBlank(foreignCollection.orderColumnName());
bindings.foreignCollectionOrderAscending = foreignCollection.orderAscending();
bindings.foreignCollectionColumnName = valueIfNotBlank(foreignCollection.columnName());
String foreignFieldName = valueIfNotBlank(foreignCollection.foreignFieldName());
if (foreignFieldName == null) {
@SuppressWarnings("deprecation")
String foreignColumnName = valueIfNotBlank(foreignCollection.foreignColumnName());
bindings.foreignCollectionForeignFieldName = valueIfNotBlank(foreignColumnName);
} else {
bindings.foreignCollectionForeignFieldName = foreignFieldName;
}
return bindings;
}
示例2: classHasAnnotations
import com.j256.ormlite.field.ForeignCollectionField; //導入依賴的package包/類
private static boolean classHasAnnotations(Class<?> paramClass)
{
while (paramClass != null)
{
if (paramClass.getAnnotation(DatabaseTable.class) != null)
return true;
Field[] arrayOfField;
try
{
arrayOfField = paramClass.getDeclaredFields();
}
catch (Throwable localThrowable1)
{
System.err.println("Could not load get delcared fields from: " + paramClass);
System.err.println(" " + localThrowable1);
return false;
}
int i = arrayOfField.length;
for (int j = 0; j < i; j++)
{
Field localField = arrayOfField[j];
if ((localField.getAnnotation(DatabaseField.class) != null) || (localField.getAnnotation(ForeignCollectionField.class) != null))
return true;
}
try
{
paramClass = paramClass.getSuperclass();
}
catch (Throwable localThrowable2)
{
System.err.println("Could not get super class for: " + paramClass);
System.err.println(" " + localThrowable2);
return false;
}
}
return false;
}