javax.annotation.CheckReturnValue Java Examples
The following examples show how to use
javax.annotation.CheckReturnValue.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DeadlineSubject.java From grpc-nebula-java with Apache License 2.0 | 6 votes |
/** * Prepares for a check that the subject is deadline within the given tolerance of an * expected value that will be provided in the next call in the fluent chain. */ @CheckReturnValue public TolerantDeadlineComparison isWithin(final long delta, final TimeUnit timeUnit) { return new TolerantDeadlineComparison() { @Override public void of(Deadline expected) { Deadline actual = actual(); checkNotNull(actual, "actual value cannot be null. expected=%s", expected); // This is probably overkill, but easier than thinking about overflow. BigInteger actualTimeRemaining = BigInteger.valueOf(actual.timeRemaining(NANOSECONDS)); BigInteger expectedTimeRemaining = BigInteger.valueOf(expected.timeRemaining(NANOSECONDS)); BigInteger deltaNanos = BigInteger.valueOf(timeUnit.toNanos(delta)); if (actualTimeRemaining.subtract(expectedTimeRemaining).abs().compareTo(deltaNanos) > 0) { failWithoutActual( simpleFact( lenientFormat( "%s and <%s> should have been within <%sns> of each other", actualAsString(), expected, deltaNanos))); } } }; }
Example #2
Source File: KeepAliveEnforcer.java From grpc-nebula-java with Apache License 2.0 | 6 votes |
/** Returns {@code false} when client is misbehaving and should be disconnected. */ @CheckReturnValue public boolean pingAcceptable() { long now = ticker.nanoTime(); boolean valid; if (!hasOutstandingCalls && !permitWithoutCalls) { valid = compareNanos(lastValidPingTime + IMPLICIT_PERMIT_TIME_NANOS, now) <= 0; } else { valid = compareNanos(lastValidPingTime + minTimeNanos, now) <= 0; } if (!valid) { pingStrikes++; return !(pingStrikes > MAX_PING_STRIKES); } else { lastValidPingTime = now; return true; } }
Example #3
Source File: NettyServerBuilder.java From grpc-nebula-java with Apache License 2.0 | 6 votes |
@Override @CheckReturnValue protected NettyServer buildTransportServer( List<ServerStreamTracer.Factory> streamTracerFactories) { ProtocolNegotiator negotiator = protocolNegotiator; if (negotiator == null) { negotiator = sslContext != null ? ProtocolNegotiators.serverTls(sslContext) : ProtocolNegotiators.serverPlaintext(); } return new NettyServer( address, channelType, channelOptions, bossEventLoopGroup, workerEventLoopGroup, negotiator, streamTracerFactories, transportTracerFactory, maxConcurrentCallsPerConnection, flowControlWindow, maxMessageSize, maxHeaderListSize, keepAliveTimeInNanos, keepAliveTimeoutInNanos, maxConnectionIdleInNanos, maxConnectionAgeInNanos, maxConnectionAgeGraceInNanos, permitKeepAliveWithoutCalls, permitKeepAliveTimeInNanos, channelz); }
Example #4
Source File: GraqlCompute.java From graql with GNU Affero General Public License v3.0 | 5 votes |
@CheckReturnValue public Graql.Token.Compute.Algorithm using() { if (algorithm == null) { return Graql.Token.Compute.Algorithm.DEGREE; } else { return algorithm; } }
Example #5
Source File: Computable.java From graql with GNU Affero General Public License v3.0 | 5 votes |
@CheckReturnValue @SuppressWarnings("unchecked") default T where(U arg, U... args) { ArrayList<U> argList = new ArrayList<>(args.length + 1); argList.add(arg); argList.addAll(Arrays.asList(args)); return where(argList); }
Example #6
Source File: Graql.java From graql with GNU Affero General Public License v3.0 | 5 votes |
/** * @param patterns a collection of patterns to match * @return a pattern that will match when any contained pattern matches */ @CheckReturnValue public static Pattern or(Collection<? extends Pattern> patterns) { // Simplify representation when there is only one alternative if (patterns.size() == 1) { return patterns.iterator().next(); } return or(new LinkedHashSet<>(patterns)); }
Example #7
Source File: Computable.java From graql with GNU Affero General Public License v3.0 | 5 votes |
@CheckReturnValue default T of(String type, String... types) { ArrayList<String> typeList = new ArrayList<>(types.length + 1); typeList.add(type); typeList.addAll(Arrays.asList(types)); return of(typeList); }
Example #8
Source File: GraqlInsert.java From graql with GNU Affero General Public License v3.0 | 4 votes |
@Nullable @CheckReturnValue public MatchClause match() { return match; }
Example #9
Source File: Graql.java From graql with GNU Affero General Public License v3.0 | 4 votes |
@CheckReturnValue public static StatementAttribute eq(double value) { return hiddenVar().eq(value); }
Example #10
Source File: Computable.java From graql with GNU Affero General Public License v3.0 | 4 votes |
@CheckReturnValue T in(Collection<String> types);
Example #11
Source File: Graql.java From graql with GNU Affero General Public License v3.0 | 4 votes |
@CheckReturnValue public static StatementAttribute neq(boolean value) { return hiddenVar().neq(value); }
Example #12
Source File: MatchClause.java From graql with GNU Affero General Public License v3.0 | 4 votes |
/** * @param statements a collection of statements that indicate properties to delete * @return a delete query that will delete the given variables for each result of this match clause */ @CheckReturnValue public final GraqlDelete delete(Collection<? extends Statement> statements) { return new GraqlDelete(this, new ArrayList<>(statements)); }
Example #13
Source File: GraqlDelete.java From graql with GNU Affero General Public License v3.0 | 4 votes |
@CheckReturnValue public MatchClause match() { return match; }
Example #14
Source File: StatementAttributeBuilder.java From graql with GNU Affero General Public License v3.0 | 4 votes |
@CheckReturnValue default StatementAttribute neq(boolean value) { return neq(Comparison.Boolean::new, value); }
Example #15
Source File: GraqlCompute.java From graql with GNU Affero General Public License v3.0 | 4 votes |
@CheckReturnValue public Set<Graql.Token.Compute.Param> getParameters() { return argumentsOrdered.keySet(); }
Example #16
Source File: StatementAttributeBuilder.java From graql with GNU Affero General Public License v3.0 | 4 votes |
@CheckReturnValue default StatementAttribute gt(LocalDateTime value) { return gt(Comparison.DateTime::new, value); }
Example #17
Source File: Graql.java From graql with GNU Affero General Public License v3.0 | 4 votes |
@CheckReturnValue public static StatementAttribute contains(Statement variable) { return hiddenVar().contains(variable); }
Example #18
Source File: GraqlCompute.java From graql with GNU Affero General Public License v3.0 | 4 votes |
@CheckReturnValue public boolean includesAttributes() { return includeAttributes; }
Example #19
Source File: Graql.java From graql with GNU Affero General Public License v3.0 | 4 votes |
@CheckReturnValue public static StatementAttribute eq(String value) { return hiddenVar().eq(value); }
Example #20
Source File: StatementAttributeBuilder.java From graql with GNU Affero General Public License v3.0 | 4 votes |
@CheckReturnValue default StatementAttribute lte(String value) { return lte(Comparison.String::new, value); }
Example #21
Source File: Graql.java From graql with GNU Affero General Public License v3.0 | 4 votes |
@CheckReturnValue public static StatementAttribute lte(String value) { return hiddenVar().lte(value); }
Example #22
Source File: MatchClause.java From graql with GNU Affero General Public License v3.0 | 4 votes |
/** * Construct a get query with all all variables mentioned in the query */ @CheckReturnValue public GraqlGet.Unfiltered get() { return new GraqlGet.Unfiltered(this); }
Example #23
Source File: MatchClause.java From graql with GNU Affero General Public License v3.0 | 4 votes |
@CheckReturnValue public final Set<Variable> getSelectedNames() { return pattern.variables(); }
Example #24
Source File: StatementTypeBuilder.java From graql with GNU Affero General Public License v3.0 | 4 votes |
/** * @param type a resource type that this type variable can be related to * @return this */ @CheckReturnValue default StatementType has(String type) { return has(Graql.type(type)); }
Example #25
Source File: Graql.java From graql with GNU Affero General Public License v3.0 | 4 votes |
@CheckReturnValue public static StatementAttribute lte(LocalDateTime value) { return hiddenVar().lte(value); }
Example #26
Source File: Graql.java From graql with GNU Affero General Public License v3.0 | 4 votes |
@CheckReturnValue public static StatementAttribute eq(boolean value) { return hiddenVar().eq(value); }
Example #27
Source File: Pattern.java From graql with GNU Affero General Public License v3.0 | 4 votes |
@CheckReturnValue Disjunction<Conjunction<Pattern>> getNegationDNF();
Example #28
Source File: Computable.java From graql with GNU Affero General Public License v3.0 | 4 votes |
@CheckReturnValue T to(String toID);
Example #29
Source File: Graql.java From graql with GNU Affero General Public License v3.0 | 4 votes |
/** * @return a new statement with an anonymous Variable */ @CheckReturnValue public static Statement var() { return var(new Variable()); }
Example #30
Source File: Conjunction.java From graql with GNU Affero General Public License v3.0 | 4 votes |
/** * @return the patterns within this conjunction */ @CheckReturnValue public Set<T> getPatterns() { return patterns; }