public final DataStore<V> set( String key, V value ) throws IOException { Preconditions.checkNotNull( key ); Preconditions.checkNotNull( value ); this.lock.lock(); try { this.keyValueMap.put( key, IOUtils.serialize( value ) ); this.save(); } finally { this.lock.unlock(); } return this; }
public ModifyAckDeadline(String ackId, long seconds) { Preconditions.checkNotNull(ackId); this.ackId = ackId; this.seconds = seconds; }
@Override public ReservedWorker handle(GetReservedWorker workerRequest) { String id = workerRequest.getId(); UUID jobId = decodeJobId(id); PortabilityJob job = jobStore.findJob(jobId); Preconditions.checkNotNull( job, "Couldn't lookup worker for job " + id + " because the job doesn't exist"); if (job.jobAuthorization().state() != CREDS_ENCRYPTION_KEY_GENERATED) { monitor.debug( () -> format("Job %s has not entered state CREDS_ENCRYPTION_KEY_GENERATED yet", jobId)); return new ReservedWorker(null); } monitor.debug( () -> format( "Got job %s in state CREDS_ENCRYPTION_KEY_GENERATED, returning its public key", jobId)); return new ReservedWorker(job.jobAuthorization().authPublicKey()); } }
/** * Sets the notification channel UUID provided by the client in the watch request. * * <p> * Overriding is only supported for the purpose of calling the super implementation and changing * the return type, but nothing else. * </p> */ public AbstractNotification setChannelId(String channelId) { this.channelId = Preconditions.checkNotNull(channelId); return this; }
/** * Returns an instance of a new builder. * * @param transport HTTP transport * @param jsonFactory JSON factory */ public Builder(HttpTransport transport, JsonFactory jsonFactory) { this.transport = Preconditions.checkNotNull(transport); this.jsonFactory = Preconditions.checkNotNull(jsonFactory); }
/** * @param namespaceDictionary XML namespace dictionary * @param parser XML pull parser to use * @param inputStream input stream to read * @param feedClass feed class to parse * @since 1.5 */ public AtomFeedParser(XmlNamespaceDictionary namespaceDictionary, XmlPullParser parser, InputStream inputStream, Class<T> feedClass, Class<E> entryClass) { super(namespaceDictionary, parser, inputStream, feedClass); this.entryClass = Preconditions.checkNotNull(entryClass); }
/** * @param accountManager account manager */ public GoogleAccountManager(AccountManager accountManager) { this.manager = Preconditions.checkNotNull(accountManager); }
/** * Creates an XmlObjectParser using the specified non-null namespace dictionary. * * @param namespaceDictionary XML namespace dictionary */ public XmlObjectParser(XmlNamespaceDictionary namespaceDictionary) { this.namespaceDictionary = Preconditions.checkNotNull(namespaceDictionary); }
/** * Sets the access token issued by the authorization server. * * <p> * Overriding is only supported for the purpose of calling the super implementation and changing * the return type, but nothing else. * </p> */ public OneDriveTokenResponse setAccessToken(String accessToken) { this.accessToken = Preconditions.checkNotNull(accessToken); return this; }
/** * Sets the opaque ID for the watched resource that is stable across API versions. * * <p> * Overriding is only supported for the purpose of calling the super implementation and changing * the return type, but nothing else. * </p> */ public AbstractNotification setResourceId(String resourceId) { this.resourceId = Preconditions.checkNotNull(resourceId); return this; }
/** * Sets the sleeper. The default value is {@link Sleeper#DEFAULT}. * * @since 1.15 */ public BatchRequest setSleeper(Sleeper sleeper) { this.sleeper = Preconditions.checkNotNull(sleeper); return this; }
@Override public GoogleAuthorizationCodeRequestUrl setRedirectUri(String redirectUri) { Preconditions.checkNotNull(redirectUri); return (GoogleAuthorizationCodeRequestUrl) super.setRedirectUri(redirectUri); }
@Override public GoogleAuthorizationCodeTokenRequest setRedirectUri(String redirectUri) { Preconditions.checkNotNull(redirectUri); return (GoogleAuthorizationCodeTokenRequest) super.setRedirectUri(redirectUri); }
@Override public Builder setTransport(HttpTransport transport) { return (Builder) super.setTransport(Preconditions.checkNotNull(transport)); }
@Override public Builder setTokenServerUrl(GenericUrl tokenServerUrl) { return (Builder) super.setTokenServerUrl(Preconditions.checkNotNull(tokenServerUrl)); }
@Override public JsonParser createJsonParser(InputStream in, Charset charset) throws IOException { Preconditions.checkNotNull(in); return new JacksonParser(this, factory.createJsonParser(in)); }
@Override public JsonParser createJsonParser(String value) throws IOException { Preconditions.checkNotNull(value); return new JacksonParser(this, factory.createJsonParser(value)); }
@Override public JsonParser createJsonParser(Reader reader) throws IOException { Preconditions.checkNotNull(reader); return new JacksonParser(this, factory.createJsonParser(reader)); }
/** * Constructs a new instance from {@link MediaHttpUploader} and {@link HttpRequest}. */ public MediaUploadErrorHandler(MediaHttpUploader uploader, HttpRequest request) { this.uploader = Preconditions.checkNotNull(uploader); originalIOExceptionHandler = request.getIOExceptionHandler(); originalUnsuccessfulHandler = request.getUnsuccessfulResponseHandler(); request.setIOExceptionHandler(this); request.setUnsuccessfulResponseHandler(this); }
private static Link toLinkProto(io.opencensus.trace.Link link) { checkNotNull(link); return Link.newBuilder() .setTraceId(link.getTraceId().toLowerBase16()) .setSpanId(link.getSpanId().toLowerBase16()) .setType(toLinkTypeProto(link.getType())) .setAttributes(toAttributesBuilderProto(link.getAttributes(), 0)) .build(); }