List of usage examples for com.google.common.collect MultimapBuilder enumKeys
public static <K0 extends Enum<K0>> MultimapBuilderWithKeys<K0> enumKeys(final Class<K0> keyClass)
From source file:com.torodb.torod.db.postgresql.query.processors.InProcessor.java
public static List<ProcessedQueryCriteria> process(InQueryCriteria criteria, QueryCriteriaVisitor<List<ProcessedQueryCriteria>, Void> visitor) { if (!Utils.isTypeKnownInStructure(criteria.getAttributeReference())) { return Collections.singletonList(new ProcessedQueryCriteria(null, criteria)); } else {/*from w w w .j av a 2 s. c o m*/ Multimap<BasicType, Value<?>> byTypeValues = MultimapBuilder.enumKeys(BasicType.class).hashSetValues() .build(); for (Value<?> value : criteria.getValue()) { byTypeValues.put(value.getType(), value); } List<ProcessedQueryCriteria> result; if (byTypeValues.isEmpty()) { result = Collections.emptyList(); } else { result = Lists.newArrayList(); ProcessedQueryCriteria typeQuery; typeQuery = getNumericQuery(criteria, byTypeValues); if (typeQuery != null) { result.add(typeQuery); } typeQuery = getProcessedQuery(criteria, byTypeValues, BasicType.STRING); if (typeQuery != null) { result.add(typeQuery); } typeQuery = getProcessedQuery(criteria, byTypeValues, BasicType.ARRAY); if (typeQuery != null) { result.add(typeQuery); } typeQuery = getProcessedQuery(criteria, byTypeValues, BasicType.BOOLEAN); if (typeQuery != null) { result.add(typeQuery); } typeQuery = getProcessedQuery(criteria, byTypeValues, BasicType.NULL); if (typeQuery != null) { result.add(typeQuery); } } return result; } }
From source file:com.torodb.torod.db.backends.query.processors.InProcessor.java
public static List<ProcessedQueryCriteria> process(InQueryCriteria criteria, QueryCriteriaVisitor<List<ProcessedQueryCriteria>, Void> visitor) { if (!Utils.isTypeKnownInStructure(criteria.getAttributeReference())) { return Collections.singletonList(new ProcessedQueryCriteria(null, criteria)); } else {/* www . j ava 2 s .c om*/ Multimap<ScalarType, ScalarValue<?>> byTypeValues = MultimapBuilder.enumKeys(ScalarType.class) .hashSetValues().build(); for (ScalarValue<?> value : criteria.getValue()) { byTypeValues.put(value.getType(), value); } List<ProcessedQueryCriteria> result; if (byTypeValues.isEmpty()) { result = Collections.emptyList(); } else { result = Lists.newArrayList(); ProcessedQueryCriteria typeQuery; typeQuery = getNumericQuery(criteria, byTypeValues); if (typeQuery != null) { result.add(typeQuery); } typeQuery = getProcessedQuery(criteria, byTypeValues, ScalarType.STRING); if (typeQuery != null) { result.add(typeQuery); } typeQuery = getProcessedQuery(criteria, byTypeValues, ScalarType.ARRAY); if (typeQuery != null) { result.add(typeQuery); } typeQuery = getProcessedQuery(criteria, byTypeValues, ScalarType.BOOLEAN); if (typeQuery != null) { result.add(typeQuery); } typeQuery = getProcessedQuery(criteria, byTypeValues, ScalarType.NULL); if (typeQuery != null) { result.add(typeQuery); } } return result; } }
From source file:org.guldenj.protocols.channels.PaymentChannelV2ServerState.java
@Override public Multimap<State, State> getStateTransitions() { Multimap<State, State> result = MultimapBuilder.enumKeys(State.class).arrayListValues().build(); result.put(State.UNINITIALISED, State.READY); result.put(State.UNINITIALISED, State.WAITING_FOR_MULTISIG_CONTRACT); result.put(State.WAITING_FOR_MULTISIG_CONTRACT, State.WAITING_FOR_MULTISIG_ACCEPTANCE); result.put(State.WAITING_FOR_MULTISIG_ACCEPTANCE, State.READY); result.put(State.READY, State.CLOSING); result.put(State.CLOSING, State.CLOSED); for (State state : State.values()) { result.put(state, State.ERROR); }// w w w. ja v a2 s . co m return result; }
From source file:org.litecoinj.protocols.channels.PaymentChannelV1ServerState.java
@Override public Multimap<State, State> getStateTransitions() { Multimap<State, State> result = MultimapBuilder.enumKeys(State.class).arrayListValues().build(); result.put(State.UNINITIALISED, State.READY); result.put(State.UNINITIALISED, State.WAITING_FOR_REFUND_TRANSACTION); result.put(State.WAITING_FOR_REFUND_TRANSACTION, State.WAITING_FOR_MULTISIG_CONTRACT); result.put(State.WAITING_FOR_MULTISIG_CONTRACT, State.WAITING_FOR_MULTISIG_ACCEPTANCE); result.put(State.WAITING_FOR_MULTISIG_ACCEPTANCE, State.READY); result.put(State.READY, State.CLOSING); result.put(State.CLOSING, State.CLOSED); for (State state : State.values()) { result.put(state, State.ERROR); }//from w w w . j a va2 s . c o m return result; }
From source file:org.guldenj.protocols.channels.PaymentChannelV2ClientState.java
@Override protected Multimap<State, State> getStateTransitions() { Multimap<State, State> result = MultimapBuilder.enumKeys(State.class).arrayListValues().build(); result.put(State.UNINITIALISED, State.NEW); result.put(State.UNINITIALISED, State.READY); result.put(State.NEW, State.SAVE_STATE_IN_WALLET); result.put(State.SAVE_STATE_IN_WALLET, State.PROVIDE_MULTISIG_CONTRACT_TO_SERVER); result.put(State.PROVIDE_MULTISIG_CONTRACT_TO_SERVER, State.READY); result.put(State.READY, State.EXPIRED); result.put(State.READY, State.CLOSED); return result; }
From source file:org.pentaho.di.trans.dataservice.DataServiceExecutor.java
private DataServiceExecutor(Builder builder) { sql = builder.sql;/* w w w . j a va 2 s. c o m*/ service = builder.service; parameters = Maps.newHashMap(builder.parameters); parameters.putAll(getWhereConditionParameters()); serviceTrans = builder.serviceTrans; sqlTransGenerator = builder.sqlTransGenerator; genTrans = builder.genTrans; listenerMap = MultimapBuilder.enumKeys(ExecutionPoint.class).linkedListValues().build(); }
From source file:org.guldenj.protocols.channels.PaymentChannelV1ClientState.java
@Override protected Multimap<State, State> getStateTransitions() { Multimap<State, State> result = MultimapBuilder.enumKeys(State.class).arrayListValues().build(); result.put(State.UNINITIALISED, State.NEW); result.put(State.UNINITIALISED, State.READY); result.put(State.NEW, State.INITIATED); result.put(State.INITIATED, State.WAITING_FOR_SIGNED_REFUND); result.put(State.WAITING_FOR_SIGNED_REFUND, State.SAVE_STATE_IN_WALLET); result.put(State.SAVE_STATE_IN_WALLET, State.PROVIDE_MULTISIG_CONTRACT_TO_SERVER); result.put(State.PROVIDE_MULTISIG_CONTRACT_TO_SERVER, State.READY); result.put(State.READY, State.EXPIRED); result.put(State.READY, State.CLOSED); return result; }
From source file:org.elasticsearch.search.internal.SearchContext.java
/** * Schedule the release of a resource. The time when {@link Releasable#release()} will be called on this object * is function of the provided {@link Lifetime}. *//*w w w .j a v a 2 s .com*/ public void addReleasable(Releasable releasable, Lifetime lifetime) { if (clearables == null) { clearables = MultimapBuilder.enumKeys(Lifetime.class).arrayListValues().build(); } clearables.put(lifetime, releasable); }