List of usage examples for java.util Objects requireNonNull
public static <T> T requireNonNull(T obj)
From source file:org.eclipse.hono.service.auth.device.UsernamePasswordAuthProvider.java
/** * Creates a new provider for a given configuration. * /*from w ww.j a v a 2s . c o m*/ * @param credentialsServiceClient The client. * @param config The configuration. * @throws NullPointerException if any of the parameters are {@code null}. */ @Autowired public UsernamePasswordAuthProvider(final HonoClient credentialsServiceClient, final ServiceConfigProperties config) { super(credentialsServiceClient); this.config = Objects.requireNonNull(config); }
From source file:clientapi.util.ClientAPIUtils.java
/** * Checks if a string array contains the specified * string, non case-sensitive//w w w .j av a2 s .com * * @param array Array of strings being checked * @param target String being searched for */ public static boolean containsIgnoreCase(String[] array, String target) { Objects.requireNonNull(array); for (String string : array) if (string != null && string.equalsIgnoreCase(target)) return true; return false; }
From source file:io.github.moosbusch.lumpi.action.spi.AbstractChildWindowAction.java
@Override public final void doPerform(Component evtSource) { V chldWindow = Objects.requireNonNull(getChildWindow()); T appWindow = Objects.requireNonNull(getApplicationWindow()); chldWindow.align(appWindow.getBounds(), HorizontalAlignment.CENTER, VerticalAlignment.CENTER); onChildWindowShowing(appWindow, chldWindow); openChildWindow(appWindow, chldWindow); }
From source file:org.eclipse.hono.service.cache.SpringBasedExpiringValueCache.java
/** * Creates a new cache.//from www .ja v a 2 s.c o m * * @param cache The Spring cache instance to use for storing values. */ public SpringBasedExpiringValueCache(final Cache cache) { this.cache = Objects.requireNonNull(cache); }
From source file:net.sf.jabref.logic.search.DatabaseSearcher.java
public DatabaseSearcher(SearchQuery query, BibDatabase database) { this.query = Objects.requireNonNull(query); this.database = Objects.requireNonNull(database); }
From source file:cn.sel.dvw.SimpleObjectRowMapper.java
@SuppressWarnings("unchecked") public SimpleObjectRowMapper(Class<T> clazz) { Objects.requireNonNull(clazz); this.clazz = clazz; }
From source file:com.spotify.hamcrest.jackson.IsJsonNumber.java
private IsJsonNumber(final Matcher<?> numberMatcher, final Function<NumericNode, Object> projection) { super(JsonNodeType.NUMBER); this.numberMatcher = Objects.requireNonNull(numberMatcher); this.projection = Objects.requireNonNull(projection); }
From source file:io.github.retz.executor.DummyExecutorDriver.java
public DummyExecutorDriver(Executor executor, TemporaryFolder folder) { this.executor = Objects.requireNonNull(executor); this.folder = Objects.requireNonNull(folder); frameworkInfo = Protos.FrameworkInfo.newBuilder() .setId(Protos.FrameworkID.newBuilder().setValue("dummy-framework-id").build()).setUser("me") .setPrincipal("*").setName("dummy-framework-name").build(); executorInfo = buildExecutorInfo(folder, frameworkInfo); slaveInfo = Protos.SlaveInfo.newBuilder() .setId(Protos.SlaveID.newBuilder().setValue("dummy-slave-id").build()) .addAllResources(ResourceConstructor.construct(4, 4096)).setHostname("localhost-dummy:5053") .build();/*from w w w. j a v a2 s. c o m*/ }
From source file:net.sf.jabref.logic.formatter.bibtexfields.UnicodeToLatexFormatter.java
@Override public String format(String text) { String result = Objects.requireNonNull(text); if (result.isEmpty()) { return result; }/*from w w w . jav a 2s . c om*/ // Standard symbols for (Map.Entry<String, String> unicodeLatexPair : HTMLUnicodeConversionMaps.UNICODE_LATEX_CONVERSION_MAP .entrySet()) { result = result.replace(unicodeLatexPair.getKey(), unicodeLatexPair.getValue()); } // Combining accents StringBuilder sb = new StringBuilder(); boolean consumed = false; for (int i = 0; i <= (result.length() - 2); i++) { if (!consumed && (i < (result.length() - 1))) { int cpCurrent = result.codePointAt(i); Integer cpNext = result.codePointAt(i + 1); String code = HTMLUnicodeConversionMaps.ESCAPED_ACCENTS.get(cpNext); if (code == null) { sb.append((char) cpCurrent); } else { sb.append("{\\").append(code).append('{').append((char) cpCurrent).append("}}"); consumed = true; } } else { consumed = false; } } if (!consumed) { sb.append((char) result.codePointAt(result.length() - 1)); } result = sb.toString(); // Check if any symbols is not converted for (int i = 0; i <= (result.length() - 1); i++) { int cp = result.codePointAt(i); if (cp >= 129) { LOGGER.warn("Unicode character not converted: " + cp); } } return result; }
From source file:io.github.retz.protocol.DownloadFileRequest.java
@JsonCreator public DownloadFileRequest(@JsonProperty(value = "id", required = true) int id, @JsonProperty(value = "file", required = true) String file) { this.id = id; this.file = Objects.requireNonNull(file); }