code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
public com.google.api.ads.admanager.axis.v201805.CustomFieldVisibility getVisibility() {
return visibility;
} | java |
public void setProductTemplateMarketplaceInfo(com.google.api.ads.admanager.axis.v201808.ProductTemplateMarketplaceInfo productTemplateMarketplaceInfo) {
this.productTemplateMarketplaceInfo = productTemplateMarketplaceInfo;
} | java |
@SuppressWarnings("unchecked") /* See constructor comments. */
public void setAuthorization(Object soapClient, AdsSession adsSession)
throws AuthenticationException {
final String authorizationHeader =
authorizationHeaderProvider.getAuthorizationHeader(adsSession,
soapClientHandler.getEn... | java |
public com.google.api.ads.adwords.axis.v201809.cm.TrialAsyncError[] getEntries() {
return entries;
} | java |
public com.google.api.ads.adwords.axis.v201809.cm.AppUrlOsType getOsType() {
return osType;
} | java |
public com.google.api.ads.admanager.axis.v201808.CreativeAsset getFallbackImageAsset() {
return fallbackImageAsset;
} | java |
public void setFallbackImageAsset(com.google.api.ads.admanager.axis.v201808.CreativeAsset fallbackImageAsset) {
this.fallbackImageAsset = fallbackImageAsset;
} | java |
public com.google.api.ads.adwords.axis.v201809.cm.FeedStatus getFeedStatus() {
return feedStatus;
} | java |
public com.google.api.ads.adwords.axis.v201809.cm.AdCustomizerFeedAttribute[] getFeedAttributes() {
return feedAttributes;
} | java |
public com.google.api.ads.adwords.axis.v201809.rm.RuleBasedUserListPrepopulationStatus getPrepopulationStatus() {
return prepopulationStatus;
} | java |
public void buyNumber(String country, String msisdn) throws IOException, NexmoClientException {
this.buyNumber.execute(new BuyNumberRequest(country, msisdn));
} | java |
public void cancelNumber(String country, String msisdn) throws IOException, NexmoClientException {
this.cancelNumber.execute(new CancelNumberRequest(country, msisdn));
} | java |
public void linkNumber(String msisdn, String country, String appId) throws IOException, NexmoClientException {
UpdateNumberRequest request = new UpdateNumberRequest(msisdn, country);
request.setVoiceCallbackType(UpdateNumberRequest.CallbackType.APP);
request.setVoiceCallbackValue(appId);
... | java |
public Document parseXml(String xml) throws NexmoResponseParseException {
// TODO: Maybe an Error subclass for XML initialization errors, as these are serious and unexpected.
Document doc;
this.documentBuilderLock.lock();
try {
if (this.documentBuilder == null) {
... | java |
public static AdvancedInsightRequest withNumberAndCountry(String number, String country) {
return new Builder(number).country(country).build();
} | java |
public DtmfResponse sendDtmf(String uuid, String digits) throws IOException, NexmoClientException {
return dtmf.put(uuid, digits);
} | java |
public ModifyCallResponse transferCall(String uuid, String nccoUrl) throws IOException, NexmoClientException {
return this.modifyCall(CallModifier.transferCall(uuid, nccoUrl));
} | java |
public StreamResponse startStream(String uuid, String streamUrl, int loop) throws IOException, NexmoClientException {
return streams.put(new StreamRequest(uuid, streamUrl, loop));
} | java |
public static String calculateMd5(String input) throws NoSuchAlgorithmException {
try {
return calculateMd5(input, "UTF-8");
} catch (UnsupportedEncodingException e) {
return null; // -- impossible --
}
} | java |
public static String calculateMd5(String input, String encoding) throws NoSuchAlgorithmException, UnsupportedEncodingException {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(input.getBytes(encoding));
byte digest[] = md.digest();
final StringBuilder hexString = new Str... | java |
public void submitConversion(ConversionRequest.Type type,
String messageId,
boolean delivered,
Date timestamp) throws IOException, NexmoClientException {
this.conversionEndpoint.submitConversion(new ConversionRequ... | java |
public SearchSmsResponse searchMessages(String id, String... ids) throws IOException, NexmoClientException {
List<String> idList = new ArrayList<>(ids.length + 1);
idList.add(id);
idList.addAll(Arrays.asList(ids));
return this.searchMessages(new SmsIdSearchRequest(idList));
} | java |
public SearchSmsResponse searchMessages(Date date, String to) throws IOException, NexmoClientException {
return this.searchMessages(new SmsDateSearchRequest(date, to));
} | java |
public SearchRejectedMessagesResponse searchRejectedMessages(Date date, String to) throws IOException, NexmoClientException {
return this.searchRejectedMessages(new SearchRejectedMessagesRequest(date, to));
} | java |
public PrefixPricingResponse getPrefixPrice(ServiceType type, String prefix) throws IOException, NexmoClientException {
return getPrefixPrice(new PrefixPricingRequest(type, prefix));
} | java |
public SecretResponse getSecret(String apiKey, String secretId) throws IOException, NexmoClientException {
return getSecret(new SecretRequest(apiKey, secretId));
} | java |
public SecretResponse createSecret(String apiKey, String secret) throws IOException, NexmoClientException {
return createSecret(new CreateSecretRequest(apiKey, secret));
} | java |
public void revokeSecret(String apiKey, String secretId) throws IOException, NexmoClientException {
revokeSecret(new SecretRequest(apiKey, secretId));
} | java |
public static StandardInsightRequest withNumberAndCountry(String number, String country) {
return new Builder(number).country(country).build();
} | java |
public String generateJwt() throws NexmoUnacceptableAuthException {
JWTAuthMethod authMethod = this.httpWrapper.getAuthCollection().getAuth(JWTAuthMethod.class);
return authMethod.constructToken(System.currentTimeMillis() / 1000L, JWTAuthMethod.constructJTI());
} | java |
public static BasicInsightRequest withNumberAndCountry(String number, String country) {
return new Builder(number).country(country).build();
} | java |
public <T extends AuthMethod> T getAuth(Class<T> type) throws NexmoUnacceptableAuthException {
for (AuthMethod availableAuthMethod : this.authList) {
if (type.isInstance(availableAuthMethod)) {
return (T) availableAuthMethod;
}
}
throw new NexmoUnacceptabl... | java |
public static String bytesToHex(byte[] bytes, String separator) {
StringBuilder tmpBuffer = new StringBuilder();
if (bytes != null) {
for (byte c : bytes) {
int b = c;
if (b < 0)
b += 256;
if (separator != null)
... | java |
public static byte[] hexToBytes(String str) {
if (str == null)
return null;
byte[] hexChars;
try {
hexChars = str.toUpperCase().getBytes("ISO_8859-1");
} catch (UnsupportedEncodingException e) {
throw new NexmoUnexpectedException("ISO_8859_1 is an unsu... | java |
public BasicInsightResponse getBasicNumberInsight(String number) throws IOException, NexmoClientException {
return getBasicNumberInsight(BasicInsightRequest.withNumber(number));
} | java |
public BasicInsightResponse getBasicNumberInsight(String number, String country) throws IOException, NexmoClientException {
return getBasicNumberInsight(BasicInsightRequest.withNumberAndCountry(number, country));
} | java |
public StandardInsightResponse getStandardNumberInsight(String number) throws IOException, NexmoClientException {
return getStandardNumberInsight(StandardInsightRequest.withNumber(number));
} | java |
public StandardInsightResponse getStandardNumberInsight(String number, String country) throws IOException, NexmoClientException {
return getStandardNumberInsight(StandardInsightRequest.withNumberAndCountry(number, country));
} | java |
@Deprecated
public StandardInsightResponse getStandardNumberInsight(String number, String country, boolean cnam) throws IOException, NexmoClientException {
return getStandardNumberInsight(StandardInsightRequest.builder(number).country(country).cnam(cnam).build());
} | java |
public AdvancedInsightResponse getAdvancedNumberInsight(String number) throws IOException, NexmoClientException {
return getAdvancedNumberInsight(AdvancedInsightRequest.withNumber(number));
} | java |
public AdvancedInsightResponse getAdvancedNumberInsight(String number, String country) throws IOException, NexmoClientException {
return getAdvancedNumberInsight(AdvancedInsightRequest.withNumberAndCountry(number, country));
} | java |
@Deprecated
public AdvancedInsightResponse getAdvancedNumberInsight(String number, String country, String ipAddress) throws IOException, NexmoClientException {
return getAdvancedNumberInsight(AdvancedInsightRequest.builder(number)
.country(country)
.ipAddress(ipAddress)
... | java |
public ResultT execute(RequestT request) throws IOException, NexmoClientException {
try {
RequestBuilder requestBuilder = applyAuth(makeRequest(request));
HttpUriRequest httpRequest = requestBuilder.build();
// If we have a URL Encoded form entity, we may need to regenerate ... | java |
public VerifyResponse verify(final String number,
final String brand,
final String from,
final int length,
final Locale locale) throws IOException, NexmoClientException {
return this.verif... | java |
public ControlResponse advanceVerification(String requestId) throws IOException, NexmoClientException {
return this.control.execute(new ControlRequest(requestId, VerifyControlCommand.TRIGGER_NEXT_EVENT));
} | java |
public ControlResponse cancelVerification(String requestId) throws IOException, NexmoClientException {
return this.control.execute(new ControlRequest(requestId, VerifyControlCommand.CANCEL));
} | java |
public static void parseWikipediaDump(URL dumpFile,
PageCallbackHandler handler) throws Exception {
WikiXMLParser wxsp = WikiXMLParserFactory.getSAXParser(dumpFile);
wxsp.setPageCallback(handler);
wxsp.parse();
} | java |
private JMethod getMethodsMap(MethodType type, JFieldVar field, ClassOutline co) {
String getterBody = "return " + field.name() + ";";
for (JMethod method : co.implClass.methods()) {
String name = method.name();
if (method.type().isPrimitive()) {
if (MethodType.GE... | java |
private ExecJavaCliParser createExecCommandParser(String containerWorkDir) {
String execLine =
this.filterAndExecuteLaunchScriptAndReturnExecLine(containerWorkDir);
String[] values = execLine.split("\"");
String javaCli = values[1];
String[] javaCliValues = javaCli.split(... | java |
private String filterAndExecuteLaunchScriptAndReturnExecLine(String containerWorkDir) {
BufferedReader reader = null;
BufferedWriter writer = null;
String execLine = null;
File inJvmlaunchScript = null;
try {
File launchScript = new File(containerWorkDir, "launch_cont... | java |
private void cleanUp() {
try {
File file = new File(System.getProperty("user.dir"));
String[] links = file.list();
for (String name : links) {
File potentialSymLink = new File(file, name);
if (FileUtils.isSymlink(potentialSymLink)) {
... | java |
@Override
public Map<String, Integer> getGatewayPortMappings() {
final Map<String, Integer> result = new ConcurrentHashMap<String, Integer>();
final Map<String, String> properties = getValByRegex(GATEWAY_PORT_MAPPING_REGEX);
// Convert port no. from string to int
for(final Map.Entr... | java |
public static void put(String key, String value) throws Exception {
Map<String, String> environemnt = new HashMap<String, String>(System.getenv());
environemnt.put(key, value);
updateEnvironment(environemnt);
} | java |
public void createShareLib() {
if (!oozieShareLibCreate) {
LOG.info("OOZIE: Share Lib Create Disabled... skipping");
} else {
final String fullOozieTarFilePath = shareLibCacheDir + Path.SEPARATOR + getOozieTarFileName();
try {
// Get and extract th... | java |
public PageRevision getMostRecentRevision(String... titles) throws Exception {
URL url = new URL(entryPoint +
"/w/api.php?format=json&action=query&prop=revisions&rvprop=user|timestamp&titles=" +
encode(Joiner.on("|").join(titles), "UTF-8")
);
String response = r... | java |
public StubWithCondition match(String label, Condition... conditions) {
StubWithCondition swc = new StubWithCondition(stubServer, Condition.composite(conditions));
swc.stub.withLabel(label);
return swc;
} | java |
public boolean isApplicable(Call call) {
return when.getPredicate().test(call) && (actionSequence.size() == 0 || exceededAction != null || actionSequence.size() > appliedTimes);
} | java |
public Response apply(Response response) {
if (when instanceof ConditionWithApplicables) {
for (Applicable applicable : ((ConditionWithApplicables) when).getApplicables()) {
response = applicable.apply(response);
}
}
Applicable chosenAction;
if (... | java |
public StubWithAction then(Applicable... actions) {
Stub s = this.stub.withAction(composite(actions));
stubServer.addStub(s);
return new StubWithAction(s);
} | java |
public static Action status(final HttpStatus status) {
return new Action(input -> {
input.setStatus(status);
return input;
});
} | java |
public static Action bytesContent(final byte[] content) {
return new Action(response -> {
response.setContentLength(content.length);
try {
response.getOutputStream().write(content);
} catch (IOException e) {
throw new RuntimeException("Can not... | java |
public static Action header(final String key, final String value) {
return new Action(input -> {
input.setHeader(key, value);
return input;
});
} | java |
public static Action contentType(final String contentType) {
return new Action(r -> {
r.setContentType(contentType);
return r;
});
} | java |
public static Action unauthorized(final String realm) {
return new Action(r -> {
r.addHeader("WWW-Authenticate", "Basic realm=\"" + realm + "\"");
r.setStatus(HttpStatus.UNAUTHORIZED_401);
return r;
});
} | java |
public static Action delay(final Integer delay) {
return new Action(input -> {
try {
Thread.sleep(delay);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
return input;
});
} | java |
public StubServer run() {
simpleServer.getServerConfiguration().addHttpHandler(stubsToHandler(), "/");
try {
if (secured) {
for (NetworkListener networkListener : simpleServer.getListeners()) {
networkListener.setSecure(true);
SSLEngine... | java |
private String createCertificateStore(String resourceName) throws IOException {
URL resource = StubServer.class.getResource("/" + resourceName);
File store = File.createTempFile(resourceName, "store");
try (InputStream input = resource.openStream()) {
Files.copy(input, store.toPath()... | java |
public static Condition method(final Method m) {
return new Condition(input -> m.equals(input.getMethod()));
} | java |
private static ConditionWithApplicables methodWithUriAndAutoDiscovery(final Method m, String uri) {
try {
final URL resource = new SmartDiscoverer("restito").discoverResource(m, uri);
return new ConditionWithApplicables(composite(method(m), uri(uri)), resourceContent(resource));
... | java |
public static Condition parameter(final String key, final String... parameterValues) {
return new Condition(input -> Arrays.equals(input.getParameters().get(key), parameterValues));
} | java |
public static Condition endsWithUri(final String uri) {
return new Condition(input -> input.getUri().endsWith(uri));
} | java |
public static Condition withPostBody() {
return new Condition(input -> input.getPostBody() != null && input.getPostBody().length() > 0);
} | java |
public static Condition basicAuth(String username, String password) {
final String authString = username + ":" + password;
final String encodedAuthString = new String(Base64.encodeBase64(authString.getBytes()));
return new Condition(input -> ("Basic " + encodedAuthString).equals(input.getAuthori... | java |
public static Condition withPostBodyContaining(final String str) {
return new Condition(input -> input.getPostBody() != null && input.getPostBody().contains(str));
} | java |
public static Condition withPostBodyContaining(final Pattern pattern) {
return new Condition(input -> input.getPostBody().matches(pattern.pattern()));
} | java |
public <Result> Result submitRequest(TDApiRequest apiRequest, Optional<String> apiKeyCache, TDHttpRequestHandler<Result> handler)
throws TDClientException
{
RequestContext requestContext = new RequestContext(config, apiRequest, apiKeyCache);
try {
return submitRequest(request... | java |
public <Result> Result call(TDApiRequest apiRequest, Optional<String> apiKeyCache, final Function<InputStream, Result> contentStreamHandler)
{
return submitRequest(apiRequest, apiKeyCache, newByteStreamHandler(contentStreamHandler));
} | java |
public <Result> Result call(TDApiRequest apiRequest, Optional<String> apiKeyCache, final Class<Result> resultType)
throws TDClientException
{
return call(apiRequest, apiKeyCache, objectMapper.getTypeFactory().constructType(resultType));
} | java |
@SuppressWarnings(value = "unchecked cast")
public <Result> Result call(TDApiRequest apiRequest, Optional<String> apiKeyCache, final JavaType resultType)
throws TDClientException
{
try {
byte[] content = submitRequest(apiRequest, apiKeyCache, byteArrayContentHandler);
... | java |
public Properties toProperties()
{
Properties p = new Properties();
saveProperty(p, Type.API_ENDPOINT, endpoint);
saveProperty(p, Type.API_PORT, port);
saveProperty(p, Type.USESSL, useSSL);
saveProperty(p, Type.APIKEY, apiKey);
saveProperty(p, Type.USER, user);
... | java |
@Override
public TDClient withApiKey(String newApiKey)
{
return new TDClient(config, httpClient, Optional.of(newApiKey));
} | java |
private static TDClientHttpException clientError(TDClientHttpException e, ResponseContext responseContext)
{
boolean showWarning = true;
boolean showStackTrace = false;
int code = e.getStatusCode();
switch (code) {
case HttpStatus.NOT_FOUND_404:
// Not fou... | java |
@VisibleForTesting
public TDSaveQueryRequest merge(TDSavedQuery base)
{
return new TDSaveQueryRequest(
name.or(base.getName()),
cron.or(base.getCron()),
type.or(base.getType()),
query.or(base.getQuery()),
timezone.or(base.ge... | java |
public String getCmdOut()
{
return debug.transform(new Function<Debug, String>()
{
@Override
public String apply(Debug input)
{
return input.getCmdout();
}
}).or("");
} | java |
public String getStdErr()
{
return debug.transform(new Function<Debug, String>()
{
@Override
public String apply(Debug input)
{
return input.getStderr();
}
}).or("");
} | java |
public TDClientConfig buildConfig()
{
return new TDClientConfig(
endpoint,
port,
useSSL,
apiKey,
user,
password,
proxy,
retryLimit,
retryInitialIntervalMillis,
... | java |
public static String[] fastSplitKey(String key) {
int i = key.indexOf(':');
if(-1 == i) {
return new String[]{key};
}
else {
int j = key.indexOf(':', i+1);
if (-1 != j) {
return null;
}
else {
return new String[]{key.substring(0, i), key.substring(i+1)};
... | java |
protected Kryo newKryoWithEx() throws InstantiationException, IllegalAccessException {
Kryo k = kryoClass.newInstance();
k.setInstantiatorStrategy(instStratClass.newInstance());
k.setRegistrationRequired(regRequired);
for(IKryoRegistrar kr: registrations) {
kr.apply(k);
}
for(IKryoRegistra... | java |
public KryoInstantiator setClassLoader(final ClassLoader cl) {
return new KryoInstantiator() {
public Kryo newKryo() {
Kryo k = KryoInstantiator.this.newKryo();
k.setClassLoader(cl);
return k;
}
};
} | java |
public KryoInstantiator setReferences(final boolean ref) {
return new KryoInstantiator() {
public Kryo newKryo() {
Kryo k = KryoInstantiator.this.newKryo();
/**
* Kryo 2.17, used in storm, has this method returning void,
* 2.21 has it returning boolean.
* Try not to ... | java |
@Override
public String get(String key) {
Object value = conf.get(key);
if(null != value) {
return value.toString();
}
else {
return null;
}
} | java |
public void writeOutputTo(OutputStream os) throws IOException {
os.write(output.getBuffer(), 0, output.position());
} | java |
private static InputStream openResource(final String file) throws IOException {
InputStream stream = HtmlConverterApplication.class.getResourceAsStream("/" + file);
if (stream == null) {
throw new FileNotFoundException(file);
} else {
return stream;
}
} | java |
private static RuntimeDialect resolveDialect() {
if (getJavaVersion() >= MINIMUM_VERSION_MODERN_JAVA) {
return new ModernJavaRuntime();
} else if ("Android Runtime".equalsIgnoreCase(System.getProperty("java.runtime.name"))) {
return new AndroidRuntime();
} else {
return new LegacyJavaRuntime();
}
} | java |
private static int getJavaVersion() {
String version = System.getProperty("java.version");
if (version == null) {
return -1;
} else {
int index = version.indexOf('.');
if (index > 0) {
version = version.substring(0, index);
}
try {
return Integer.parseInt(version);
} catch (NumberFormat... | java |
private static String stripAnonymousPart(final String className) {
for (int index = className.indexOf("$", 0); index != -1; index = className.indexOf('$', index + 2)) {
/* Trailing dollar sign */
if (index >= className.length() - 1) {
return className.substring(0, index);
}
char firstLetter = classNa... | java |
private static StackTraceElement normalizeClassName(final StackTraceElement element) {
String className = element.getClassName();
int dollarIndex = className.indexOf("$");
if (dollarIndex == -1) {
return element;
} else {
className = stripAnonymousPart(className);
return new StackTraceElement(className... | java |
protected String renderTag(final LogEntry logEntry) {
StringBuilder builder = reuseOrCreate(tagBuilder, TAG_MAX_LENGTH);
tagToken.render(logEntry, builder);
if (builder.length() > TAG_MAX_LENGTH) {
return builder.substring(0, TAG_MAX_LENGTH - ELLIPSIS.length()) + ELLIPSIS;
} else {
return builder.toStrin... | java |
protected String renderMessage(final LogEntry logEntry) {
StringBuilder builder = reuseOrCreate(messageBuilder, MESSAGE_BUILDER_CAPACITY);
messageToken.render(logEntry, builder);
return builder.toString();
} | java |
private static boolean isCoveredByMinimumLevel(final String tag, final Level level) {
return provider.getMinimumLevel(tag).ordinal() <= level.ordinal();
} | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.