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


Java Matchers类代码示例

本文整理汇总了Java中com.captainbern.reflection.matcher.Matchers的典型用法代码示例。如果您正苦于以下问题:Java Matchers类的具体用法?Java Matchers怎么用?Java Matchers使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: getObjectFor

import com.captainbern.reflection.matcher.Matchers; //导入依赖的package包/类
public static Object getObjectFor(PacketData packetData, final String param) {
    if (PACKET_DATA == null)
        PACKET_DATA = new Reflection().reflect(PacketData.class);

    List<SafeField<?>> fields = PACKET_DATA.getSafeFields(Matchers.withNameRegex(Pattern.compile("(" + param + ")", Pattern.CASE_INSENSITIVE)));

    if (fields.isEmpty())
        throw new IllegalArgumentException("Parameter: \'" + param + "\' does not appear to be valid!");

    return fields.get(0).getAccessor().get(packetData);
}
 
开发者ID:CaptainBern,项目名称:ProtoParser,代码行数:12,代码来源:Formatter.java

示例2: getObjectFor

import com.captainbern.reflection.matcher.Matchers; //导入依赖的package包/类
private Object getObjectFor(PacketData packetData, final String param) {
    if (PACKET_DATA == null)
        PACKET_DATA = new Reflection().reflect(PacketData.class);

    List<SafeField<?>> fields = PACKET_DATA.getSafeFields(Matchers.withNameRegex(Pattern.compile("(" + param + ")", Pattern.CASE_INSENSITIVE)));

    if (fields.isEmpty())
        throw new IllegalArgumentException("Parameter: \'" + param + "\' does not appear to be valid!");

    return fields.get(0).getAccessor().get(packetData);
}
 
开发者ID:CaptainBern,项目名称:ProtoParser,代码行数:12,代码来源:FormatTest.java

示例3: match

import com.captainbern.reflection.matcher.Matchers; //导入依赖的package包/类
protected static <T> List<T> match(final List<T> classes, final Matcher<? super T>... matchers) {
    if (classes.isEmpty()) {
        return classes;
    } else {
        List<T> elements = new ArrayList<>();
        Matcher<T> combinedMatcher = Matchers.combine(Arrays.asList(matchers));
        for(T clazz : classes) {
            if(combinedMatcher.matches(clazz)) {
                elements.add(clazz);
            }
        }
        return elements;
    }
}
 
开发者ID:CaptainBern,项目名称:Reflection,代码行数:15,代码来源:AbstractAccess.java

示例4: match

import com.captainbern.reflection.matcher.Matchers; //导入依赖的package包/类
public static <T> Set<T> match(final Set<T> classes, final Matcher<? super T>... matchers) {
    if(classes.isEmpty()) {
        return classes;
    } else {
        Set<T> elements = new HashSet<>();
        Matcher<T> combinedMatcher = Matchers.combine(Arrays.asList(matchers));
        for(T clazz : classes) {
            if(combinedMatcher.matches(clazz)) {
                elements.add(clazz);
            }
        }
        return elements;
    }
}
 
开发者ID:CaptainBern,项目名称:Reflection,代码行数:15,代码来源:ReflectionUtils.java


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