List of usage examples for org.apache.commons.lang3 ArrayUtils isNotEmpty
public static boolean isNotEmpty(final boolean[] array)
Checks if an array of primitive booleans is not empty or not null .
From source file:cn.wanghaomiao.seimi.boot.Run.java
public static void main(String[] args) { Seimi s = new Seimi(); if (ArrayUtils.isNotEmpty(args)) { if (args[0].matches("\\d+")) { int port = Integer.parseInt(args[0]); if (args.length > 1) { s.startWithHttpd(port, ArrayUtils.subarray(args, 1, args.length)); } else { s.startAllWithHttpd(port); }// w w w . j av a 2 s .com } else { s.start(args); } } else { s.startAll(); } }
From source file:net.sf.jsignpdf.Signer.java
/** * Main./* w ww .ja v a2 s . co m*/ * * @param args */ public static void main(String[] args) { SignerOptionsFromCmdLine tmpOpts = null; if (args != null && args.length > 0) { tmpOpts = new SignerOptionsFromCmdLine(); parseCommandLine(args, tmpOpts); } try { SSLInitializer.init(); } catch (Exception e) { LOGGER.warn("Unable to re-configure SSL layer", e); } pkcs11ProviderName = PKCS11Utils .registerProvider(ConfigProvider.getInstance().getProperty("pkcs11config.path")); traceInfo(); if (tmpOpts != null) { if (tmpOpts.isPrintVersion()) { System.out.println("JSignPdf version " + VERSION); } if (tmpOpts.isPrintHelp()) { printHelp(); } if (tmpOpts.isListKeyStores()) { LOGGER.info(RES.get("console.keystores")); for (String tmpKsType : KeyStoreUtils.getKeyStores()) { System.out.println(tmpKsType); } } if (tmpOpts.isListKeys()) { final String[] tmpKeyAliases = KeyStoreUtils.getKeyAliases(tmpOpts); LOGGER.info(RES.get("console.keys")); // list certificate aliases in the keystore for (String tmpCert : tmpKeyAliases) { System.out.println(tmpCert); } } if (ArrayUtils.isNotEmpty(tmpOpts.getFiles()) || (!StringUtils.isEmpty(tmpOpts.getInFile()) && !StringUtils.isEmpty(tmpOpts.getOutFile()))) { signFiles(tmpOpts); } else { final boolean tmpCommand = tmpOpts.isPrintVersion() || tmpOpts.isPrintHelp() || tmpOpts.isListKeyStores() || tmpOpts.isListKeys(); if (!tmpCommand) { // no valid command provided - print help and exit printHelp(); exit(EXIT_CODE_NO_COMMAND); } } exit(0); } else { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { System.err.println("Can't set Look&Feel."); } SignPdfForm tmpForm = new SignPdfForm(WindowConstants.EXIT_ON_CLOSE); tmpForm.pack(); GuiUtils.center(tmpForm); tmpForm.setVisible(true); } }
From source file:co.runrightfast.zest.assemblers.ModuleAssembler.java
static Function<ModuleAssembly, ModuleAssembly> composeAssembler( @NonNull final Function<ModuleAssembly, ModuleAssembly> assembler1, @NonNull final Function<ModuleAssembly, ModuleAssembly> assembler2, final Function<ModuleAssembly, ModuleAssembly>... moreAssemblers) { if (ArrayUtils.isNotEmpty(moreAssemblers)) { noNullElements(moreAssemblers);/*from w w w .j a v a 2 s.co m*/ Function<ModuleAssembly, ModuleAssembly> chain = assembler1.andThen(assembler2); for (final Function<ModuleAssembly, ModuleAssembly> assembler : moreAssemblers) { chain = chain.andThen(assembler); } return chain; } else { return assembler1.andThen(assembler2); } }
From source file:de.bund.bva.pliscommon.serviceapi.core.aufrufkontext.AufrufKontextToHelper.java
/** * Ldt den ersten gefundenen {@link AufrufKontextTo} aus den Parametern der aufgerufenen Funktion. * //from w ww .j a v a 2s . c om * @param args * die Argumente der Service-Operation * * @return das AufrufKontextTo Objekt */ public static AufrufKontextTo leseAufrufKontextTo(Object[] args) { if (ArrayUtils.isNotEmpty(args)) { for (Object parameter : args) { if (parameter instanceof AufrufKontextTo) { return (AufrufKontextTo) parameter; } } } return null; }
From source file:cn.guoyukun.spring.jpa.entity.search.filter.SearchFilterHelper.java
/** * or?//from ww w . j av a 2 s .c o m * * @param first * @param others * @return */ public static SearchFilter or(SearchFilter first, SearchFilter... others) { OrCondition orCondition = new OrCondition(); orCondition.getOrFilters().add(first); if (ArrayUtils.isNotEmpty(others)) { orCondition.getOrFilters().addAll(Arrays.asList(others)); } return orCondition; }
From source file:mobile.util.jsonparam.config.FieldConfig.java
public FieldConfig(ConfigItem... values) { if (ArrayUtils.isNotEmpty(values)) { for (ConfigItem t : values) { set(t); } } }
From source file:jease.site.Authorizations.java
/** * Returns guarding Access object for given content or null, if content is * not guarded.//from www .java 2s . c o m */ public static Access[] getGuards(Content content) { if (content == null) { return null; } Map<Content, Access[]> cache = Database.query(accessByContent); if (!cache.containsKey(content)) { List<Access> allGuards = new ArrayList<>(); Access[] accessGuards = content.getGuards(Access.class); if (ArrayUtils.isNotEmpty(accessGuards)) { Collections.addAll(allGuards, accessGuards); } else { Reference[] referenceGuards = content.getGuards(Reference.class); if (ArrayUtils.isNotEmpty(referenceGuards)) { for (Reference reference : referenceGuards) { if (reference.getContent() instanceof Access) { allGuards.add((Access) reference.getContent()); } } } } cache.put(content, allGuards.toArray(new Access[allGuards.size()])); } List<Access> activeGuards = new ArrayList<>(); for (Access access : cache.get(content)) { if (access.isGuarding()) { activeGuards.add(access); } } if (!activeGuards.isEmpty()) { return activeGuards.toArray(new Access[activeGuards.size()]); } else { return getGuards((Content) content.getParent()); } }
From source file:co.runrightfast.vertx.core.eventbus.EventBusAddress.java
/** * Address format follows a URI path convention. * * e.g., eventBusAddress("path1","path2","path3") returns "/path1/path2/path3" * * * @param path REQUIRED/*w w w . j a v a 2s . co m*/ * @param paths OPTIONAL * @return eventbus address */ public static String eventBusAddress(final String path, final String... paths) { checkArgument(isNotBlank(path)); final StringBuilder sb = new StringBuilder(128).append('/').append(path); if (ArrayUtils.isNotEmpty(paths)) { checkArgument(!Arrays.stream(paths).filter(StringUtils::isBlank).findFirst().isPresent()); sb.append('/').append(String.join("/", paths)); } return sb.toString(); }
From source file:co.runrightfast.core.utils.ConfigUtils.java
static String configPath(final String name, final String... names) { checkArgument(StringUtils.isNotBlank(name)); if (ArrayUtils.isNotEmpty(names)) { return ConfigUtil.joinPath(ImmutableList.<String>builder().add(name).add(names).build()); }//from w w w. j a v a2s . co m return name; }
From source file:cn.guoyukun.spring.jpa.entity.search.filter.SearchFilterHelper.java
/** * and?//from ww w . j a v a2 s . co m * * @param first * @param others * @return */ public static SearchFilter and(SearchFilter first, SearchFilter... others) { AndCondition andCondition = new AndCondition(); andCondition.getAndFilters().add(first); if (ArrayUtils.isNotEmpty(others)) { andCondition.getAndFilters().addAll(Arrays.asList(others)); } return andCondition; }