当前位置: 首页>>代码示例>>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;未经允许,请勿转载。