當前位置: 首頁>>代碼示例>>Java>>正文


Java Supplier.get方法代碼示例

本文整理匯總了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);
}
 
開發者ID:requery,項目名稱:requery,代碼行數:27,代碼來源:CollectionInitializer.java

示例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;
}
 
開發者ID:requery,項目名稱:requery,代碼行數:20,代碼來源:EntityReader.java

示例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();
}
 
開發者ID:requery,項目名稱:requery,代碼行數:8,代碼來源:ModifiableResult.java

示例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();
}
 
開發者ID:requery,項目名稱:requery,代碼行數:10,代碼來源:BaseResult.java

示例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);
}
 
開發者ID:requery,項目名稱:requery,代碼行數:16,代碼來源:ResultInitializer.java

示例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);
        }
    }
}
 
開發者ID:requery,項目名稱:requery,代碼行數:9,代碼來源:CompositeTransactionListener.java

示例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);
    }
}
 
開發者ID:requery,項目名稱:requery,代碼行數:14,代碼來源:TransactionScope.java

示例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;
}
 
開發者ID:requery,項目名稱:requery,代碼行數:6,代碼來源:EntityBuilderProxy.java


注:本文中的io.requery.util.function.Supplier.get方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。