本文整理汇总了Java中com.db4o.ObjectSet类的典型用法代码示例。如果您正苦于以下问题:Java ObjectSet类的具体用法?Java ObjectSet怎么用?Java ObjectSet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ObjectSet类属于com.db4o包,在下文中一共展示了ObjectSet类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getAllRegistrations
import com.db4o.ObjectSet; //导入依赖的package包/类
public static ObjectSet<RegisterContextRequest> getAllRegistrations() {
ObjectSet<RegisterContextRequest> result = db
.queryByExample(RegisterContextRequest.class);
// listResult(result);
return result;
}
开发者ID:UniSurreyIoT,项目名称:fiware-iot-discovery-ngsi9,代码行数:8,代码来源:RegisterStoreAccess.java
示例2: retrieveSystem
import com.db4o.ObjectSet; //导入依赖的package包/类
public CentralAuthority retrieveSystem()
{
ObjectContainer conn = createConnection();
ObjectSet<CentralAuthority> systems = conn.query(CentralAuthority.class); // Change to the object you want to save
CentralAuthority system;
if (systems.size() == 0){
//system = CentralAuthority.getInstance();
system = ConfigureCentralAuthority.initialize();
// If there's no System in the record, create a new one
}
else{
//system = systems.get(0);
system = systems.get(systems.size() - 1);
}
conn.close();
return system;
}
开发者ID:abhishek-nandgaonkar,项目名称:HealTech,代码行数:20,代码来源:DB4OUtil.java
示例3: clearSystem
import com.db4o.ObjectSet; //导入依赖的package包/类
public synchronized void clearSystem()
{
ObjectContainer conn = createConnection();
ObjectSet<CentralAuthority> systems = conn.query(CentralAuthority.class); // Change to the object you want to save
CentralAuthority system;
if (systems.size() == 0){
system = ConfigureCentralAuthority.initialize(); // If there's no System in the record, create a new one
}
else{
system = systems.get(0);
}
conn.delete(system);
conn.close();
}
开发者ID:abhishek-nandgaonkar,项目名称:HealTech,代码行数:17,代码来源:DB4OUtil.java
示例4: find
import com.db4o.ObjectSet; //导入依赖的package包/类
/**
* QBE对象查询
*
* @param
* @return T
* @throws
* 2013-8-28 下午02:25:49
*/
public <T> T find(T entity) {
ObjectSet<T> result = db.queryByExample(entity);
T t = null;
while (result.hasNext()) {
t = result.next();
}
return t;
}
开发者ID:hblt-j,项目名称:xmvc-for-android,代码行数:17,代码来源:DB4OHelper.java
示例5: findLs
import com.db4o.ObjectSet; //导入依赖的package包/类
/**
* 条件查询实例
*
* @param
* @return T
* @throws
* 2013-8-28 下午02:27:03
*/
public <T> List<T> findLs(Class<T> entity, String[] paramNames, Object[] values, Map<String, String> order) {
List<T> list = new ArrayList<T>();
Query query = db.query();
query.constrain(entity);
query = setAttr(query, paramNames, values);
query = setOrder(query, order);
ObjectSet<T> result = query.execute();
T t;
while (result.hasNext()) {
t = result.next();
list.add(t);
}
return list;
}
开发者ID:hblt-j,项目名称:xmvc-for-android,代码行数:23,代码来源:DB4OHelper.java
示例6: findAll
import com.db4o.ObjectSet; //导入依赖的package包/类
/**
* findAll加排序
*
* @param
* @return List<T>
* @throws
* 2013-8-28 下午02:27:30
*/
public <T> List<T> findAll(Class<T> entity, Map<String, String> order) {
List<T> list = new ArrayList<T>();
Query query = db.query();
query.constrain(entity);
query = setOrder(query, order);
ObjectSet<T> result = query.execute();
T t;
while (result.hasNext()) {
t = result.next();
list.add(t);
}
return list;
}
开发者ID:hblt-j,项目名称:xmvc-for-android,代码行数:22,代码来源:DB4OHelper.java
示例7: findByBlur
import com.db4o.ObjectSet; //导入依赖的package包/类
/**
* 模糊条件查询实例
*
* @param
* @return List<T>
* @throws
* 2013-8-28 下午02:27:55
*/
public <T> List<T> findByBlur(Class<T> entity, String[] paramNames, Object[] values, Map<String, String> order) {
Query query = db.query();
query.constrain(entity);
query = setBlurAttr(query, paramNames, values);
query = setOrder(query, order);
ObjectSet<T> result = query.execute();
List<T> list = new ArrayList<T>();
T t;
while (result.hasNext()) {
t = result.next();
list.add(t);
}
return list;
}
开发者ID:hblt-j,项目名称:xmvc-for-android,代码行数:23,代码来源:DB4OHelper.java
示例8: loadOrCreateState
import com.db4o.ObjectSet; //导入依赖的package包/类
private PersistedAutoIncrements loadOrCreateState() {
ObjectSet<PersistedAutoIncrements> existingState = container.query(PersistedAutoIncrements.class);
if(0==existingState.size()){
return new PersistedAutoIncrements();
} else if(1==existingState.size()){
return existingState.get(0);
} else{
throw new IllegalStateException("Cannot have more than one state stored in database");
}
}
开发者ID:hblt-j,项目名称:xmvc-for-android,代码行数:11,代码来源:AutoIncrement.java
示例9: put
import com.db4o.ObjectSet; //导入依赖的package包/类
@Override
public void put(final K key, V value) throws StorageOperationException {
ObjectContainer db = Db4oEmbedded.openFile(getConfiguration(), source);
ObjectSet<V> set = db.query(new Predicate<V>() {
@Override
public boolean match(V v) {
if (key.match(v))
return true;
else
return false;
}
});
db.delete(set);
db.store(value);
db.close();
}
开发者ID:kboom,项目名称:setphrase,代码行数:17,代码来源:DB4oObjectStorage.java
示例10: printObjects
import com.db4o.ObjectSet; //导入依赖的package包/类
public void printObjects(Class c)
{
ObjectContainer client = this.server.openClient();
Query query = client.query();
query.constrain(DescrizioneProdotto.class);
ObjectSet list = query.execute();
Iterator iter = list.iterator();
int i = 1;
while(iter.hasNext())
{
DescrizioneProdotto desc = (DescrizioneProdotto) iter.next();
List<IScontoProdottoStrategy> sconti = desc.getTuttiSconti();
for(IScontoProdottoStrategy sconto:sconti)
{
System.out.println("Sconto: "+sconto.getClass()+" valid: "+sconto.isValid(DateTime.now()));
}
i++;
}
client.close();
}
开发者ID:GameShopAdvance,项目名称:GameShop-Advance,代码行数:21,代码来源:DbManagerSingleton.java
示例11: readBelowThreshold
import com.db4o.ObjectSet; //导入依赖的package包/类
/**
* Restituisce gli oggetti DescrizioneProdotto che si trovano al di sotto della soglia stabilita
* @return Lista delle descrizioni sotto soglia
*/
public LinkedList<IDescrizioneProdotto> readBelowThreshold(){
ObjectContainer client = DbManagerSingleton.getInstance().getClient();
ObjectSet<IDescrizioneProdotto> result = client.query(new Predicate<IDescrizioneProdotto>() {
@Override
public boolean match(IDescrizioneProdotto candidate) {
if(candidate.getClass() != DescrizioneProdottoSmartProxy.class)
return false;
else
return candidate.sottoSoglia();
}
});
if(result.isEmpty())
return new ActivatableLinkedList<>();
else{
LinkedList<IDescrizioneProdotto> list = new ActivatableLinkedList<>(result);
return list;
}
}
开发者ID:GameShopAdvance,项目名称:GameShop-Advance,代码行数:24,代码来源:DbDescrizioneProdottoSingleton.java
示例12: read
import com.db4o.ObjectSet; //导入依赖的package包/类
public IPrenotazione read(final Integer id)
{
ObjectContainer client = DbManagerSingleton.getInstance().getClient();
ObjectSet<PrenotazioneSmartProxy> result = client.query(new Predicate<PrenotazioneSmartProxy>() {
@Override
public boolean match(PrenotazioneSmartProxy candidate) {
Integer idTrans;
try {
idTrans = candidate.getId();
}
catch (RemoteException ex) {
return false;
}
if(idTrans.intValue() == id.intValue())
return true;
else
return false;
}
});
if(result.isEmpty())
return null;
return (IPrenotazione) result.get(0);
}
开发者ID:GameShopAdvance,项目名称:GameShop-Advance,代码行数:24,代码来源:DbPrenotazioneSingleton.java
示例13: read
import com.db4o.ObjectSet; //导入依赖的package包/类
/**
* Recupera dal db l'oggetto Configuration.
* @return la configurazione salvata
*/
public Configuration read(){
Query query = this.db.query();
query.constrain(Configuration.class);
ObjectSet<Object> config = query.execute();
Configuration result;
if(config.isEmpty())
result = null;
else
result = (Configuration) config.get(0);
return result;
}
开发者ID:GameShopAdvance,项目名称:GameShop-Advance,代码行数:16,代码来源:DbConfigurationSingleton.java
示例14: read
import com.db4o.ObjectSet; //导入依赖的package包/类
/**
* @return la configurazione salvata
*/
public Configuration read(){
Query query = this.db.query();
query.constrain(Configuration.class);
ObjectSet<Object> config = query.execute();
Configuration result;
if(config.isEmpty())
result = null;
else
result = (Configuration) config.get(0);
return result;
}
开发者ID:GameShopAdvance,项目名称:GameShop-Advance,代码行数:15,代码来源:DbConfigurationSingleton.java
示例15: read
import com.db4o.ObjectSet; //导入依赖的package包/类
/**
* @return configuration dal db
*/
public Configuration read(){
Query query = this.db.query();
query.constrain(Configuration.class);
ObjectSet<Object> config = query.execute();
Configuration result;
if(config.isEmpty())
result = null;
else
result = (Configuration) config.get(0);
return result;
}
开发者ID:GameShopAdvance,项目名称:GameShop-Advance,代码行数:15,代码来源:DbConfigurationSingleton.java
示例16: get
import com.db4o.ObjectSet; //导入依赖的package包/类
public T get(T prototype) {
T result = null;
ObjectSet<T> objSet = db().queryByExample(prototype);
if (objSet.hasNext()) {
result = objSet.next();
}
return result;
}
开发者ID:JCERTIFLab,项目名称:jcertif-android-2013,代码行数:9,代码来源:JCertifDb4oHelper.java
示例17: deleteDatabase
import com.db4o.ObjectSet; //导入依赖的package包/类
public void deleteDatabase() {
// We dont actually delete the database we just wipe all objects in it
ObjectSet<Object> results = db().query(Object.class);
if ((results != null) && (results.size() > 0)) {
for (Object o : results) {
db().delete(o);
}
close();
Toast.makeText(this.context, "Finished Deleting Database",
Toast.LENGTH_SHORT).show();
}
}
开发者ID:JCERTIFLab,项目名称:jcertif-android-2013,代码行数:14,代码来源:JCertifDb4oHelper.java
示例18: getAll
import com.db4o.ObjectSet; //导入依赖的package包/类
@Override
public Scriptable[] getAll(Function function, String type) {
ObjectContainer con = getDB(type);
ObjectSet<HashMap<Object, Object>> maps = con.query().execute();
Scriptable[] models = new Scriptable[maps.size()];
int a = 0;
while (maps.hasNext()) {
HashMap<Object, Object> map2 = maps.next();
Scriptable model = function.construct(Context.getCurrentContext(), null, new Object[0]);
for (Object obj2 : map2.keySet()) {
String key = obj2.toString();
Object value = map2.get(obj2);
model.put(key, model, value);
model.put("_id_", model, con.ext().getID(map2));
}
models[a] = model;
a++;
}
return models;
}
开发者ID:govu,项目名称:govu,代码行数:21,代码来源:DB4OProvider.java
示例19: delete
import com.db4o.ObjectSet; //导入依赖的package包/类
@Override
public void delete(ScriptableObject obj, String type) {
//TODO delete by _id_
ObjectContainer con = getDB(type);
final HashMap<Object, Object> map = new HashMap<>();
for (Object id : obj.getAllIds()) {
map.put(id, obj.get(id));
}
ObjectSet<HashMap<Object, Object>> maps = con.query(new Predicate<HashMap<Object, Object>>() {
@Override
public boolean match(HashMap<Object, Object> et) {
for (Object key : map.keySet()) {
if (!(et.containsKey(key) && et.get(key).equals(map.get(key)))) {
return false;
}
}
return true;
}
});
while (maps.hasNext()) {
con.delete(maps.next());
}
con.commit();
}
开发者ID:govu,项目名称:govu,代码行数:26,代码来源:DB4OProvider.java
示例20: get
import com.db4o.ObjectSet; //导入依赖的package包/类
public T get(final Object id) {
T result = null;
synchronized (DB4OUtils.class) {
ObjectContainer oc = Db4oEmbedded.openFile(DB4OUtils
.getDataBasePath());
try {
ObjectSet<T> os = oc.query(new Predicate<T>() {
/**
*
*/
private static final long serialVersionUID = 7212666772385276584L;
@Override
public boolean match(T t) {
// TODO Auto-generated method stub
return t.getId() != null && t.getId().equals(id);
}
});
if (os.size() > 0) {
result = os.get(0);
}
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
} finally {
oc.close();
}
}
return result;
}
开发者ID:yukozh,项目名称:CodeComb.Mobile.Android,代码行数:39,代码来源:BaseProvider.java
注:本文中的com.db4o.ObjectSet类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论