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


Java ArrayUtils.contains方法代码示例

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


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

示例1: WeightedSegmentsFormatter

import org.apache.commons.lang3.ArrayUtils; //导入方法依赖的package包/类
public WeightedSegmentsFormatter(final String[] args) {
    if (args != null) {
        prependPriority = ArrayUtils.contains(args, "-pp") || ArrayUtils.contains(args, "-prependPriority");

        int index1 = ArrayUtils.indexOf(args, "-weight");
        if (index1 < args.length - 1) {
            final String weightString = args[index1 + 1];
            Validate.isTrue(NumberUtils.isParsable(weightString), "Please provide a numeric value for weight.");
            this.weight = Integer.parseInt(weightString);
        }

        int index2 = ArrayUtils.indexOf(args, "-separator");
        if (index2 < args.length - 1) {
            valueSeparator = args[index2 + 1];
        }
    }
}
 
开发者ID:KayLerch,项目名称:alexa-utterance-generator,代码行数:18,代码来源:WeightedSegmentsFormatter.java

示例2: permitted

import org.apache.commons.lang3.ArrayUtils; //导入方法依赖的package包/类
public PermissionInfo permitted() {
    Subject currentUser = SecurityUtils.getSubject();
    if (TYPE.ROLE.equals(this.type)) {
        // role based
        if (Logical.AND.equals(this.logical)) {
            isPermitted = currentUser.hasAllRoles(Arrays.asList(roles));
            return this;
        }
        isPermitted = ArrayUtils.contains(currentUser.hasRoles(Arrays.asList(roles)), true);
        return this;
    }
    // permission based
    if (Logical.AND.equals(this.logical)) {
        isPermitted = currentUser.isPermittedAll(permissions);
        return this;
    }
    isPermitted = ArrayUtils.contains(currentUser.isPermitted(permissions), true);
    return this;
}
 
开发者ID:WhatAKitty,项目名称:spark-project,代码行数:20,代码来源:PermissionInfo.java

示例3: handle

import org.apache.commons.lang3.ArrayUtils; //导入方法依赖的package包/类
@Override
public CompletableFuture<Response> handle(Command command, Arguments arguments, Response response, IDebugAdapterContext context) {
    if (context.getDebugSession() == null) {
        return AdapterUtils.createAsyncErrorResponse(response, ErrorCode.EMPTY_DEBUG_SESSION, "Empty debug session.");
    }

    String[] filters = ((SetExceptionBreakpointsArguments) arguments).filters;
    try {
        boolean notifyCaught = ArrayUtils.contains(filters, Types.ExceptionBreakpointFilter.CAUGHT_EXCEPTION_FILTER_NAME);
        boolean notifyUncaught = ArrayUtils.contains(filters, Types.ExceptionBreakpointFilter.UNCAUGHT_EXCEPTION_FILTER_NAME);

        context.getDebugSession().setExceptionBreakpoints(notifyCaught, notifyUncaught);
        return CompletableFuture.completedFuture(response);
    } catch (Exception ex) {
        return AdapterUtils.createAsyncErrorResponse(response, ErrorCode.SET_EXCEPTIONBREAKPOINT_FAILURE,
                String.format("Failed to setExceptionBreakpoints. Reason: '%s'", ex.toString()));
    }
}
 
开发者ID:Microsoft,项目名称:java-debug,代码行数:19,代码来源:SetExceptionBreakpointsRequestHandler.java

示例4: getRandomSoundFromCategories

import org.apache.commons.lang3.ArrayUtils; //导入方法依赖的package包/类
/**
 * Returns a random sound from one or more categories
 */
public SoundEventAccessorComposite getRandomSoundFromCategories(SoundCategory... categories)
{
    List<SoundEventAccessorComposite> list = Lists.<SoundEventAccessorComposite>newArrayList();

    for (ResourceLocation resourcelocation : this.sndRegistry.getKeys())
    {
        SoundEventAccessorComposite soundeventaccessorcomposite = (SoundEventAccessorComposite)this.sndRegistry.getObject(resourcelocation);

        if (ArrayUtils.contains(categories, soundeventaccessorcomposite.getSoundCategory()))
        {
            list.add(soundeventaccessorcomposite);
        }
    }

    if (list.isEmpty())
    {
        return null;
    }
    else
    {
        return (SoundEventAccessorComposite)list.get((new Random()).nextInt(list.size()));
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:27,代码来源:SoundHandler.java

示例5: createAttributeCache

import org.apache.commons.lang3.ArrayUtils; //导入方法依赖的package包/类
private AttributeCache createAttributeCache(final String cacheType, final long maxCachedIntervalMinutes,
        final String zoneName, final RedisTemplate<String, String> cacheRedisTemplate,
        final BiFunction<String, String, String> getKey, final boolean enableAttributeCaching) {
    String[] profiles = environment.getActiveProfiles();

    if (!enableAttributeCaching) {
        LOGGER.info("Caching disabled for {} attributes.", cacheType);
        return new NonCachingAttributeCache();
    }
    if (ArrayUtils.contains(profiles, "redis") || ArrayUtils.contains(profiles, "cloud-redis")) {
        LOGGER.info("Redis caching enabled for {} attributes.", cacheType);
        return new RedisAttributeCache(maxCachedIntervalMinutes, zoneName, getKey, cacheRedisTemplate);
    }
    LOGGER.info("In-memory caching enabled for {} attributes.", cacheType);
    return new InMemoryAttributeCache(maxCachedIntervalMinutes, zoneName, getKey);
}
 
开发者ID:eclipse,项目名称:keti,代码行数:17,代码来源:AttributeCacheFactory.java

示例6: propertiesToStringMap

import org.apache.commons.lang3.ArrayUtils; //导入方法依赖的package包/类
private static Map<String, String> propertiesToStringMap(final Properties properties) {
    final Map<String, String> map = new HashMap<String, String>();
    for (String key : properties.stringPropertyNames()) {

        // 过滤掉受保护的key
        if (ArrayUtils.contains(PROTECT_KEY_ARRAY, key)
                && map.containsKey(key)) {
            continue;
        }

        map.put(key, properties.getProperty(key));
    }
    return map;
}
 
开发者ID:alibaba,项目名称:jvm-sandbox,代码行数:15,代码来源:CoreConfigure.java

示例7: escapeRegChars

import org.apache.commons.lang3.ArrayUtils; //导入方法依赖的package包/类
/**
 * 将除了指定字符之外的所有正则元字符全部用转义符更改为字面含义
 * @param key
 * @param
 * @return
 */
public static String escapeRegChars(String key, char[] keeps) {
    for(char c:REGEXP_KEY_CHARS){
        if(!ArrayUtils.contains(keeps, c)){
            key=key.replace(String.valueOf(c),"\\"+c);
        }
    }
    return key;
}
 
开发者ID:liaojiacan,项目名称:zkAdmin,代码行数:15,代码来源:RegexpUtils.java

示例8: getContentInfo

import org.apache.commons.lang3.ArrayUtils; //导入方法依赖的package包/类
/**
 * 创建Content基本信息.
 */
private ContentInfo getContentInfo(String contentPath) {
    ContentInfo contentInfo = new ContentInfo();

    String realFilePath = this.findRealFilePath(contentPath);
    logger.debug("realFilePath {}", realFilePath);

    File file = new File(realFilePath);

    contentInfo.setFile(file);
    contentInfo.setContentPath(contentPath);
    contentInfo.setFileName(file.getName());
    contentInfo.setLength((int) file.length());

    contentInfo.setLastModified(file.lastModified());
    contentInfo.setEtag("W/\"" + contentInfo.lastModified + "\"");

    contentInfo.setMimeType(mimetypesFileTypeMap
            .getContentType(contentInfo.fileName));

    if ((contentInfo.length >= GZIP_MINI_LENGTH)
            && ArrayUtils.contains(GZIP_MIME_TYPES,
                    contentInfo.getMimeType())) {
        contentInfo.setNeedGzip(true);
    } else {
        contentInfo.setNeedGzip(false);
    }

    return contentInfo;
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:33,代码来源:StaticContentFilter.java

示例9: filterServerResponseHeader

import org.apache.commons.lang3.ArrayUtils; //导入方法依赖的package包/类
@Override
protected String filterServerResponseHeader(final HttpServletRequest clientRequest, final Response serverResponse, final String headerName,
		final String headerValue) {
	// Filter some headers
	final String lowerCase = StringUtils.lowerCase(headerName);
	return ArrayUtils.contains(INGNORE_HEADERS, lowerCase)
			|| INGORE_HEADER_VALUE.containsKey(lowerCase) && headerValue.startsWith(INGORE_HEADER_VALUE.get(lowerCase)) ? null : headerValue;
}
 
开发者ID:ligoj,项目名称:bootstrap,代码行数:9,代码来源:BackendProxyServlet.java

示例10: checkParameters

import org.apache.commons.lang3.ArrayUtils; //导入方法依赖的package包/类
private void checkParameters(WxPayRefundRequest request) throws WxErrorException {
  BeanUtils.checkRequiredFields(request);

  if (StringUtils.isNotBlank(request.getRefundAccount())) {
    if (!ArrayUtils.contains(REFUND_ACCOUNT, request.getRefundAccount())) {
      throw new IllegalArgumentException("refund_account目前必须为" + Arrays.toString(REFUND_ACCOUNT) + "其中之一,实际值:" + request.getRefundAccount());
    }
  }

  if (StringUtils.isBlank(request.getOutTradeNo()) && StringUtils.isBlank(request.getTransactionId())) {
    throw new IllegalArgumentException("transaction_id 和 out_trade_no 不能同时为空,必须提供一个");
  }
}
 
开发者ID:11590692,项目名称:Wechat-Group,代码行数:14,代码来源:WxMpPayServiceImpl.java

示例11: urlReturnsCode

import org.apache.commons.lang3.ArrayUtils; //导入方法依赖的package包/类
public static BooleanSupplier urlReturnsCode(String url, int... codes) {
	return () -> {
		try {
			int responseCode = HttpClient.get(url).code();
			return ArrayUtils.contains(codes, responseCode);
		} catch (IOException x) {
			return false;
		}
	};
}
 
开发者ID:xtf-cz,项目名称:xtf,代码行数:11,代码来源:WaitUtil.java

示例12: validate

import org.apache.commons.lang3.ArrayUtils; //导入方法依赖的package包/类
private void validate() {
    super.validate(getRegisterCount());

    if (range == RegisterRange.COIL_STATUS || range == RegisterRange.INPUT_STATUS)
        throw new IllegalDataTypeException("Only binary values can be read from Coil and Input ranges");

    if (!ArrayUtils.contains(DATA_TYPES, dataType))
        throw new IllegalDataTypeException("Invalid data type");
}
 
开发者ID:dmitrykolesnikovich,项目名称:featurea,代码行数:10,代码来源:NumericLocator.java

示例13: hasColor

import org.apache.commons.lang3.ArrayUtils; //导入方法依赖的package包/类
@Override
protected boolean hasColor(ItemStack stack) {
	int[] ids = OreDictionary.getOreIDs(stack);
	for (int id : ids) {
		if (ArrayUtils.contains(PonySocks.dyeOreIds, id)) {
			return true;
		}
	}

	return false;
}
 
开发者ID:asiekierka,项目名称:PonySocks2,代码行数:12,代码来源:RecipeSockPaint.java

示例14: moveStacks

import org.apache.commons.lang3.ArrayUtils; //导入方法依赖的package包/类
public void moveStacks()
{
    for (int i = 0; i < getSlots(); i++)
    {
        if (!ArrayUtils.contains(destSlots, i))
        {
            ItemStack src = getStackInSlot(i);
            if (!src.isEmpty())
            {
                ItemStack remainder = moveStackToFirstDest(src);
                setStackInSlot(i, remainder);
            }
        }
    }
}
 
开发者ID:cubex2,项目名称:morefurnaces,代码行数:16,代码来源:ItemHandlerMoveStacks.java

示例15: hasCapability

import org.apache.commons.lang3.ArrayUtils; //导入方法依赖的package包/类
@Override
public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing facing)
{
    return capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY &&
           (facing == null || ArrayUtils.contains(supplier.sides, facing));
}
 
开发者ID:cubex2,项目名称:customstuff4,代码行数:7,代码来源:TileEntityModuleInventory.java


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