javax.annotation.Nonnegative#javax.annotation.CheckReturnValue源码实例Demo

下面列出了javax.annotation.Nonnegative#javax.annotation.CheckReturnValue 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: grpc-nebula-java   文件: DeadlineSubject.java
/**
 * 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)));
      }
    }
  };
}
 
源代码2 项目: grpc-nebula-java   文件: KeepAliveEnforcer.java
/** 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;
  }
}
 
源代码3 项目: grpc-nebula-java   文件: NettyServerBuilder.java
@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);
}
 
源代码4 项目: graql   文件: Graql.java
/**
 * @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));
}
 
源代码5 项目: graql   文件: Computable.java
@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);
}
 
源代码6 项目: graql   文件: GraqlCompute.java
@CheckReturnValue
public Graql.Token.Compute.Algorithm using() {
    if (algorithm == null) {
        return Graql.Token.Compute.Algorithm.DEGREE;
    } else {
        return algorithm;
    }
}
 
源代码7 项目: graql   文件: Computable.java
@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);
}
 
源代码8 项目: graql   文件: StatementTypeBuilder.java
/**
 * @param type a concept type that this variable must be a kind of
 * @return this
 */
@CheckReturnValue
default StatementType sub(Statement type) {
    return sub(new SubProperty(type));
}
 
源代码9 项目: graql   文件: Computable.java
@CheckReturnValue
Optional<GraqlException> getException();
 
源代码10 项目: graql   文件: Graql.java
@CheckReturnValue
public static GraqlCompute.Builder compute() {
    return new GraqlCompute.Builder();
}
 
源代码11 项目: graql   文件: StatementAttributeBuilder.java
@CheckReturnValue   // TODO: will be made "private" once we upgrade to Java 9 or higher
StatementAttribute attribute(VarProperty property);
 
源代码12 项目: graql   文件: Graql.java
@CheckReturnValue
public static StatementAttribute neq(long value) {
    return hiddenVar().neq(value);
}
 
源代码13 项目: graql   文件: Graql.java
@CheckReturnValue
public static StatementAttribute eq(Statement variable) {
    return hiddenVar().eq(variable);
}
 
源代码14 项目: graql   文件: Computable.java
@CheckReturnValue
V where();
 
源代码15 项目: graql   文件: Computable.java
@CheckReturnValue
Set<String> in();
 
源代码16 项目: graql   文件: Graql.java
/**
 * @param statements a collection of variable patterns to insert into the graph
 * @return an insert query that will insert the given variable patterns into the graph
 */
@CheckReturnValue
public static GraqlInsert insert(Collection<? extends Statement> statements) {
    return new GraqlInsert(null, Collections.unmodifiableList(new ArrayList<>(statements)));
}
 
源代码17 项目: graql   文件: Graql.java
/**
 * @param patterns a collection of patterns to match in the graph
 * @return a match clause that will find matches of the given patterns
 */
@CheckReturnValue
public static MatchClause match(Collection<? extends Pattern> patterns) {
    return new MatchClause(and(Collections.unmodifiableSet(new LinkedHashSet<>(patterns))));
}
 
源代码18 项目: graql   文件: StatementAttributeBuilder.java
@CheckReturnValue
default StatementAttribute gt(double value) {
    return gt(Comparison.Number::new, value);
}
 
源代码19 项目: graql   文件: Graql.java
@CheckReturnValue
public static <T extends Pattern> Disjunction<T> or(Set<T> patterns) {
    return new Disjunction<>(patterns);
}
 
源代码20 项目: graql   文件: Graql.java
/**
 * @param patterns an array of patterns to match in the graph
 * @return a match clause that will find matches of the given patterns
 */
@CheckReturnValue
public static MatchClause match(Pattern... patterns) {
    return match(Arrays.asList(patterns));
}
 
源代码21 项目: graql   文件: StatementAttributeBuilder.java
@CheckReturnValue
default StatementAttribute eq(long value) {
    return eq(Comparison.Number::new, value);
}
 
源代码22 项目: graql   文件: StatementTypeBuilder.java
/**
 * @param type a concept type id that this variable must be a kind of
 * @return this
 */
@CheckReturnValue
default StatementType sub(String type) {
    return sub(Graql.type(type));
}
 
源代码23 项目: graql   文件: Graql.java
/**
 * @param name the name of the variable
 * @return a new statement with a variable of a given name
 */
@CheckReturnValue
public static Statement var(String name) {
    return var(new Variable(name));
}
 
源代码24 项目: graql   文件: Graql.java
@CheckReturnValue
public static Pattern parsePattern(String pattern) {
    return parser.parsePatternEOF(pattern);
}
 
源代码25 项目: graql   文件: StatementTypeBuilder.java
@CheckReturnValue
default StatementType sub(SubProperty property) {
    return type(property);
}
 
源代码26 项目: graql   文件: StatementAttributeBuilder.java
@CheckReturnValue
default StatementAttribute lt(Statement variable) {
    return lt(Comparison.Variable::new, variable);
}
 
源代码27 项目: graql   文件: Computable.java
@CheckReturnValue
T attributes(boolean include);
 
源代码28 项目: graql   文件: Graql.java
@CheckReturnValue
public static StatementAttribute gt(long value) {
    return hiddenVar().gt(value);
}
 
源代码29 项目: graql   文件: StatementAttributeBuilder.java
@CheckReturnValue
default StatementAttribute neq(String value) {
    return neq(Comparison.String::new, value);
}
 
源代码30 项目: graql   文件: StatementAttributeBuilder.java
@CheckReturnValue
default StatementAttribute neq(LocalDateTime value) {
    return neq(Comparison.DateTime::new, value);
}