List of usage examples for java.util Objects requireNonNull
public static <T> T requireNonNull(T obj)
From source file:org.eclipse.hono.service.auth.BaseAuthorizationService.java
/** * Sets the service configuration properties. * /*from w w w .j av a2s . c o m*/ * @param props The properties. * @throws NullPointerException if props is {@code null}. */ @Autowired(required = false) public final void setConfig(final ServiceConfigProperties props) { this.config = Objects.requireNonNull(props); }
From source file:com.github.alexfalappa.nbspringboot.projects.customizer.BootPanel.java
void setModelHandle(ModelHandle2 mh2) { Objects.requireNonNull(mh2); // store reference to project properties model and to properties of maven actions for run/debug this.mh2 = mh2; ActionToGoalMapping mapps = mh2.getActionMappings(); for (NetbeansActionMapping map : mapps.getActions()) { if (map.getActionName().equals(ActionProvider.COMMAND_RUN)) { this.runProps = map.getProperties(); } else if (map.getActionName().equals(ActionProvider.COMMAND_DEBUG)) { this.debugProps = map.getProperties(); }//from ww w . jav a 2 s . c o m } // prepare the set of cmd line args if (runProps.containsKey(PROP_RUN_ARGS)) { args.addAll(Arrays.asList(runProps.get(PROP_RUN_ARGS).split(","))); } // make the widget reflect the existing cmd line args StringBuilder sb = new StringBuilder(); for (String arg : args) { if (arg.contains(TRIGGER_FILE)) { chDevtools.setSelected(true); } else { sb.append(arg).append(' '); } } if (sb.length() > 0) { sb.setLength(sb.length() - 1); } txArgs.setText(sb.toString()); // hook up to command line arguments textfield txArgs.getDocument().addDocumentListener(this); // enable widgets chDevtools.setEnabled(true); txArgs.setEnabled(true); }
From source file:it.reply.orchestrator.utils.EnumUtils.java
/** * <p>//www. ja va 2 s . c o m * Retrieve a enum value from its name and its class. * </p> * * <p> * The enum must extends {@link Named}, and the name value should be the one that would be * returned from {@link Named#getName()}. * </p> * * <p> * If no enum is found the default value will be returned. * </p> * * @param enumClass * the class of the enum * @param name * the enum name * @param defaultValue * the defaultValue * @return the enum value, cannot be null */ public static <T extends Enum<T> & Named> T fromNameOrDefault(Class<T> enumClass, String name, T defaultValue) { Objects.requireNonNull(defaultValue); @Nullable T foundEnum = fromName(enumClass, name); if (foundEnum != null) { return foundEnum; } else { LOG.warn("No enum found with name [{}] in class [{}], using value [{}] as default", name, enumClass, defaultValue); return defaultValue; } }
From source file:net.sf.jabref.exporter.OpenDocumentSpreadsheetCreator.java
@Override public void performExport(final BibDatabaseContext databaseContext, final String file, final Charset encoding, List<BibEntry> entries) throws Exception { Objects.requireNonNull(databaseContext); Objects.requireNonNull(entries); if (!entries.isEmpty()) { // Only export if entries exists OpenDocumentSpreadsheetCreator.exportOpenDocumentSpreadsheet(new File(file), databaseContext.getDatabase(), entries); }/*w w w .ja va 2 s.c o m*/ }
From source file:org.eclipse.hono.service.auth.delegating.DelegatingAuthenticationService.java
/** * Sets the DNS client to use for checking availability of an <em>Authentication</em> service. * <p>//from ww w.j av a 2 s.c o m * If not set, the vert.x instance's address resolver is used instead. * * @param dnsClient The client. * @throws NullPointerException if client is {@code null}. */ @Autowired(required = false) public void setDnsClient(final DnsClient dnsClient) { this.dnsClient = Objects.requireNonNull(dnsClient); }
From source file:com.github.horrorho.inflatabledonkey.cloud.AuthorizeAssetsResponseHandler.java
public AuthorizeAssetsResponseHandler(IOFunction<InputStream, FileGroups> parser, long fallbackDurationMS) { this.parser = Objects.requireNonNull(parser); this.fallbackDurationMS = fallbackDurationMS; }
From source file:com.envision.envservice.common.util.SAPUtil.java
/** * ?SAP Date//from w w w . jav a 2 s. c o m */ public static String formatSAPDate(String sapDate, String format) { if (StringUtils.isEmpty(sapDate)) { return StringUtils.EMPTY; } Objects.requireNonNull(format); int tsStart = sapDate.indexOf(FIELD_PREFIX_DATE) + FIELD_PREFIX_DATE.length(); int tsEnd = sapDate.indexOf(FIELD_SUFFIX_DATE); String ts = sapDate.substring(tsStart, tsEnd); return DateUtil.format(new Date(Long.valueOf(ts)), format); }
From source file:org.eclipse.hono.service.amqp.BaseEndpoint.java
/** * Sets configuration properties.//w w w . j a v a2s . c om * * @param props The properties. * @throws NullPointerException if props is {@code null}. */ @Autowired(required = false) public final void setConfiguration(final T props) { this.config = Objects.requireNonNull(props); }
From source file:com.yevster.spdxtra.Read.java
public static void outputRdfXml(Dataset dataset, Path outputFilePath) throws IOException { Objects.requireNonNull(dataset); Objects.requireNonNull(outputFilePath); Files.createFile(outputFilePath); try (FileOutputStream fos = new FileOutputStream(outputFilePath.toFile()); DatasetAutoAbortTransaction transaction = DatasetAutoAbortTransaction.begin(dataset, ReadWrite.READ)) {//from w w w . jav a 2 s. com WriterGraphRIOT writer = RDFDataMgr.createGraphWriter(RDFFormat.RDFXML_PRETTY); writer.write(fos, dataset.asDatasetGraph().getDefaultGraph(), PrefixMapFactory.create(dataset.getDefaultModel().getNsPrefixMap()), null, dataset.getContext()); } }
From source file:org.eclipse.hono.service.auth.device.CredentialsApiAuthProvider.java
/** * Creates a new authentication provider for a vert.x instance. * //from w w w. j a va 2 s . c o m * @param vertx The vert.x instance to use for scheduling re-connection attempts. * @throws NullPointerException if vertx is {@code null} */ protected CredentialsApiAuthProvider(final Vertx vertx) { this.vertx = Objects.requireNonNull(vertx); }