本文整理汇总了Java中io.requery.util.function.Supplier.get方法的典型用法代码示例。如果您正苦于以下问题:Java Supplier.get方法的具体用法?Java Supplier.get怎么用?Java Supplier.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.requery.util.function.Supplier
的用法示例。
在下文中一共展示了Supplier.get方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initialize
import io.requery.util.function.Supplier; //导入方法依赖的package包/类
@Override
public <U> V initialize(EntityProxy<E> proxy,
Attribute<E, V> attribute,
Supplier<? extends Result<U>> query) {
Class<?> type = attribute.getClassType();
CollectionChanges<E, U> changes = new CollectionChanges<>(proxy, attribute);
Result<U> result = query == null ? null : query.get();
Collection<U> collection;
if (type == Set.class) {
Set<U> set = attribute.getOrderByAttribute() == null ?
new HashSet<U>() : new LinkedHashSet<U>();
if (result != null) {
result.collect(set);
}
collection = new ObservableSet<>(set, changes);
} else if (type == List.class) {
ArrayList<U> list = new ArrayList<>();
if (result != null) {
result.collect(list);
}
collection = new ObservableList<>(list, changes);
} else {
throw new IllegalStateException("Unsupported collection type " + type);
}
return attribute.getClassType().cast(collection);
}
示例2: order
import io.requery.util.function.Supplier; //导入方法依赖的package包/类
private <Q extends S> Supplier<? extends Result<Q>>
order(WhereAndOr<? extends Result<Q>> query, Supplier<Attribute> supplier) {
if (supplier != null) {
Attribute attribute = supplier.get();
if (attribute.getOrderByDirection() != null && attribute instanceof Functional) {
switch (attribute.getOrderByDirection()) {
case ASC:
query.orderBy(((Functional)attribute).asc());
break;
case DESC:
query.orderBy(((Functional)attribute).desc());
break;
}
} else {
query.orderBy((Expression)attribute);
}
}
return query;
}
示例3: firstOr
import io.requery.util.function.Supplier; //导入方法依赖的package包/类
@Override
public E firstOr(Supplier<E> supplier) {
if (result != null) {
return result.firstOr(supplier);
}
return supplier.get();
}
示例4: firstOr
import io.requery.util.function.Supplier; //导入方法依赖的package包/类
@Override
public E firstOr(Supplier<E> supplier) {
try (CloseableIterator<E> iterator = createIterator()) {
if (iterator.hasNext()) {
return iterator.next();
}
}
return supplier.get();
}
示例5: initialize
import io.requery.util.function.Supplier; //导入方法依赖的package包/类
@Override
public <U> V initialize(EntityProxy<E> proxy,
Attribute<E, V> attribute,
Supplier<? extends Result<U>> query) {
Class<?> type = attribute.getClassType();
CollectionChanges<E, U> changes = new CollectionChanges<>(proxy, attribute);
Result<U> result = query == null ? null : query.get();
Object collection;
if (Iterable.class.isAssignableFrom(type)) {
collection = new ModifiableResult<>(result, changes);
} else {
throw new IllegalStateException("Unsupported result type " + type);
}
return attribute.getClassType().cast(collection);
}
示例6: CompositeTransactionListener
import io.requery.util.function.Supplier; //导入方法依赖的package包/类
CompositeTransactionListener(Set<Supplier<TransactionListener>> listenerFactories) {
for (Supplier<TransactionListener> supplier : listenerFactories) {
TransactionListener listener = supplier.get();
if (listener != null) {
add(listener);
}
}
}
示例7: TransactionScope
import io.requery.util.function.Supplier; //导入方法依赖的package包/类
TransactionScope(Supplier<? extends EntityTransaction> supplier, Set<Type<?>> types) {
this.transaction = supplier.get();
if (!transaction.active()) {
transaction.begin();
enteredTransaction = true;
} else {
enteredTransaction = false;
}
if (types != null) {
transaction.addToTransaction(types);
}
}
示例8: EntityBuilderProxy
import io.requery.util.function.Supplier; //导入方法依赖的package包/类
public EntityBuilderProxy(Type<E> type) {
Supplier<B> supplier = type.getBuilderFactory();
this.builder = supplier.get();
this.type = type;
}