大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。
Jetbrains全系列IDE稳定放心使用
本文整理匯總了Java中org.apache.commons.lang3.ArrayUtils.isNotEmpty方法的典型用法代碼示例。如果您正苦於以下問題:Java ArrayUtils.isNotEmpty方法的具體用法?Java ArrayUtils.isNotEmpty怎麽用?Java ArrayUtils.isNotEmpty使用的例子?那麽恭喜您, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.commons.lang3.ArrayUtils的用法示例。
在下文中一共展示了ArrayUtils.isNotEmpty方法的20個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於我們的係統推薦出更棒的Java代碼示例。
示例1: create
點讚 5
import org.apache.commons.lang3.ArrayUtils; //導入方法依賴的package包/類
@Override
public IndexEntry create(String path, @Nonnull ResourceResolver resolver) {
String[] indexRules = getIndexRules(PRIMARY_TYPE_VALUE);
if (ArrayUtils.isNotEmpty(indexRules)) {
PageManager pageManager = resolver.adaptTo(PageManager.class);
if (pageManager != null) {
Page page = pageManager.getPage(path);
if (page != null) {
IndexEntry ret = new IndexEntry(“idx”, “page”, path);
Resource res = page.getContentResource();
if (res != null) {
ret.addContent(getProperties(res, indexRules));
}
return ret;
}
}
}
else {
LOG.warn(“Could not load indexRules for ” + PRIMARY_TYPE_VALUE);
}
return null;
}
開發者ID:deveth0,項目名稱:elasticsearch-aem,代碼行數:23,
示例2: create
點讚 4
import org.apache.commons.lang3.ArrayUtils; //導入方法依賴的package包/類
@Override
public IndexEntry create(String path, @Nonnull ResourceResolver resolver) {
String[] indexRules = getIndexRules(PRIMARY_TYPE_VALUE);
if (ArrayUtils.isNotEmpty(indexRules)) {
Resource res = resolver.getResource(path);
if (res != null) {
Asset asset = res.adaptTo(Asset.class);
if (asset != null) {
IndexEntry ret = new IndexEntry(“idx”, “asset”, path);
ret.addContent(getProperties(res, indexRules));
return ret;
}
LOG.error(“Could not adapt asset”);
}
}
return null;
}
開發者ID:deveth0,項目名稱:elasticsearch-aem,代碼行數:18,
示例3: makeDescribeDBInstancesResult
點讚 3
import org.apache.commons.lang3.ArrayUtils; //導入方法依賴的package包/類
/**
* Test helper – makes describe result with a named instance.
*/
private DescribeDBInstancesResult makeDescribeDBInstancesResult(String… instanceNames)
{
DescribeDBInstancesResult result = new DescribeDBInstancesResult();
List dbInstances = new ArrayList();
if (ArrayUtils.isNotEmpty(instanceNames))
{
for (String instanceName : instanceNames)
{
DBInstance dbInstance = new DBInstance();
dbInstance.setDBInstanceIdentifier(instanceName);
dbInstances.add(dbInstance);
}
}
result.setDBInstances(dbInstances);
return result;
}
開發者ID:Nike-Inc,項目名稱:bluegreen-manager,代碼行數:20,
示例4: token
點讚 3
import org.apache.commons.lang3.ArrayUtils; //導入方法依賴的package包/類
@POST
@Path(“token”)
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
public Response token(Authentication auth) throws RemotingConnectException, RemotingSendRequestException, RemotingTimeoutException, InterruptedException {
String entity = ErrorCode.NOT_AUTHED.toString();
NettyRemotingClient client = RPCServices.getAuthService();
RemotingCommand request = RemotingCommand.createRequestCommand();
byte[] body = JsonUtil.toBytes(auth);
request.setBody(body);
request.getExtFields().put(“action”, “token”);
RemotingCommand responce = client.invokeSync(request);
if (ArrayUtils.isNotEmpty(responce.getBody())) {
entity = JsonUtil.toJson(responce.getBody());
}
return ResponseUtil.defaultRes(entity);
}
開發者ID:jiumao-org,項目名稱:wechat-mall,代碼行數:18,
示例5: makeDescribeInstanceHealthResult
點讚 3
import org.apache.commons.lang3.ArrayUtils; //導入方法依賴的package包/類
/**
* Test helper – makes describe result with one or more named instances.
*/
private DescribeInstanceHealthResult makeDescribeInstanceHealthResult(String… instanceIds)
{
DescribeInstanceHealthResult result = new DescribeInstanceHealthResult();
if (ArrayUtils.isNotEmpty(instanceIds))
{
List instanceStates = new ArrayList();
for (String instanceId : instanceIds)
{
InstanceState instanceState = new InstanceState();
instanceState.setInstanceId(instanceId);
instanceStates.add(instanceState);
}
result.setInstanceStates(instanceStates);
}
return result;
}
開發者ID:Nike-Inc,項目名稱:bluegreen-manager,代碼行數:20,
示例6: makeDBInstanceWithParamGroups
點讚 3
import org.apache.commons.lang3.ArrayUtils; //導入方法依賴的package包/類
/**
* Test helper – makes a DBInstance having the specified paramgroup names.
*/
private DBInstance makeDBInstanceWithParamGroups(RdsParameterApplyStatus parameterApplyStatus,
String… paramGroupNames)
{
DBInstance dbInstance = new DBInstance();
dbInstance.setDBInstanceIdentifier(INSTANCE_NAME);
if (ArrayUtils.isNotEmpty(paramGroupNames))
{
Collection paramGroups = new ArrayList();
for (String paramGroupName : paramGroupNames)
{
paramGroups.add(makeDBParameterGroupStatus(paramGroupName, parameterApplyStatus));
}
dbInstance.setDBParameterGroups(paramGroups);
}
return dbInstance;
}
開發者ID:Nike-Inc,項目名稱:bluegreen-manager,代碼行數:20,
示例7: serialize
點讚 3
import org.apache.commons.lang3.ArrayUtils; //導入方法依賴的package包/類
@Override
public void serialize(T graphics, JsonGenerator jgen, SerializerProvider sp)
throws IOException, JsonProcessingException {
jgen.writeObjectField(“type”, graphics.getClass().getSimpleName());
jgen.writeObjectField(“uid”, graphics.getUid());
jgen.writeObjectField(“visible”, graphics.getVisible());
jgen.writeObjectField(“yAxis”, graphics.getYAxis());
jgen.writeObjectField(“hasClickAction”, graphics.hasClickAction());
if(StringUtils.isNotEmpty(graphics.getClickTag())) {
jgen.writeObjectField(“clickTag”, graphics.getClickTag());
}
Map keyTags = graphics.getKeyTags();
if(keyTags != null && !keyTags.isEmpty()) {
jgen.writeObjectField(“keyTags”, keyTags);
}
Object[] keys = graphics.getKeys();
if(ArrayUtils.isNotEmpty(keys)) {
jgen.writeObjectField(“keys”, keys);
}
}
開發者ID:twosigma,項目名稱:beaker-notebook-archive,代碼行數:21,
示例8: valuesOf
點讚 3
import org.apache.commons.lang3.ArrayUtils; //導入方法依賴的package包/類
public static > Set valuesOf(Class enumClass, String[] enumNameArray, T[] defaultEnumArray) {
final Set enumSet = new LinkedHashSet();
if (ArrayUtils.isNotEmpty(enumNameArray)) {
for (final String enumName : enumNameArray) {
final T enumValue = EnumUtils.getEnum(enumClass, enumName);
if (null != enumValue) {
enumSet.add(enumValue);
}
}
}
if (CollectionUtils.isEmpty(enumSet)
&& ArrayUtils.isNotEmpty(defaultEnumArray)) {
Collections.addAll(enumSet, defaultEnumArray);
}
return enumSet;
}
開發者ID:alibaba,項目名稱:jvm-sandbox,代碼行數:17,
示例9: makeDBInstanceWithSecurityGroups
點讚 3
import org.apache.commons.lang3.ArrayUtils; //導入方法依賴的package包/類
/**
* Test helper – makes a DBInstance having the specified security group names.
*/
private DBInstance makeDBInstanceWithSecurityGroups(String… securityGroupIds)
{
DBInstance dbInstance = new DBInstance();
dbInstance.setDBInstanceIdentifier(INSTANCE_NAME);
if (ArrayUtils.isNotEmpty(securityGroupIds))
{
List securityGroups = new ArrayList();
for (String securityGroupId : securityGroupIds)
{
securityGroups.add(makeVpcSecurityGroupMembership(securityGroupId));
}
dbInstance.setVpcSecurityGroups(securityGroups);
}
return dbInstance;
}
開發者ID:Nike-Inc,項目名稱:bluegreen-manager,代碼行數:19,
示例10: toJson
點讚 2
import org.apache.commons.lang3.ArrayUtils; //導入方法依賴的package包/類
/**
* 直接解析json
*/
public static String toJson(final byte[] data) {
if (ArrayUtils.isNotEmpty(data)) {
return new String(data, Charset.forName(“UTF-8”));
}
return “”;
}
開發者ID:jiumao-org,項目名稱:wechat-mall,代碼行數:10,
示例11: takeFullScreenshot
點讚 2
import org.apache.commons.lang3.ArrayUtils; //導入方法依賴的package包/類
public static void takeFullScreenshot(WebDriver webDriver, File pngFile, By… highlights)
throws IOException {
final PageSnapshot pageSnapshot = Shutterbug.shootPage(webDriver, BOTH_DIRECTIONS);
if (ArrayUtils.isNotEmpty(highlights)) {
Arrays.stream(highlights)
.map(webDriver::findElements)
.flatMap(Collection::stream)
.forEach(pageSnapshot::highlight);
}
FileUtils.forceMkdirParent(pngFile);
pageSnapshot.withName(pngFile.getName());
pageSnapshot.save(pngFile.getParent());
FileUtils.deleteQuietly(pngFile);
FileUtils.moveFile(new File(pngFile.getPath() + “.png”), pngFile);
}
開發者ID:ldaume,項目名稱:headless-chrome,代碼行數:16,
示例12: setValue
點讚 2
import org.apache.commons.lang3.ArrayUtils; //導入方法依賴的package包/類
public void setValue(Object[] value) {
if(value != null && ArrayUtils.isNotEmpty(value)){
if(value[0] instanceof List){
this.value = new Number[value.length][];
for(int i=0; i < value.length; i++){
List> a = (List>)value[i];
this.value[i] = a.toArray(new Number[a.size()]);
}
}else{
this.value = new Number[][]{Arrays.copyOf(value, value.length, Number[].class)};
}
}
}
開發者ID:twosigma,項目名稱:beaker-notebook-archive,代碼行數:14,
示例13: logArguments
點讚 2
import org.apache.commons.lang3.ArrayUtils; //導入方法依賴的package包/類
private void logArguments(Object… arguments) {
if (ArrayUtils.isNotEmpty(arguments)) {
if (arguments[0] != null) {
RequestContext context = (RequestContext) arguments[0];
this.log.info(“Request: {}”, context.getExternalContext().getRequestParameterMap());
}
}
}
開發者ID:e-gov,項目名稱:TARA-Server,代碼行數:9,
示例14: postHandle
點讚 2
import org.apache.commons.lang3.ArrayUtils; //導入方法依賴的package包/類
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler,
ModelAndView modelAndView) throws Exception {
if (modelAndView!=null && ArrayUtils.isNotEmpty(request.getCookies())) {
HashMap cookieMap = new HashMap<>(1<<4);
for (Cookie ck : request.getCookies()) {
cookieMap.put(ck.getName(), ck);
}
modelAndView.addObject(“cookieMap”, cookieMap);
}
super.postHandle(request, response, handler, modelAndView);
}
開發者ID:wxz1211,項目名稱:dooo,代碼行數:15,
示例15: initTestData
點讚 2
import org.apache.commons.lang3.ArrayUtils; //導入方法依賴的package包/類
private void initTestData(TestContext testContext) {
List sqlFiles = new ArrayList();
/**
* 讀取測試類指定的sql文件
*/
Class> testClass = testContext.getTestClass();
SqlConfig sqlConfigInClass = testClass.getAnnotation(SqlConfig.class);
if (sqlConfigInClass != null) {
String[] sqlFilesInClass = sqlConfigInClass.sqlFiles();
if (ArrayUtils.isNotEmpty(sqlFilesInClass)) {
sqlFiles.addAll(Arrays.asList(sqlFilesInClass));
}
}
/**
* 讀取測試方法指定的sql文件
*/
Method method = testContext.getTestMethod();
SqlConfig sqlConfigInMethod = method.getAnnotation(SqlConfig.class);
if (sqlConfigInMethod != null) {
String[] sqlFilesInMethod = sqlConfigInMethod.sqlFiles();
if (ArrayUtils.isNotEmpty(sqlFilesInMethod)) {
sqlFiles.addAll(Arrays.asList(sqlFilesInMethod));
}
}
/**
* 執行sql
*/
for (String sqlFile : sqlFiles) {
LOGGER.info(String.format(“execute sql file [%s]”, sqlFile));
this.executeSqlScript(testContext, sqlFile, false);
}
}
示例16: printInputParams
點讚 2
import org.apache.commons.lang3.ArrayUtils; //導入方法依賴的package包/類
/**
* Gets join point input params description string.
*
* @param joinPoint aspect join point
* @param includeParamNames input parameters names to be printed. NOTE! can be overridden with @{@link
* LoggingAspectConfig}
* @return join point input params description string
*/
public static String printInputParams(JoinPoint joinPoint, String… includeParamNames) {
try {
if (joinPoint == null) {
return “joinPoint is null”;
}
Signature signature = joinPoint.getSignature();
if (!(signature instanceof MethodSignature)) {
return PRINT_EMPTY_LIST;
}
Optional config = AopAnnotationUtils.getConfigAnnotation(joinPoint);
String[] includeParams = includeParamNames;
String[] excludeParams = EMPTY_ARRAY;
boolean inputCollectionAware = LoggingAspectConfig.DEFAULT_INPUT_COLLECTION_AWARE;
if (config.isPresent()) {
if (!config.get().inputDetails()) {
return PRINT_HIDDEN;
}
inputCollectionAware = config.get().inputCollectionAware();
if (ArrayUtils.isNotEmpty(config.get().inputIncludeParams())) {
includeParams = config.get().inputIncludeParams();
}
if (ArrayUtils.isEmpty(includeParams) && ArrayUtils.isNotEmpty(config.get().inputExcludeParams())) {
excludeParams = config.get().inputExcludeParams();
}
}
MethodSignature ms = (MethodSignature) signature;
String[] params = ms.getParameterNames();
return ArrayUtils.isNotEmpty(params) ? renderParams(joinPoint,
params,
includeParams,
excludeParams,
inputCollectionAware) : PRINT_EMPTY_LIST;
} catch (IndexOutOfBoundsException | IllegalArgumentException e) {
log.warn(“Error while print params: {}, params = {}”, e, joinPoint.getArgs());
return “printerror: ” + e;
}
}
開發者ID:xm-online,項目名稱:xm-commons,代碼行數:51,
示例17: handleRequest
點讚 2
import org.apache.commons.lang3.ArrayUtils; //導入方法依賴的package包/類
@Override
public ApiGatewayResponse handleRequest(SNSEvent input, Context context) {
LOG.info(“Loading Gif Generator Java Lambda handler.”);
ObjectMapper mapper = new ObjectMapper();
if (CollectionUtils.isNotEmpty(input.getRecords())) {
try {
JsonNode json = mapper.readTree(input.getRecords().get(0).getSNS().getMessage());
byte[] gif = ArrayUtils.EMPTY_BYTE_ARRAY;
if (json.has(“emojiUrl”)) {
HttpClient client = HttpClientBuilder.create().build();
String emojiUrl = json.get(“emojiUrl”).asText();
HttpGet getImageRequest = new HttpGet(emojiUrl);
HttpResponse getImageResponse = client.execute(getImageRequest);
int getImageStatus = getImageResponse.getStatusLine().getStatusCode();
LOG.info(“Get image status: {}.”, getImageStatus);
if (StringUtils.contains(getImageResponse.getFirstHeader(HttpHeaders.CONTENT_TYPE).getValue(), “image”)) {
byte[] imageFile = IOUtils.toByteArray(getImageResponse.getEntity().getContent());
gif = GifGenerator.generateGif(imageFile);
} else {
LOG.error(“Given image URL did not return an image according to mime type!”);
}
}
if (ArrayUtils.isNotEmpty(gif)) {
LOG.info(“Gif created successfully, storing in S3.”);
String emoji = json.get(“text”).asText();
String emojiName = StringUtils.removeEnd(StringUtils.removeStart(StringUtils.strip(emoji), “:”), “:”);
emojiName = emojiName.replaceAll(“ä”, “a”).replaceAll(“ö”, “o”).replaceAll(“å”, “o”);
InputStream is = new ByteArrayInputStream(gif);
ObjectMetadata metadata = new ObjectMetadata();
metadata.setContentLength(gif.length);
metadata.setContentType(“image/gif”);
if (UrlValidator.getInstance().isValid(emojiName)) {
emojiName = CharMatcher.inRange(‘a’, ‘z’).or(CharMatcher.inRange(‘0’, ‘9’))
.retainFrom(StringUtils.substringAfterLast(emojiName, “/”));
}
String filenamePrefix = emojiName + “_approximated_”;
if (!S3.fileExistsInBucket(filenamePrefix)) {
S3.storeFileInBucket(filenamePrefix + System.currentTimeMillis() + “.gif”, is, metadata);
}
LOG.info(“Image stored in S3, publishing to topic s3-file-ready”);
SNS.publish(“s3-file-ready”, mapper.writeValueAsString(json)).get();
} else {
LOG.error(“Gif generator returned an empty byte array, sending error response”);
SNS.publish(“gif-generator-error”, mapper.writeValueAsString(json)).get();
}
} catch (IOException | InterruptedException | ExecutionException e) {
LOG.error(“Exception occured when creating GIF.”, e);
}
}
Response responseBody = new Response(“pprxmtr-gif-generator called.”, new HashMap<>());
return ApiGatewayResponse.builder().setStatusCode(200).setObjectBody(responseBody).build();
}
開發者ID:villeau,項目名稱:pprxmtr,代碼行數:63,
示例18: deployFromClasspath
點讚 2
import org.apache.commons.lang3.ArrayUtils; //導入方法依賴的package包/類
/**
* 部署classpath下麵的流程定義
*
* 從屬性配置文件中獲取屬性workflow.modules掃描**deployments**
*
*
* 然後從每個**deployments/${module}**查找在屬性配置文件中的屬性**workflow.module.keys.${
* submodule}**
*
* 配置實例:
*
*
* #workflow for deploy
* workflow.modules=budget,erp,oa
* workflow.module.keys.budget=budget
* workflow.module.keys.erp=acceptInsurance,billing,effectInsurance,endorsement,payment
* workflow.module.keys.oa=caruse,leave,officalstamp,officesupply,out,overtime
*
*
*
*
* @param processKey 流程定義KEY
* @throws Exception
*/
public void deployFromClasspath(String exportDir, String… processKey) throws Exception {
ResourceLoader resourceLoader = new DefaultResourceLoader();
String[] processKeys = {“leave”, “leave-dynamic-from”, “leave-formkey”, “dispatch”};
for (String loopProcessKey : processKeys) {
/*
* 需要過濾指定流程
*/
if (ArrayUtils.isNotEmpty(processKey)) {
if (ArrayUtils.contains(processKey, loopProcessKey)) {
logger.debug(“hit module of {}”, (Object[]) processKey);
deploySingleProcess(resourceLoader, loopProcessKey, exportDir);
} else {
logger.debug(“module: {} not equals process key: {}, ignore and continue find next.”, loopProcessKey, processKey);
}
} else {
/*
* 所有流程
*/
deploySingleProcess(resourceLoader, loopProcessKey, exportDir);
}
}
}
開發者ID:batizhao,項目名稱:microservice,代碼行數:48,
示例19: dispatch
點讚 2
import org.apache.commons.lang3.ArrayUtils; //導入方法依賴的package包/類
/**
* Message dispatcher logic.
*
* @param msg the msg
*/
public void dispatch(NotificationMessage msg) {
if (msg.getNsPath() == null) {
String nsPath = getNsPath(msg);
if (nsPath != null) {
msg.setNsPath(nsPath);
} else {
logger.error(“Can not figure out nsPath for msg ” + gson.toJson(msg));
return;
}
}
List subscribers = sbrService.getSubscribersForNs(msg.getNsPath());
try {
for (BasicSubscriber sub : subscribers) {
NotificationMessage nMsg = msg;
if (sub.hasFilter() && !sub.getFilter().accept(nMsg)) {
continue;
}
if (sub.hasTransformer()) {
nMsg = sub.getTransformer().transform(nMsg);
}
if (sub instanceof EmailSubscriber) {
eSender.postMessage(nMsg, sub);
} else if (sub instanceof SNSSubscriber) {
snsSender.postMessage(nMsg, sub);
} else if (sub instanceof URLSubscriber) {
if (sub.getFilter() instanceof NotificationFilter) {
NotificationFilter nFilter = NotificationFilter.class.cast(sub.getFilter());
if (nFilter.isIncludeCi() && ArrayUtils.isNotEmpty(nFilter.getClassNames())) {
final List ciIds = dpmtMapper
.getDeploymentRfcCIs(msg.getCmsId(), null, null, nFilter.getClassNames(),
nFilter.getActions())
.stream()
.map(rfc -> rfc.getCiId())
.collect(Collectors.toList());
if(ciIds.isEmpty()){
// There are no ci’s which sink is subscribed to , skip notifications.
continue;
}
final List cis = cmProcessor.getCiByIdList(ciIds).stream()
.map(ci -> cmsUtil.custCI2CISimple(ci, “df”)).collect(
Collectors.toList());
nMsg.setCis(cis);
}
}
if(logger.isDebugEnabled()){
logger.debug(“nMsg ” + gson.toJson(nMsg));
}
urlSender.postMessage(nMsg, sub);
} else if (sub instanceof XMPPSubscriber) {
xmppSender.postMessage(nMsg, sub);
} else if (sub instanceof SlackSubscriber) {
slackSender.postMessage(nMsg, sub);
}
}
} catch (Exception e) {
logger.error(“Message dispatching failed.”, e);
}
}
開發者ID:oneops,項目名稱:oneops,代碼行數:66,
示例20: convert
點讚 1
import org.apache.commons.lang3.ArrayUtils; //導入方法依賴的package包/類
@VisibleForTesting
NavigableMap convert(BigDecimal[][] quotes, Comparator c) {
NavigableMap map = new TreeMap<>(c);
if (ArrayUtils.isNotEmpty(quotes)) {
for (BigDecimal[] quote : quotes) {
if (quote.length != 2) {
continue;
}
if (quote[0] == null || quote[0].signum() == 0) {
continue;
}
if (quote[1] == null || quote[1].signum() == 0) {
continue;
}
map.put(quote[0], quote[1]);
}
}
return Collections.unmodifiableNavigableMap(map);
}
開發者ID:after-the-sunrise,項目名稱:cryptotrader,代碼行數:31,
注:本文中的org.apache.commons.lang3.ArrayUtils.isNotEmpty方法示例整理自Github/MSDocs等源碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。
发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/188052.html原文链接:https://javaforall.cn
【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛
【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...