private HBaseStatus(File file, String version) { Preconditions.checkNotNull(file); Preconditions.checkNotNull(version); this.file = file; this.version = version; }
Preconditions.checkNotNull(riverName, "No riverName specified"); Preconditions.checkNotNull(riverIndexName, "No riverIndexName specified"); Preconditions.checkNotNull(settings, "No settings specified");
public ClassPathJSONProvider(ClassLoader classLoader, String path) { Preconditions.checkNotNull(classLoader, "No ClassLoader specified"); this.classLoader = classLoader; this.path = path; }
public static <T> T notNull(T t) { checkNotNull(t); return t; } }
/** * This constructor uses the {@link ClientProvider} to retrieve an instance of {@link Client} and use it to execute requests. * * @param clientProvider the {@link ClientProvider} to use for requests execution */ protected EsSetup(ClientProvider clientProvider) { Preconditions.checkNotNull(clientProvider, "No ClientProvider specified"); provider = clientProvider; }
public DefaultClientProvider(Client client, boolean closeClientOnTerminate) { Preconditions.checkNotNull(client, "No Client specified"); this.closeOnTerminate = closeClientOnTerminate; this.client = client; }
public ClassPathJSONProvider(Class klass, String path) { Preconditions.checkNotNull(klass, "No Class specified"); this.klass = klass; this.path = path; }
public static <T> T notNull(T t) { checkNotNull(t); return t; } }
public DefaultClientProvider(Client client, boolean closeClientOnTerminate) { Preconditions.checkNotNull(client, "No Client specified"); this.closeOnTerminate = closeClientOnTerminate; this.client = client; }
public ClassPathJSONProvider(ClassLoader classLoader, String path) { Preconditions.checkNotNull(classLoader, "No ClassLoader specified"); this.classLoader = classLoader; this.path = path; }
public ClassPathJSONProvider(Class klass, String path) { Preconditions.checkNotNull(klass, "No Class specified"); this.klass = klass; this.path = path; }
/** * This constructor uses the {@link ClientProvider} to retrieve an instance of {@link Client} and use it to execute requests. * * @param clientProvider the {@link ClientProvider} to use for requests execution */ protected EsSetup(ClientProvider clientProvider) { Preconditions.checkNotNull(clientProvider, "No ClientProvider specified"); provider = clientProvider; }
public URL url() { checkNotNull(protocol); checkNotNull(host); checkNotNull(port); checkNotNull(path); String thePath = query == null ? path : path + "?" + query; try { return new URL(protocol, host, port, "/" + thePath); } catch (MalformedURLException e) { throw new RuntimeException(e); } } }
public URL url() { checkNotNull(protocol); checkNotNull(host); checkNotNull(port); checkNotNull(path); String thePath = query == null ? path : path + "?" + query; try { return new URL(protocol, host, port, "/" + thePath); } catch (MalformedURLException e) { throw new RuntimeException(e); } } }
public static String nodeStringValue(@Nullable Object o) { Preconditions.checkNotNull(o); if (o instanceof String) { return (String) o; } else { return o.toString(); } }
public static String nodeStringValue(@Nullable Object o) { Preconditions.checkNotNull(o); if (o instanceof String) { return (String) o; } else { return Objects.toString(o); } }
public static <T> List<T> nodeListValue(@Nullable Object o, Class<T> contains) { Preconditions.checkNotNull(o); if (o instanceof List) { for (Object elem : (List) o) { if (!contains.isAssignableFrom(elem.getClass())) { throw new IllegalArgumentException(String.format("%s was expected to be a %s but was a %s", elem, contains.getCanonicalName(), elem.getClass().getCanonicalName())); } } //noinspection unchecked return (List<T>) o; } else { throw new IllegalArgumentException(String.format("%s was expected to be a list but was %s", o, o.getClass())); } }
public static <T> List<T> nodeListValue(@Nullable Object o, Class<T> contains) { Preconditions.checkNotNull(o); if (o instanceof List) { for (Object elem : (List) o) { if (elem != null && !contains.isAssignableFrom(elem.getClass())) { throw new IllegalArgumentException(String.format("%s was expected to be a %s but was a %s", elem, contains.getCanonicalName(), elem.getClass().getCanonicalName())); } } //noinspection unchecked return (List<T>) o; } else { throw new IllegalArgumentException(String.format("%s was expected to be a list but was %s", o, o.getClass())); } }
public UrlBuilder paramIfPresent(String key, Optional<String> value) { if (value.isPresent()) { checkNotNull(key); checkNotNull(value.get()); String newParam = key + "=" + value.get(); String newQuery = query == null ? newParam : query + "&" + newParam; return new UrlBuilder(protocol, host, port, path, newQuery); } else { return this; } }
public UrlBuilder paramIfPresent(String key, Optional<String> value) { if (value.isPresent()) { checkNotNull(key); checkNotNull(value.get()); String newParam = key + "=" + value.get(); String newQuery = query == null ? newParam : query + "&" + newParam; return new UrlBuilder(protocol, host, port, path, newQuery); } else { return this; } }