本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
}
示例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;
}
示例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;
}
示例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 "";
}
示例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);
}
示例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)};
}
}
}
示例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());
}
}
}
示例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);
}
示例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);
}
}