本文整理汇总了Java中de.greenrobot.dao.Property类的典型用法代码示例。如果您正苦于以下问题:Java Property类的具体用法?Java Property怎么用?Java Property使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Property类属于de.greenrobot.dao包,在下文中一共展示了Property类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getFollowers
import de.greenrobot.dao.Property; //导入依赖的package包/类
@Override
public List<BUser> getFollowers() {
List<BUser> users = new ArrayList<BUser>();
List<FollowerLink> followers = DaoCore.fetchEntitiesWithProperties(FollowerLink.class,
new Property[]{FollowerLinkDao.Properties.LinkOwnerBUserDaoId, FollowerLinkDao.Properties.Type},
getId(), FollowerLink.Type.FOLLOWER);
for (FollowerLink f : followers)
{
if (f!=null)
users.add(f.getBUser());
}
return users;
}
示例2: getFollows
import de.greenrobot.dao.Property; //导入依赖的package包/类
@Override
public List<BUser> getFollows() {
List<BUser> users = new ArrayList<BUser>();
List<FollowerLink> followers = DaoCore.fetchEntitiesWithProperties(FollowerLink.class,
new Property[]{FollowerLinkDao.Properties.LinkOwnerBUserDaoId, FollowerLinkDao.Properties.Type},
getId(), FollowerLink.Type.FOLLOWS);
for (FollowerLink f : followers)
{
if (f!=null)
users.add(f.getBUser());
}
return users;
}
示例3: getGBActivitySamples
import de.greenrobot.dao.Property; //导入依赖的package包/类
protected List<T> getGBActivitySamples(int timestamp_from, int timestamp_to, int activityType) {
if (getRawKindSampleProperty() == null && activityType != ActivityKind.TYPE_ALL) {
// if we do not have a raw kind property we cannot query anything else then TYPE_ALL
return Collections.emptyList();
}
QueryBuilder<T> qb = getSampleDao().queryBuilder();
Property timestampProperty = getTimestampSampleProperty();
Device dbDevice = DBHelper.findDevice(getmDevice(), getSession());
if (dbDevice == null) {
// no device, no samples
return Collections.emptyList();
}
Property deviceProperty = getDeviceIdentifierSampleProperty();
qb.where(deviceProperty.eq(dbDevice.getId()), timestampProperty.ge(timestamp_from))
.where(timestampProperty.le(timestamp_to), getClauseForActivityType(qb, activityType));
List<T> samples = qb.build().list();
for (T sample : samples) {
sample.setProvider(this);
}
return samples;
}
示例4: getActivityTypeConditions
import de.greenrobot.dao.Property; //导入依赖的package包/类
private WhereCondition getActivityTypeConditions(QueryBuilder qb, int[] dbActivityTypes) {
// What a crappy QueryBuilder API ;-( QueryBuilder.or(WhereCondition[]) with a runtime array length
// check would have worked just fine.
if (dbActivityTypes.length == 0) {
return null;
}
Property rawKindProperty = getRawKindSampleProperty();
if (dbActivityTypes.length == 1) {
return rawKindProperty.eq(dbActivityTypes[0]);
}
if (dbActivityTypes.length == 2) {
return qb.or(rawKindProperty.eq(dbActivityTypes[0]),
rawKindProperty.eq(dbActivityTypes[1]));
}
final int offset = 2;
int len = dbActivityTypes.length - offset;
WhereCondition[] trailingConditions = new WhereCondition[len];
for (int i = 0; i < len; i++) {
trailingConditions[i] = rawKindProperty.eq(dbActivityTypes[i + offset]);
}
return qb.or(rawKindProperty.eq(dbActivityTypes[0]),
rawKindProperty.eq(dbActivityTypes[1]),
trailingConditions);
}
示例5: orderAscOrDesc
import de.greenrobot.dao.Property; //导入依赖的package包/类
private transient void orderAscOrDesc(String s, Property aproperty[])
{
int i = aproperty.length;
for (int j = 0; j < i; j++)
{
Property property = aproperty[j];
checkOrderBuilder();
append(orderBuilder, property);
if (java/lang/String.equals(property.type))
{
orderBuilder.append(" COLLATE LOCALIZED");
}
orderBuilder.append(s);
}
}
示例6: getDBLuaFileByVersion
import de.greenrobot.dao.Property; //导入依赖的package包/类
private String getDBLuaFileByVersion(String s)
{
LuaZipFileDao luazipfiledao = DaoManager.getInstance().getLuaZipFileDao();
int j = (int)luazipfiledao.count();
Debug.i("chenee", (new StringBuilder()).append("lzipDao.count:").append(j).toString());
if (j > 0)
{
QueryBuilder querybuilder = luazipfiledao.queryBuilder();
Property aproperty[] = new Property[1];
aproperty[0] = de.greenrobot.daobracelet.LuaZipFileDao.Properties.Version;
querybuilder.orderDesc(aproperty);
querybuilder.where(de.greenrobot.daobracelet.LuaZipFileDao.Properties.Version.eq(s), new WhereCondition[0]);
LuaZipFile luazipfile = (LuaZipFile)querybuilder.listLazy().get(0);
String s1 = luazipfile.getVersion();
Debug.i("chenee", (new StringBuilder()).append("luaZipFile.version:").append(s1).toString());
return unzip(luazipfile.getZipFile());
} else
{
Debug.e("chenee", (new StringBuilder()).append("read DB zip failed,version:").append(s).toString());
return null;
}
}
示例7: onClick
import de.greenrobot.dao.Property; //导入依赖的package包/类
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.reorder_ok_button:
RadioGroup radioGroup = (RadioGroup) getView().findViewById(R.id.reorder_radiogroup);
int checkedRadioButtonId = radioGroup.getCheckedRadioButtonId();
boolean asc = true;
if(checkedRadioButtonId == R.id.reorder_desc_rbutton)
asc = false;
Property property = spinnerAdapter.getItem(spinner.getSelectedItemPosition());
if(listener != null)
listener.onReordering(property, asc);
default:
dismiss();
}
}
示例8: reflectProperties
import de.greenrobot.dao.Property; //导入依赖的package包/类
private static Property[] reflectProperties(Class<? extends AbstractDao<?, ?>> daoClass)
throws ClassNotFoundException, IllegalArgumentException, IllegalAccessException {
Class<?> propertiesClass = Class.forName(daoClass.getName() + "$Properties");
Field[] fields = propertiesClass.getDeclaredFields();
ArrayList<Property> propertyList = new ArrayList<Property>();
final int modifierMask = Modifier.STATIC | Modifier.PUBLIC;
for (Field field : fields) {
// There might be other fields introduced by some tools, just ignore them (see issue #28)
if ((field.getModifiers() & modifierMask) == modifierMask) {
Object fieldValue = field.get(null);
if (fieldValue instanceof Property) {
propertyList.add((Property) fieldValue);
}
}
}
Property[] properties = new Property[propertyList.size()];
for (Property property : propertyList) {
if (properties[property.ordinal] != null) {
throw new DaoException("Duplicate property ordinals");
}
properties[property.ordinal] = property;
}
return properties;
}
示例9: hasUser
import de.greenrobot.dao.Property; //导入依赖的package包/类
public boolean hasUser(BUser user){
com.braunster.chatsdk.dao.UserThreadLink data =
DaoCore.fetchEntityWithProperties(com.braunster.chatsdk.dao.UserThreadLink.class,
new Property[]{UserThreadLinkDao.Properties.BThreadDaoId, UserThreadLinkDao.Properties.BUserDaoId}, getId(), user.getId());
/* for (BUser u : getUsers())
{
if (u.getId().longValue() == user.getId().longValue())
return true;
}*/
return data != null;
}
示例10: hasThread
import de.greenrobot.dao.Property; //导入依赖的package包/类
public boolean hasThread(BThread thread){
com.braunster.chatsdk.dao.UserThreadLink data =
DaoCore.fetchEntityWithProperties(com.braunster.chatsdk.dao.UserThreadLink.class,
new Property[]{UserThreadLinkDao.Properties.BThreadDaoId, UserThreadLinkDao.Properties.BUserDaoId}, thread.getId(), getId());
return data != null;
}
示例11: fetchEntityWithProperty
import de.greenrobot.dao.Property; //导入依赖的package包/类
/** Fetch an entity for given property and value. If more then one found the first will be returned.*/
public static <T extends Entity> T fetchEntityWithProperty(Class<T> c, Property property,Object value){
QueryBuilder<T> qb = daoSession.queryBuilder(c);
qb.where(property.eq(value));
List<T> list = qb.list();
if (list != null && list.size()>0)
return list.get(0) ;
else return null;
}
示例12: fetchEntityWithProperties
import de.greenrobot.dao.Property; //导入依赖的package包/类
public static <T extends Entity> T fetchEntityWithProperties(Class<T> c, Property properties[],Object... values){
List<T> list = fetchEntitiesWithPropertiesAndOrder(c, null, -1, properties, values);
if (list == null || list.size() == 0)
return null;
return list.get(0);
}
示例13: fetchEntitiesWithPropertiesAndOrder
import de.greenrobot.dao.Property; //导入依赖的package包/类
public static <T extends Entity> List<T> fetchEntitiesWithPropertiesAndOrder(Class<T> c, Property whereOrder, int order, Property properties[], Object... values){
if (values == null || properties == null)
throw new NullPointerException("You must have at least one value and one property");
if (values.length != properties.length)
throw new IllegalArgumentException("Values size should match properties size");
QueryBuilder<T> qb = daoSession.queryBuilder(c);
qb.where(properties[0].eq(values[0]));
for (int i = 0 ; i < values.length ; i++)
qb.where(properties[i].eq(values[i]));
if (whereOrder != null && order != -1)
switch (order)
{
case ORDER_ASC:
qb.orderAsc(whereOrder);
break;
case ORDER_DESC:
qb.orderDesc(whereOrder);
break;
}
return qb.list();
}
示例14: fetchEntitiesWithPropertiesAndOrderAndLimit
import de.greenrobot.dao.Property; //导入依赖的package包/类
public static <T extends Entity> List<T> fetchEntitiesWithPropertiesAndOrderAndLimit(Class<T> c, int limit, Property whereOrder, int order, Property properties[], Object... values){
if (values == null || properties == null)
throw new NullPointerException("You must have at least one value and one property");
if (values.length != properties.length)
throw new IllegalArgumentException("Values size should match properties size");
QueryBuilder<T> qb = daoSession.queryBuilder(c);
qb.where(properties[0].eq(values[0]));
if (values.length > 1)
for (int i = 0 ; i < values.length ; i++)
qb.where(properties[i].eq(values[i]));
if (whereOrder != null && order != -1)
switch (order)
{
case ORDER_ASC:
qb.orderAsc(whereOrder);
break;
case ORDER_DESC:
qb.orderDesc(whereOrder);
break;
}
if (limit != -1)
qb.limit(limit);
return qb.listLazy();
}
示例15: getList
import de.greenrobot.dao.Property; //导入依赖的package包/类
public static List getList(AbstractDao dao, Property orderProperty, WhereCondition cond, WhereCondition... condMore) {
setIfLog();
List indexFavList = dao.queryBuilder()
.where(cond, condMore)
.orderAsc(orderProperty)
.list();
return indexFavList;
}