List of usage examples for java.util Objects isNull
public static boolean isNull(Object obj)
From source file:org.esa.s3tbx.olci.radiometry.rayleigh.RayleighAux.java
public double[] getAirMass() { if (Objects.isNull(airMass)) { airMass = SmileCorrectionUtils.getAirMass(this.getCosOZARads(), this.getCosSZARads()); }// w w w .j a va 2 s . co m return airMass; }
From source file:org.kitodo.production.helper.VariableReplacer.java
private String getResultAccordingToMetadataLevel(MetadataLevel metadataLevel, String metadata, String resultFirst, String resultTop) { String result = ""; switch (metadataLevel) { case FIRSTCHILD: // without existing FirstChild, this can not be returned if (Objects.isNull(resultFirst)) { logger.info("Can not replace firstChild-variable for METS: {}", metadata); } else {//from www . j a v a 2 s . c o m result = resultFirst; } break; case TOPSTRUCT: if (Objects.isNull(resultTop)) { logger.warn("Can not replace topStruct-variable for METS: {}", metadata); } else { result = resultTop; } break; case ALL: if (Objects.nonNull(resultFirst)) { result = resultFirst; } else if (Objects.nonNull(resultTop)) { result = resultTop; } else { logger.warn("Can not replace variable for METS: {}", metadata); } break; default: break; } return result; }
From source file:org.esa.s3tbx.olci.radiometry.rayleigh.RayleighAux.java
public double[] getAziDifferent() { if (Objects.isNull(aziDiff)) { aziDiff = SmileCorrectionUtils.getAziDiff(this.getSunAzimuthAnglesRad(), this.getViewAzimuthAnglesRad()); }/*from w w w . j a va 2s .c o m*/ return aziDiff; }
From source file:org.dbflute.intro.app.web.client.ClientAction.java
private ProjectInfra prepareProjectInfra(String projectName, ClientPart clientBody) { if (Objects.isNull(clientBody.jdbcDriver)) { return new ProjectInfra(projectName, clientBody.dbfluteVersion); }//from w w w . ja v a 2s. c o m ExtlibFile extlibFile = clientPhysicalLogic.createExtlibFile(projectName, clientBody.jdbcDriver.fileName, clientBody.jdbcDriver.data); return new ProjectInfra(projectName, clientBody.dbfluteVersion, extlibFile); }
From source file:com.epam.dlab.backendapi.dao.ExploratoryDAO.java
/** * Updates the scheduler's data for exploratory in Mongo database. * * @param user user./*www. j a v a 2 s .c o m*/ * @param exploratoryName name of exploratory. * @param dto object of scheduler data. * @return The result of an update operation. */ public UpdateResult updateSchedulerDataForUserAndExploratory(String user, String exploratoryName, SchedulerJobDTO dto) { return updateOne(USER_INSTANCES, exploratoryCondition(user, exploratoryName), set(SCHEDULER_DATA, Objects.isNull(dto) ? null : convertToBson(dto))); }
From source file:org.kitodo.production.forms.ProzesskopieForm.java
/** * The function pluginAvailableFor(catalogue) verifies that a plugin * suitable for accessing the library catalogue identified by the given * String is available in the global variable importCatalogue. If * importCatalogue is empty or the current plugin doesnt support the given * catalogue, the function will try to load a suitable plugin. Upon success * the preferences and the catalogue to use will be configured in the * plugin, otherwise an error message will be set to be shown. * * @param catalogue//from ww w .j ava2 s. c o m * identifier string for the catalogue that the plugin shall * support * @return whether a plugin is available in the global variable * importCatalogue */ private boolean pluginAvailableFor(String catalogue) { if (Objects.isNull(importCatalogue) || !importCatalogue.supportsCatalogue(catalogue)) { importCatalogue = PluginLoader.getCataloguePluginForCatalogue(catalogue); } if (Objects.isNull(importCatalogue)) { Helper.setErrorMessage("NoCataloguePluginForCatalogue", catalogue); return false; } else { importCatalogue .setPreferences(ServiceManager.getRulesetService().getPreferences(prozessKopie.getRuleset())); importCatalogue.useCatalogue(catalogue); return true; } }
From source file:org.geowebcache.sqlite.FileManager.java
/** * Helper method that will walk recursively the directory hierarchy based on * the provided path parts./*from w w w . j av a 2 s . c o m*/ */ private static List<File> walkFileTreeWithRegex(File path, int level, String[] pathParts) { // filter the current directory files that match the current path part File[] files = path.listFiles((directory, name) -> { String pathPart = pathParts[level]; // if need the current path will be interpreted as a regex (.*?) return pathPart.equals(name) || name.matches(pathPart); }); if (Objects.isNull(files)) { return Collections.emptyList(); } if (level != pathParts.length - 1) { // let's walk recursively in the matched files List<File> matchedFiles = new ArrayList<>(); for (File file : files) { matchedFiles.addAll(walkFileTreeWithRegex(file, level + 1, pathParts)); } return matchedFiles; } // we are in the last directory before the path end so we simply return the matched files return Arrays.asList(files); }
From source file:org.kitodo.production.forms.ProzesskopieForm.java
/** * Reset all configuration properties and fields. *///from w w w . j av a 2 s .co m protected void clearValues() { if (Objects.isNull(this.opacKatalog)) { this.opacKatalog = ""; } this.standardFields = new HashMap<>(); this.standardFields.put("collections", true); this.standardFields.put("doctype", true); this.standardFields.put("regelsatz", true); this.standardFields.put("images", true); this.additionalFields = new ArrayList<>(); this.tifHeaderDocumentName = ""; this.tifHeaderImageDescription = ""; }
From source file:org.kitodo.production.helper.tasks.EmptyTask.java
/** * The procedure setException can be used to save an exception that occurred * and show it in the front end. It will only record the first exception * (which is likely to be the source of all the misery) and it will not * record an InterruptedException if the thread has already been * interrupted./* ww w . j a v a 2 s. com*/ * * @param exception * exception to save */ public void setException(Throwable exception) { if (exception instanceof InterruptedException) { Thread.currentThread().interrupt(); } if (Objects.isNull(this.exception) && (!isInterrupted() || !(exception instanceof InterruptedException))) { if (exception instanceof Exception) { this.exception = (Exception) exception; } else { this.exception = new ExecutionException(exception.getMessage(), exception); } } }
From source file:org.openecomp.sdc.translator.services.heattotosca.impl.ResourceTranslationNovaServerImpl.java
private List<Map<String, Object>> getBlockDeviceMappingList(Resource resource) { if (Objects.isNull(resource.getProperties())) { return Collections.emptyList(); }// w ww . j a v a 2s . c om List<Map<String, Object>> blockDeviceMappingList = (List<Map<String, Object>>) resource.getProperties() .get("block_device_mapping"); List<Map<String, Object>> blockDeviceMappingV2List = (List<Map<String, Object>>) resource.getProperties() .get("block_device_mapping_v2"); if (blockDeviceMappingList != null && blockDeviceMappingV2List != null) { blockDeviceMappingList.addAll(blockDeviceMappingV2List); } else if (CollectionUtils.isEmpty(blockDeviceMappingList) && CollectionUtils.isEmpty(blockDeviceMappingV2List)) { return null; } else { blockDeviceMappingList = blockDeviceMappingList != null ? blockDeviceMappingList : blockDeviceMappingV2List; } return blockDeviceMappingList; }