use of com.google.auto.value.extension.memoized.Memoized in project gerrit by GerritCodeReview.
the class ExternalId method toString.
/**
* Exports this external ID as Git config file text.
*
* <p>The Git config has exactly one externalId subsection with an accountId and optionally email
* and password:
*
* <pre>
* [externalId "username:jdoe"]
* accountId = 1003407
* email = jdoe@example.com
* password = bcrypt:4:LCbmSBDivK/hhGVQMfkDpA==:XcWn0pKYSVU/UJgOvhidkEtmqCp6oKB7
* </pre>
*/
@Override
@Memoized
public String toString() {
Config c = new Config();
writeToConfig(c);
return c.toText();
}
use of com.google.auto.value.extension.memoized.Memoized in project zipkin by openzipkin.
the class ElasticsearchHttpStorage method http.
// hosts resolution might imply a network call, and we might make a new okhttp instance
@Memoized
HttpCall.Factory http() {
List<String> hosts = hostsSupplier().get();
if (hosts.isEmpty())
throw new IllegalArgumentException("no hosts configured");
OkHttpClient ok = hosts.size() == 1 ? client() : client().newBuilder().dns(PseudoAddressRecordSet.create(hosts, client().dns())).build();
ok.dispatcher().setMaxRequests(maxRequests());
ok.dispatcher().setMaxRequestsPerHost(maxRequests());
return new HttpCall.Factory(ok, HttpUrl.parse(hosts.get(0)));
}
use of com.google.auto.value.extension.memoized.Memoized in project grakn by graknlabs.
the class RelationshipAtom method getRoleVarMap.
/**
* @return map containing roleType - (rolePlayer var - rolePlayer type) pairs
*/
@Memoized
public Multimap<Role, Var> getRoleVarMap() {
ImmutableMultimap.Builder<Role, Var> builder = ImmutableMultimap.builder();
GraknTx graph = getParentQuery().tx();
getRelationPlayers().forEach(c -> {
Var varName = c.getRolePlayer().var();
VarPatternAdmin rolePattern = c.getRole().orElse(null);
if (rolePattern != null) {
// try directly
Label typeLabel = rolePattern.getTypeLabel().orElse(null);
Role role = typeLabel != null ? graph.getRole(typeLabel.getValue()) : null;
// try indirectly
if (role == null && rolePattern.var().isUserDefinedName()) {
IdPredicate rolePredicate = getIdPredicate(rolePattern.var());
if (rolePredicate != null) {
Role r = graph.getConcept(rolePredicate.getPredicate());
if (r == null)
throw GraqlQueryException.idNotFound(rolePredicate.getPredicate());
role = r;
}
}
if (role != null)
builder.put(role, varName);
}
});
return builder.build();
}
Aggregations