当前位置: 首页>>代码示例>>Java>>正文


Java ArrayUtils.isNotEmpty方法代码示例

本文整理汇总了Java中org.apache.commons.lang3.ArrayUtils.isNotEmpty方法的典型用法代码示例。如果您正苦于以下问题:Java ArrayUtils.isNotEmpty方法的具体用法?Java ArrayUtils.isNotEmpty怎么用?Java ArrayUtils.isNotEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.lang3.ArrayUtils的用法示例。


在下文中一共展示了ArrayUtils.isNotEmpty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: create

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,代码来源:PageContentBuilder.java

示例2: create

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,代码来源:DAMAssetContentBuilder.java

示例3: makeDescribeDBInstancesResult

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<DBInstance> dbInstances = new ArrayList<DBInstance>();
  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,代码来源:RdsClientTest.java

示例4: token

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,代码来源:AuthResource.java

示例5: makeDescribeInstanceHealthResult

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<InstanceState> instanceStates = new ArrayList<InstanceState>();
    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,代码来源:ElbClientTest.java

示例6: makeDBInstanceWithParamGroups

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<DBParameterGroupStatus> paramGroups = new ArrayList<DBParameterGroupStatus>();
    for (String paramGroupName : paramGroupNames)
    {
      paramGroups.add(makeDBParameterGroupStatus(paramGroupName, parameterApplyStatus));
    }
    dbInstance.setDBParameterGroups(paramGroups);
  }
  return dbInstance;
}
 
开发者ID:Nike-Inc,项目名称:bluegreen-manager,代码行数:20,代码来源:RdsAnalyzerTest.java

示例7: serialize

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<String, String> 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,代码来源:GraphicsSerializer.java

示例8: valuesOf

import org.apache.commons.lang3.ArrayUtils; //导入方法依赖的package包/类
public static <T extends Enum<T>> Set<T> valuesOf(Class<T> enumClass, String[] enumNameArray, T[] defaultEnumArray) {
    final Set<T> enumSet = new LinkedHashSet<T>();
    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,代码来源:GaEnumUtils.java

示例9: makeDBInstanceWithSecurityGroups

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<VpcSecurityGroupMembership> securityGroups = new ArrayList<VpcSecurityGroupMembership>();
    for (String securityGroupId : securityGroupIds)
    {
      securityGroups.add(makeVpcSecurityGroupMembership(securityGroupId));
    }
    dbInstance.setVpcSecurityGroups(securityGroups);
  }
  return dbInstance;
}
 
开发者ID:Nike-Inc,项目名称:bluegreen-manager,代码行数:19,代码来源:RdsAnalyzerTest.java

示例10: toJson

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,代码来源:JsonUtil.java

示例11: takeFullScreenshot

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,代码来源:HeadlessDriverUtils.java

示例12: setValue

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,代码来源:CategoryGraphics.java

示例13: logArguments

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,代码来源:AuthenticationServiceAspect.java

示例14: postHandle

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<String, Cookie> 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,代码来源:CookieInterceptor.java

示例15: initTestData

import org.apache.commons.lang3.ArrayUtils; //导入方法依赖的package包/类
private void initTestData(TestContext testContext) {
    List<String> sqlFiles = new ArrayList<String>();
    /**
     * 读取测试类指定的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);
    }
}
 
开发者ID:warlock-china,项目名称:wisp,代码行数:33,代码来源:UnitTestTransactionalTestExecutionListener.java


注:本文中的org.apache.commons.lang3.ArrayUtils.isNotEmpty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。