本文整理汇总了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;
}