本文整理了Java中com.linecorp.centraldogma.internal.Util.unsafeCast()
方法的一些代码示例,展示了Util.unsafeCast()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.unsafeCast()
方法的具体详情如下:
包路径:com.linecorp.centraldogma.internal.Util
类名称:Util
方法名:unsafeCast
[英]Casts an object unsafely. Used when you want to suppress the unchecked type warnings.
[中]不安全地投射对象。要抑制未选中的类型警告时使用。
代码示例来源:origin: line/centraldogma
protected final <T extends SessionManager> T delegate() {
return Util.unsafeCast(delegate);
}
代码示例来源:origin: line/centraldogma
protected final <T extends CommandExecutor> T delegate() {
return Util.unsafeCast(delegate);
}
代码示例来源:origin: com.linecorp.centraldogma/centraldogma-server
/**
* Returns a raw session instance which is casted to {@code T} type.
*
* @throws NullPointerException if the {@code rawSession} is {@code null}
* @throws ClassCastException if the {@code rawSession} cannot be casted to {@code T}
*/
<T> T castRawSession() {
return Util.unsafeCast(requireNonNull(rawSession, "rawSession"));
}
代码示例来源:origin: line/centraldogma
/**
* Returns a raw session instance which is casted to {@code T} type.
*
* @throws NullPointerException if the {@code rawSession} is {@code null}
* @throws ClassCastException if the {@code rawSession} cannot be casted to {@code T}
*/
<T> T castRawSession() {
return Util.unsafeCast(requireNonNull(rawSession, "rawSession"));
}
代码示例来源:origin: com.linecorp.centraldogma/centraldogma-client
/**
* Creates a new instance.
*/
public <U> FileWatcher(CentralDogma client, ScheduledExecutorService executor,
String projectName, String repositoryName,
Query<U> query, Function<? super U, ? extends T> function) {
super(client, executor, projectName, repositoryName, requireNonNull(query, "query").path());
this.query = unsafeCast(query);
this.function = unsafeCast(requireNonNull(function, "function"));
}
代码示例来源:origin: line/centraldogma
/**
* Creates a new instance.
*/
public <U> FileWatcher(CentralDogma client, ScheduledExecutorService executor,
String projectName, String repositoryName,
Query<U> query, Function<? super U, ? extends T> function) {
super(client, executor, projectName, repositoryName, requireNonNull(query, "query").path());
this.query = unsafeCast(query);
this.function = unsafeCast(requireNonNull(function, "function"));
}
代码示例来源:origin: com.linecorp.centraldogma/centraldogma-client-shaded
/**
* Creates a new instance.
*/
public <U> FileWatcher(CentralDogma client, ScheduledExecutorService executor,
String projectName, String repositoryName,
Query<U> query, Function<? super U, ? extends T> function) {
super(client, executor, projectName, repositoryName, requireNonNull(query, "query").path());
this.query = unsafeCast(query);
this.function = unsafeCast(requireNonNull(function, "function"));
}
代码示例来源:origin: com.linecorp.centraldogma/centraldogma-server-shaded
CacheableQueryCall(Repository repo, Revision revision, Query<?> query) {
super(repo);
this.revision = requireNonNull(revision, "revision");
this.query = unsafeCast(requireNonNull(query, "query"));
hashCode = Objects.hash(revision, query) * 31 + System.identityHashCode(repo);
assert !revision.isRelative();
}
代码示例来源:origin: com.linecorp.centraldogma/centraldogma-server
static <T> CompletableFuture<Entry<T>> watch(Repository repo, Revision lastKnownRev, Query<T> query) {
requireNonNull(repo, "repo");
requireNonNull(lastKnownRev, "lastKnownRev");
requireNonNull(query, "query");
final Query<Object> castQuery = unsafeCast(query);
final CompletableFuture<Entry<Object>> parentFuture = new CompletableFuture<>();
repo.getOrNull(lastKnownRev, castQuery)
.thenAccept(oldResult -> watch(repo, castQuery, lastKnownRev, oldResult, parentFuture))
.exceptionally(voidFunction(parentFuture::completeExceptionally));
return unsafeCast(parentFuture);
}
代码示例来源:origin: line/centraldogma
static <T> CompletableFuture<Entry<T>> watch(Repository repo, Revision lastKnownRev, Query<T> query) {
requireNonNull(repo, "repo");
requireNonNull(lastKnownRev, "lastKnownRev");
requireNonNull(query, "query");
final Query<Object> castQuery = unsafeCast(query);
final CompletableFuture<Entry<Object>> parentFuture = new CompletableFuture<>();
repo.getOrNull(lastKnownRev, castQuery)
.thenAccept(oldResult -> watch(repo, castQuery, lastKnownRev, oldResult, parentFuture))
.exceptionally(voidFunction(parentFuture::completeExceptionally));
return unsafeCast(parentFuture);
}
代码示例来源:origin: com.linecorp.centraldogma/centraldogma-server-shaded
static <T> CompletableFuture<Entry<T>> watch(Repository repo, Revision lastKnownRev, Query<T> query) {
requireNonNull(repo, "repo");
requireNonNull(lastKnownRev, "lastKnownRev");
requireNonNull(query, "query");
final Query<Object> castQuery = unsafeCast(query);
final CompletableFuture<Entry<Object>> parentFuture = new CompletableFuture<>();
repo.getOrNull(lastKnownRev, castQuery)
.thenAccept(oldResult -> watch(repo, castQuery, lastKnownRev, oldResult, parentFuture))
.exceptionally(voidFunction(parentFuture::completeExceptionally));
return unsafeCast(parentFuture);
}
代码示例来源:origin: com.linecorp.centraldogma/centraldogma-server-shaded
@Override
public CompletableFuture<Map<String, Entry<?>>> find(Revision revision, String pathPattern,
Map<FindOption<?>, ?> options) {
requireNonNull(revision, "revision");
requireNonNull(pathPattern, "pathPattern");
requireNonNull(options, "options");
final CompletableFuture<Object> future = normalizeAndCompose(
revision,
rev -> cache.get(new CacheableFindCall(repo, rev, pathPattern, options)));
return unsafeCast(future);
}
代码示例来源:origin: com.linecorp.centraldogma/centraldogma-server-shaded
@Override
public <T> CompletableFuture<Entry<T>> getOrNull(Revision revision, Query<T> query) {
requireNonNull(revision, "revision");
requireNonNull(query, "query");
final CompletableFuture<Object> future = normalizeAndCompose(
revision,
rev -> cache.get(new CacheableQueryCall(repo, rev, query))
.thenApply(result -> result != CacheableQueryCall.EMPTY ? result : null));
return unsafeCast(future);
}
代码示例来源:origin: com.linecorp.centraldogma/centraldogma-server
@Override
public CompletableFuture<Map<String, Entry<?>>> find(Revision revision, String pathPattern,
Map<FindOption<?>, ?> options) {
requireNonNull(revision, "revision");
requireNonNull(pathPattern, "pathPattern");
requireNonNull(options, "options");
final Revision normalizedRevision;
try {
normalizedRevision = normalizeNow(revision);
} catch (Exception e) {
return CompletableFutures.exceptionallyCompletedFuture(e);
}
return unsafeCast(cache.get(new CacheableFindCall(repo, normalizedRevision, pathPattern, options)));
}
代码示例来源:origin: line/centraldogma
@Override
public CompletableFuture<Map<String, Change<?>>> diff(Revision from, Revision to, String pathPattern) {
requireNonNull(from, "from");
requireNonNull(to, "to");
requireNonNull(pathPattern, "pathPattern");
final RevisionRange range;
try {
range = normalizeNow(from, to).toAscending();
} catch (Exception e) {
return CompletableFutures.exceptionallyCompletedFuture(e);
}
return unsafeCast(cache.get(new CacheableMultiDiffCall(repo, range.from(), range.to(), pathPattern)));
}
代码示例来源:origin: com.linecorp.centraldogma/centraldogma-server
@Override
public CompletableFuture<Change<?>> diff(Revision from, Revision to, Query<?> query) {
requireNonNull(from, "from");
requireNonNull(to, "to");
requireNonNull(query, "query");
final RevisionRange range;
try {
range = normalizeNow(from, to).toAscending();
} catch (Exception e) {
return CompletableFutures.exceptionallyCompletedFuture(e);
}
return unsafeCast(cache.get(new CacheableSingleDiffCall(repo, range.from(), range.to(), query)));
}
代码示例来源:origin: line/centraldogma
@Override
public CompletableFuture<Change<?>> diff(Revision from, Revision to, Query<?> query) {
requireNonNull(from, "from");
requireNonNull(to, "to");
requireNonNull(query, "query");
final RevisionRange range;
try {
range = normalizeNow(from, to).toAscending();
} catch (Exception e) {
return CompletableFutures.exceptionallyCompletedFuture(e);
}
return unsafeCast(cache.get(new CacheableSingleDiffCall(repo, range.from(), range.to(), query)));
}
代码示例来源:origin: com.linecorp.centraldogma/centraldogma-server
@Override
public CompletableFuture<Map<String, Change<?>>> diff(Revision from, Revision to, String pathPattern) {
requireNonNull(from, "from");
requireNonNull(to, "to");
requireNonNull(pathPattern, "pathPattern");
final RevisionRange range;
try {
range = normalizeNow(from, to).toAscending();
} catch (Exception e) {
return CompletableFutures.exceptionallyCompletedFuture(e);
}
return unsafeCast(cache.get(new CacheableMultiDiffCall(repo, range.from(), range.to(), pathPattern)));
}
代码示例来源:origin: com.linecorp.centraldogma/centraldogma-server-shaded
@Override
public CompletableFuture<Change<?>> diff(Revision from, Revision to, Query<?> query) {
requireNonNull(from, "from");
requireNonNull(to, "to");
requireNonNull(query, "query");
final RevisionRange range;
try {
range = normalizeNow(from, to).toAscending();
} catch (Exception e) {
return CompletableFutures.exceptionallyCompletedFuture(e);
}
return unsafeCast(cache.get(new CacheableSingleDiffCall(repo, range.from(), range.to(), query)));
}
代码示例来源:origin: com.linecorp.centraldogma/centraldogma-server-shaded
@Override
public CompletableFuture<Map<String, Change<?>>> diff(Revision from, Revision to, String pathPattern) {
requireNonNull(from, "from");
requireNonNull(to, "to");
requireNonNull(pathPattern, "pathPattern");
final RevisionRange range;
try {
range = normalizeNow(from, to).toAscending();
} catch (Exception e) {
return CompletableFutures.exceptionallyCompletedFuture(e);
}
return unsafeCast(cache.get(new CacheableMultiDiffCall(repo, range.from(), range.to(), pathPattern)));
}
内容来源于网络,如有侵权,请联系作者删除!