本文整理匯總了Java中org.apache.commons.lang3.BooleanUtils.isTrue方法的典型用法代碼示例。如果您正苦於以下問題:Java BooleanUtils.isTrue方法的具體用法?Java BooleanUtils.isTrue怎麽用?Java BooleanUtils.isTrue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.commons.lang3.BooleanUtils
的用法示例。
在下文中一共展示了BooleanUtils.isTrue方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: execute
import org.apache.commons.lang3.BooleanUtils; //導入方法依賴的package包/類
protected <T> ResponseEntity<T> execute(String url,
HttpMethod httpMethod,
HttpEntity<?> httpEntity,
ParameterizedTypeReference<T> typeReference,
Map<String, String> uriVariables) {
if (Objects.isNull(uriVariables)) {
uriVariables = Maps.newHashMap();
}
if (BooleanUtils.isTrue(swallowException)) {
try {
return doExecute(url, httpMethod, httpEntity, typeReference, uriVariables);
} catch (Exception e) {
// camouflage exception
log.error("http call failed, url [{}], http method [{}], http entity [{}], uri vars [{}]",
url, httpMethod, httpEntity, uriVariables, e);
return doCamouflageException();
}
} else {
return doExecute(url, httpMethod, httpEntity, typeReference, uriVariables);
}
}
示例2: downloadForge
import org.apache.commons.lang3.BooleanUtils; //導入方法依賴的package包/類
public void downloadForge(String minecraftVersion, List<ModLoader> modLoaders) {
if (CollectionUtils.isEmpty(modLoaders) || Strings.isNullOrEmpty(minecraftVersion)) {
log.debug("No Forge or Minecraft version found in manifest, skipping");
return;
}
for (ModLoader modLoader : modLoaders) {
if (BooleanUtils.isTrue(modLoader.getDownloadInstaller())) {
log.debug("Downloading Forge installer version {}", modLoader.getId());
downloadForgeFile(minecraftVersion, modLoader, true);
}
if (BooleanUtils.isTrue(modLoader.getDownloadUniversal())) {
log.debug("Downloading Forge universal version {}", modLoader.getId());
downloadForgeFile(minecraftVersion, modLoader, false);
}
}
}
示例3: e
import org.apache.commons.lang3.BooleanUtils; //導入方法依賴的package包/類
@Override
public void e() throws Exception {
if (BooleanUtils.isTrue(clear)) {
FileUtils.deleteDirectory(frontendDirectory);
FileUtils.deleteDirectory(frontendWorkingDirectory);
}
generatNpmPackage(frontendWorkingDirectory);
execMojo("com.github.eirslett", "frontend-maven-plugin",
configuration(element(name("nodeVersion"), getVersion("node")),
element(name("npmVersion"), getVersion("npm")),
element(name("installDirectory"), frontendDirectory.getAbsolutePath())),
"install-node-and-npm");
execMojo("com.github.eirslett", "frontend-maven-plugin",
configuration(element(name("arguments"), "install"),
element(name("installDirectory"), frontendDirectory.getAbsolutePath()),
element(name("workingDirectory"), frontendWorkingDirectory.getAbsolutePath())),
"npm");
}
示例4: generateAlertsChannelConfiguration
import org.apache.commons.lang3.BooleanUtils; //導入方法依賴的package包/類
@Override
public AlertsChannelConfiguration generateAlertsChannelConfiguration(NewRelicApi api) {
EmailChannel emailChannel = (EmailChannel) channel;
AlertsChannelConfiguration.AlertsChannelConfigurationBuilder builder = AlertsChannelConfiguration.builder();
builder.recipients(emailChannel.getEmailAddress());
if (BooleanUtils.isTrue(emailChannel.getIncludeJsonAttachment())) {
builder.includeJsonAttachment(emailChannel.getIncludeJsonAttachment());
}
return builder.build();
}
示例5: trimToSize
import org.apache.commons.lang3.BooleanUtils; //導入方法依賴的package包/類
private <T> boolean trimToSize(Boolean showAll, List<T> list, int userPaginationPreference) {
boolean trimmed = false;
if(!BooleanUtils.isTrue(showAll)) {
if(list.size() > userPaginationPreference) {
trimmed = true;
list.subList(userPaginationPreference, list.size()).clear();
}
}
return trimmed;
}
示例6: assertToegangLeveringsAutorisatieNietGeblokkeerd
import org.apache.commons.lang3.BooleanUtils; //導入方法依賴的package包/類
/**
* Controleer of een toegang leveringsautorisatie niet geblokkeerd is.
* @param toegangLeveringsAutorisatie de toegang leveringsautorisatie
* @throws AutorisatieException als de toegang leveringsautorisatie geblokeerd is
*/
public static void assertToegangLeveringsAutorisatieNietGeblokkeerd(final ToegangLeveringsAutorisatie toegangLeveringsAutorisatie)
throws AutorisatieException {
if (BooleanUtils.isTrue(toegangLeveringsAutorisatie.getIndicatieGeblokkeerd())) {
AutorisatieUtil.rapporteerRegelFout(Regel.R2052);
}
}
示例7: getValidationGroups
import org.apache.commons.lang3.BooleanUtils; //導入方法依賴的package包/類
@Override
public List<Class<?>> getValidationGroups(AbstractAuthConfig authConfig) {
List<Class<?>> defaultGroupSequence = new ArrayList<>();
defaultGroupSequence.add(modelType);
if (authConfig != null && BooleanUtils.isTrue(authConfig.isEnabled())) {
defaultGroupSequence.add(IfEnabled.class);
}
return defaultGroupSequence;
}
示例8: basicValidate
import org.apache.commons.lang3.BooleanUtils; //導入方法依賴的package包/類
@Override
public void basicValidate(final String section) throws ConfigException {
if (BooleanUtils.isTrue(enabled)) {
if (server == null) {
throw new ConfigException("QMS", "QMS is enabled but no corresponding server details have been provided");
}
server.basicValidate("QMS");
}
}
示例9: basicValidate
import org.apache.commons.lang3.BooleanUtils; //導入方法依賴的package包/類
@Override
public void basicValidate(final String configSection) throws ConfigException {
if (BooleanUtils.isTrue(enabled)) {
if (server == null) {
throw new ConfigException(SECTION, "AnswerServer is enabled but no corresponding server details have been provided");
}
server.basicValidate(SECTION);
}
}
示例10: updateCurseFile
import org.apache.commons.lang3.BooleanUtils; //導入方法依賴的package包/類
public void updateCurseFile(final CurseFile curseFile) {
if (BooleanUtils.isTrue(curseFile.getSkipUpdate())) {
log.debug("Skipped updating {}", curseFile.getName());
return;
}
disableCertValidation();
JSONObject fileListJson = new JSONObject();
try {
val conn = (HttpURLConnection) new URL(curseFile.getProjectUrl()).openConnection();
conn.setInstanceFollowRedirects(false);
conn.connect();
fileListJson.put("curse", getCurseProjectJson(curseFile).get("files"));
if (fileListJson.get("curse") == null) {
log.error("No file list found for {}, and will be skipped.", curseFile.getName());
return;
}
} catch (IOException | ParseException e) {
log.error(e);
return;
}
val newMod = getLatestVersion(curseFile.getReleaseType() != null ? curseFile.getReleaseType() : arguments.getReleaseType(), curseFile, fileListJson, null);
if (curseFile.getFileID().compareTo(newMod.getFileID()) < 0) {
log.debug("Update found for {}. Most recent version is {}.", curseFile.getName(), newMod.getVersion());
updateCurseFile(curseFile, newMod);
updateCheckSummarizer.getModList().add(curseFile);
}
}
示例11: getLatestVersion
import org.apache.commons.lang3.BooleanUtils; //導入方法依賴的package包/類
private CurseFile getLatestVersion(String releaseType,
CurseFile curseFile, final JSONObject fileListJson, String mcVersion) {
log.trace("Getting most recent available file...");
boolean backup = true;
if (Strings.isNullOrEmpty(mcVersion)) {
mcVersion = arguments.getMcVersion();
backup = false;
}
releaseType = defaultReleaseType(releaseType);
CurseFile newMod = new CurseFile(curseFile);
curseFile = checkFileId(curseFile);
JSONArray fileList = (JSONArray) fileListJson.get("curse");
List<Long> fileIds = new ArrayList<>();
checkFileIds(releaseType, mcVersion, fileList, fileIds);
Collections.sort(fileIds);
Collections.reverse(fileIds);
setUpdatedFileId(curseFile, fileList, newMod, fileIds);
if (!"alpha".equals(releaseType) && fileIds.isEmpty()) {
if (CollectionUtils.isEmpty(arguments.getBackupVersions())) {
log.debug("No files found for Minecraft {}, disabling download of {}", mcVersion, curseFile.getName());
curseFile.setSkipDownload(true);
} else if (!backup) {
newMod = checkBackupVersions(releaseType, curseFile, fileListJson, mcVersion, newMod);
} else if (fileIds.isEmpty()) {
curseFile.setSkipDownload(true);
newMod.setSkipDownload(true);
}
}
if (BooleanUtils.isTrue(curseFile.getSkipDownload()) && !fileIds.isEmpty()) {
log.debug("Found files for Minecraft {}, enabling download of {}", mcVersion, curseFile.getName());
newMod.setSkipDownload(null);
}
log.trace("Finished getting most recent available file.");
return newMod;
}
示例12: downloadFile
import org.apache.commons.lang3.BooleanUtils; //導入方法依賴的package包/類
/**
* Downloads a {@link DownloadableFile} moves it to the correct folder. Downloads to the local cache if
* downloadToLocalRepo is set to true and then copies to the download folder.
*
* @param downloadableFile a DownloadableFile with a download URL
* @param downloadToLocalRepo set to true to keep a copy of the DownloadableFile in local cache
* @return status of the download, failed, skipped, or success
*/
public DownloadStatus downloadFile(final DownloadableFile downloadableFile, boolean downloadToLocalRepo) {
DownloadStatus status = DownloadStatus.FAILURE;
if (BooleanUtils.isTrue(downloadableFile.getSkipDownload())) {
log.debug("Skipped downloading {}", downloadableFile.getName());
return notifyStatus(DownloadStatus.SKIPPED);
}
val decodedFileName = URLHelper.decodeSpaces(downloadableFile.getFileName());
if (FileSystemHelper.getDownloadedFile(decodedFileName, downloadableFile.getFolder()).exists() && !arguments.isForceDownload()) {
log.debug("Found {} already downloaded, skipping", decodedFileName);
return notifyStatus(DownloadStatus.SKIPPED);
}
if (!FileSystemHelper.isInLocalRepo(downloadableFile.getName(), decodedFileName) || arguments.isForceDownload()) {
val downloadedFile = FileSystemHelper.getLocalFile(downloadableFile);
try {
FileUtils.copyURLToFile(new URL(downloadableFile.getDownloadUrl()), downloadedFile);
} catch (final IOException e) {
log.error("Could not download {}.", downloadableFile.getFileName(), e);
Reference.downloadCount++;
if ("forge".equals(downloadableFile.getName())) {
return status;
}
return notifyStatus(status);
}
status = DownloadStatus.SUCCESS_DOWNLOAD;
} else {
status = DownloadStatus.SUCCESS_CACHE;
}
FileSystemHelper.moveFromLocalRepo(downloadableFile, decodedFileName, downloadToLocalRepo, arguments.getModFolder());
log.info("Successfully {} {}", status, downloadableFile.getFileName());
return notifyStatus(status);
}
示例13: assertDienstNietGeblokkeerd
import org.apache.commons.lang3.BooleanUtils; //導入方法依賴的package包/類
/**
* Controleer of een dienst niet geblokkeerd is.
* @param dienst de dienst
* @throws AutorisatieException als de dienst geblokkeerd is
*/
public static void assertDienstNietGeblokkeerd(final Dienst dienst) throws AutorisatieException {
if (BooleanUtils.isTrue(dienst.getIndicatieGeblokkeerd())) {
AutorisatieUtil.rapporteerRegelFout(Regel.R1264);
}
}
示例14: assertDienstbundelNietGeblokkeerd
import org.apache.commons.lang3.BooleanUtils; //導入方法依賴的package包/類
/**
* Controleer of een dienstbundel niet geblokkeerd is.
* @param dienstbundel de dienstbundel
* @throws AutorisatieException als de dienstbundel geblokeerd is
*/
public static void assertDienstbundelNietGeblokkeerd(final Dienstbundel dienstbundel) throws AutorisatieException {
if (dienstbundel != null && BooleanUtils.isTrue(dienstbundel.getIndicatieGeblokkeerd())) {
AutorisatieUtil.rapporteerRegelFout(Regel.R2056);
}
}
示例15: assertLeveringsautorisieNietGeblokkeerd
import org.apache.commons.lang3.BooleanUtils; //導入方法依賴的package包/類
/**
* Controleer of de leveringsautorisatie niet geblokeerd is.
* @param leveringsautorisatie de leveringsautorisatie
* @throws AutorisatieException als de leveringsautorisatie geblokeerd is
*/
public static void assertLeveringsautorisieNietGeblokkeerd(final Leveringsautorisatie leveringsautorisatie) throws AutorisatieException {
if (BooleanUtils.isTrue(leveringsautorisatie.getIndicatieGeblokkeerd())) {
AutorisatieUtil.rapporteerRegelFout(Regel.R1263);
}
}