Java Code Examples for org.apache.commons.lang3.ArrayUtils#isEmpty()
The following examples show how to use
org.apache.commons.lang3.ArrayUtils#isEmpty() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultDisruptorConfig.java From disruptor-spring-manager with MIT License | 6 votes |
private void disruptorEventHandlerChain() { for(int i=0;i<eventHandlerChain.length;i++){ EventHandlerChain<T> eventHandlersChain = eventHandlerChain[i]; EventHandlerGroup<T> eventHandlerGroup = null; if(i == 0){ eventHandlerGroup = getDisruptor().handleEventsWith(eventHandlersChain.getCurrentEventHandlers()); }else{ eventHandlerGroup = getDisruptor().after(eventHandlersChain.getCurrentEventHandlers()); } if(! ArrayUtils.isEmpty(eventHandlersChain.getNextEventHandlers())){ eventHandlerGroup.then(eventHandlersChain.getNextEventHandlers()); } } getEventProcessorGraph(); }
Example 2
Source File: EquipInfoTab.java From pcgen with GNU Lesser General Public License v2.1 | 6 votes |
@Override protected Transferable createTransferable(JComponent c) { if (c == equipmentSetTable) { int[] rows = equipmentSetTable.getSelectedRows(); if (ArrayUtils.isEmpty(rows)) { return null; } EquipNode[] nodeArray = new EquipNode[rows.length]; for (int i = 0; i < nodeArray.length; i++) { nodeArray[i] = (EquipNode) equipmentSetTable.getModel().getValueAt(rows[i], 0); } return new EquipNodeSelection(nodeArray); } return super.createTransferable(c); }
Example 3
Source File: MembershipFacadeServiceImpl.java From EasyReport with Apache License 2.0 | 6 votes |
@Override public boolean hasPermission(final String roleIds, final String... codes) { if (this.isAdministrator(roleIds)) { return true; } if (StringUtils.isBlank(roleIds) || ArrayUtils.isEmpty(codes)) { return false; } final String permissionIds = this.roleService.getPermissionIds(roleIds); if (StringUtils.isBlank(permissionIds)) { return false; } final String[] permissionIdSplit = StringUtils.split(permissionIds, ','); final String codePermissionIds = this.permissionService.getPermissionIds(codes); final String[] codePermissionIdSplit = StringUtils.split(codePermissionIds, ','); return this.hasPermission(codePermissionIdSplit, permissionIdSplit); }
Example 4
Source File: LocaleTargetIdManager.java From engine with GNU General Public License v3.0 | 6 votes |
@Override public List<String> getAvailableTargetIds() { String[] availableTargetIds = SiteProperties.getAvailableTargetIds(); if (ArrayUtils.isEmpty(availableTargetIds)) { List<Locale> availableLocales = LocaleUtils.availableLocaleList(); List<String> availableLocaleStrs = new ArrayList<>(availableLocales.size()); for (Locale locale : availableLocales) { String localeStr = locale.toString(); // Ignore empty ROOT locale if (StringUtils.isNotEmpty(localeStr)) { availableLocaleStrs.add(StringUtils.lowerCase(localeStr)); } } return availableLocaleStrs; } else { return Arrays.asList(availableTargetIds); } }
Example 5
Source File: AbstractUploader.java From bird-java with MIT License | 5 votes |
/** * 设置文件处理器 * * @param handler 处理器 * @param suffixs 对应的文件后缀名集合 */ public synchronized void setFileHandler(IFileHandler handler, String... suffixs) { if (handler == null) return; if (ArrayUtils.isEmpty(suffixs)) return; if (fileHandlerMap == null) { fileHandlerMap = new HashMap<>(16); } for (String suffix : suffixs) { List<IFileHandler> handlers = fileHandlerMap.getOrDefault(suffix, new ArrayList<>()); handlers.add(handler); fileHandlerMap.put(suffix, handlers); } }
Example 6
Source File: StringUtil.java From disconf with Apache License 2.0 | 5 votes |
/** * 将一个byte数组转换成62进制的字符串。 * * @param bytes 二进制数组 * @param noCase 区分大小写 * * @return 62进制的字符串 */ public static String bytesToString(byte[] bytes, boolean noCase) { char[] digits = noCase ? DIGITS_NOCASE : DIGITS; int digitsLength = digits.length; if (ArrayUtils.isEmpty(bytes)) { return String.valueOf(digits[0]); } StringBuilder strValue = new StringBuilder(); int value = 0; int limit = Integer.MAX_VALUE >>> 8; int i = 0; do { while (i < bytes.length && value < limit) { value = (value << 8) + (0xFF & bytes[i++]); } while (value >= digitsLength) { strValue.append(digits[value % digitsLength]); value = value / digitsLength; } } while (i < bytes.length); if (value != 0 || strValue.length() == 0) { strValue.append(digits[value]); } return strValue.toString(); }
Example 7
Source File: Value.java From gsc-core with GNU Lesser General Public License v3.0 | 5 votes |
/** * @return */ public WitnessWrapper getWitness() { if (ArrayUtils.isEmpty(any)) { return null; } return new WitnessWrapper(any); }
Example 8
Source File: MetaIndexController.java From youran with Apache License 2.0 | 5 votes |
@Override @PutMapping(value = "/delete_batch") public ResponseEntity<Integer> deleteBatch(@RequestBody Integer[] indexId) { if (ArrayUtils.isEmpty(indexId)) { throw new BusinessException(ErrorCode.PARAM_IS_NULL); } int count = metaIndexService.delete(indexId); return ResponseEntity.ok(count); }
Example 9
Source File: LoggingHttpServletRequestWrapper.java From servlet-logging-filter with Apache License 2.0 | 5 votes |
@Override public Map<String, String[]> getParameterMap() { if (ArrayUtils.isEmpty(content) || this.parameterMap.isEmpty()) { return super.getParameterMap(); } return this.parameterMap; }
Example 10
Source File: ContainerGroupTableItems.java From cuba with Apache License 2.0 | 5 votes |
@Override public void groupBy(Object[] properties) { if (isGrouping) { return; } isGrouping = true; try { if (properties != null) { groupProperties = properties; if (!ArrayUtils.isEmpty(groupProperties)) { doGroup(); } else { roots = null; parents = null; children = null; groupItems = null; itemGroups = null; } } } finally { isGrouping = false; if (sortProperties != null && sortProperties.length > 0 && !hasGroups()) { super.sort(sortProperties, sortAscending); } } }
Example 11
Source File: AccountIndexStore.java From gsc-core with GNU Lesser General Public License v3.0 | 5 votes |
@Override public BytesWrapper get(byte[] key) { byte[] value = revokingDB.getUnchecked(key); if (ArrayUtils.isEmpty(value)) { return null; } return new BytesWrapper(value); }
Example 12
Source File: StringUtilities.java From ghidra with Apache License 2.0 | 5 votes |
/** * Returns true if all the given <code>searches</code> are contained in the given string, * ignoring case. * * @param toSearch the string to search * @param searches the strings to find * @return true if all the given <code>searches</code> are contained in the given string. */ public static boolean containsAllIgnoreCase(CharSequence toSearch, CharSequence... searches) { if (StringUtils.isEmpty(toSearch) || ArrayUtils.isEmpty(searches)) { return false; } for (CharSequence search : searches) { if (!StringUtils.containsIgnoreCase(toSearch, search)) { return false; } } return true; }
Example 13
Source File: MixSecret.java From beihu-boot with Apache License 2.0 | 5 votes |
public static byte[] mix(byte[] bytes) { try { if (ArrayUtils.isEmpty(bytes)) { return bytes; } int offset = offset((bytes.length)); int tailLength = bytes.length >> 1; int headLength = tailLength + (bytes.length & 1); int quarter = tailLength >> 2; byte[] headBytes = new byte[headLength]; byte[] tailBytes = new byte[tailLength]; int ri = 0; for (int i = 0; i < tailLength; i++) { headBytes[left_relocation_index(i, headLength, quarter)] = mix(bytes[ri], offset + ri); ri = ri | 1; tailBytes[right_relocation_index(i, tailLength, quarter)] = mix(bytes[ri], offset + ri); ri = ri + 1; } if ((bytes.length & 1) == 1) { headBytes[left_relocation_index(tailLength, headLength, quarter)] = mix(bytes[ri], offset + ri); } return BytesUtils.concat(headBytes, tailBytes); } catch (Exception e) { throw new IllegalArgumentException(""); } }
Example 14
Source File: JsonReport.java From sailfish-core with Apache License 2.0 | 5 votes |
private void createMessage(MessageLevel level, Throwable e, TextColor color, TextStyle style, String... messages) { assertState(ContextType.TESTCASE, ContextType.ACTION, ContextType.ACTIONGROUP); if (ArrayUtils.isEmpty(messages) && e == null) { throw new ScriptRunException("Message array is empty"); } getCurrentContextNode().addSubNodes(Arrays.stream(messages) .map(m -> new CustomMessage(m, Objects.toString(color, null), Objects.toString(style, null), level, e)) .collect(Collectors.toSet())); }
Example 15
Source File: CodeTemplateController.java From youran with Apache License 2.0 | 5 votes |
@Override @DeleteMapping public ResponseEntity<Integer> deleteBatch(@RequestBody Integer[] id) { if (ArrayUtils.isEmpty(id)) { throw new BusinessException(ErrorCode.PARAM_IS_NULL); } int count = codeTemplateService.delete(id); return ResponseEntity.ok(count); }
Example 16
Source File: MessageQueue.java From freehealth-connector with GNU Affero General Public License v3.0 | 4 votes |
public boolean isEmpty() { return ArrayUtils.isEmpty((Object[])this.queueFolder.list()); }
Example 17
Source File: Fulltexts.java From jease with GNU General Public License v3.0 | 4 votes |
/** * Checks if given content is available for public access. */ private static boolean isPublic(Content content) { return content.isVisible() && ArrayUtils.isEmpty(content.getParents(Trash.class)); }
Example 18
Source File: MessageContentUtil.java From peer-os with Apache License 2.0 | 4 votes |
public static void encryptContent( SecurityManager securityManager, String hostIdSource, String hostIdTarget, Message message ) { OutputStream os = message.getContent( OutputStream.class ); CachedStream cs = new CachedStream(); message.setContent( OutputStream.class, cs ); message.getInterceptorChain().doIntercept( message ); LOG.debug( String.format( "Encrypting IDs: %s -> %s", hostIdSource, hostIdTarget ) ); try { cs.flush(); CachedOutputStream csnew = ( CachedOutputStream ) message.getContent( OutputStream.class ); byte[] originalMessage = org.apache.commons.io.IOUtils.toByteArray( csnew.getInputStream() ); LOG.debug( String.format( "Original payload: \"%s\"", new String( originalMessage ) ) ); csnew.flush(); org.apache.commons.io.IOUtils.closeQuietly( cs ); org.apache.commons.io.IOUtils.closeQuietly( csnew ); //do something with original message to produce finalMessage byte[] finalMessage = originalMessage.length > 0 ? encryptData( securityManager, hostIdTarget, originalMessage ) : null; if ( !ArrayUtils.isEmpty( finalMessage ) ) { InputStream replaceInStream = new ByteArrayInputStream( finalMessage ); org.apache.commons.io.IOUtils.copy( replaceInStream, os ); replaceInStream.close(); org.apache.commons.io.IOUtils.closeQuietly( replaceInStream ); os.flush(); message.setContent( OutputStream.class, os ); } org.apache.commons.io.IOUtils.closeQuietly( os ); } catch ( Exception ioe ) { throw new ActionFailedException( "Error encrypting content", ioe ); } }
Example 19
Source File: ContractEventParserAbi.java From gsc-core with GNU Lesser General Public License v3.0 | 4 votes |
/** * parse Event Data into map<String, Object> If parser failed, then return {"0", * Hex.toHexString(data)} Only support basic solidity type, String, Bytes. Fixed Array or dynamic * Array are not support yet (then return {"0": Hex.toHexString(data)}). */ public static Map<String, String> parseEventData(byte[] data, List<byte[]> topicList, ABI.Entry entry) { Map<String, String> map = new HashMap<>(); if (ArrayUtils.isEmpty(data)) { return map; } // in case indexed topics doesn't match if (!topicsMatched(topicList, entry)) { map.put("" + (topicList.size() - 1), Hex.toHexString(data)); return map; } // the first is the signature. List<ABI.Entry.Param> list = entry.getInputsList(); Integer startIndex = 0; try { // this one starts from the first position. int index = 0; for (Integer i = 0; i < list.size(); ++i) { ABI.Entry.Param param = list.get(i); if (param.getIndexed()) { continue; } if (startIndex == 0) { startIndex = i; } String str = parseDataBytes(data, param.getType(), index++); if (StringUtils.isNotNullOrEmpty(param.getName())) { map.put(param.getName(), str); } map.put("" + i, str); } if (list.size() == 0) { map.put("0", Hex.toHexString(data)); } } catch (UnsupportedOperationException e) { logger.debug("Unsupported Operation Exception", e); map.clear(); map.put(startIndex.toString(), Hex.toHexString(data)); } return map; }
Example 20
Source File: ComMailingSendActionBasic.java From openemm with GNU Affero General Public License v3.0 | 4 votes |
private boolean isFilterActive(String[] filterTypes, MailingDependentType type) { return ArrayUtils.isEmpty(filterTypes) || ArrayUtils.contains(filterTypes, type.name()); }