Java Code Examples for org.osgl.util.C#list()

The following examples show how to use org.osgl.util.C#list() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TypedClasses.java    From java-di with Apache License 2.0 6 votes vote down vote up
@Provides
public static TypedElementLoader typedElementLoader() {
    return new TypedElementLoader() {
        @Override
        protected List<Class> load(Class type, boolean loadNonPublic, boolean loadAbstract, boolean loadRoot) {
            if (type == Base.class) {
                List<Class> list = (List) C.newList(Derived.class);
                if (loadNonPublic) {
                    list.add(NonPublicDerived.class);
                }
                if (loadAbstract) {
                    list.add(AbstractDerived.class);
                }
                if (loadRoot) {
                    list.add(Base.class);
                }
                return list;
            }
            return C.list();
        }
    };
}
 
Example 2
Source File: EventBus.java    From actframework with Apache License 2.0 6 votes vote down vote up
private void _emit(Key key, ConcurrentMap<Key, List<SimpleEventListener>> listeners, boolean async) {
    final List<SimpleEventListener> list = listeners.get(key);
    if (null == list) {
        return;
    }
    final Object[] args = key.args;
    JobManager jobManager = async ? app().jobManager() : null;
    for (final SimpleEventListener listener: C.list(list)) {
        if (async) {
            jobManager.now(new Runnable() {
                @Override
                public void run() {
                    callOn(listener, args);
                }
            });
        } else {
            callOn(listener, args);
        }
    }
}
 
Example 3
Source File: DataPropertyRepository.java    From actframework with Apache License 2.0 6 votes vote down vote up
private List<S.Pair> propertyListOf(Class<?> c, Set<Class<?>> circularReferenceDetector, Map<String, Class> typeImplLookup) {
    if (null == typeImplLookup) {
        typeImplLookup = Generics.buildTypeParamImplLookup(c);
    } else {
        typeImplLookup.putAll(Generics.buildTypeParamImplLookup(c));
    }
    if (circularReferenceDetector.contains(c)) {
        return C.list();
    }
    circularReferenceDetector.add(c);
    try {
        return buildPropertyList(c, circularReferenceDetector, typeImplLookup);
    } finally {
        circularReferenceDetector.remove(c);
    }
}
 
Example 4
Source File: MailerConfig.java    From actframework with Apache License 2.0 5 votes vote down vote up
private List<InternetAddress> getEmailListConfig(String key, Map<String, String> properties) {
    String s = getProperty(key, properties);
    if (S.blank(s)) {
        return C.list();
    }
    List<InternetAddress> l = new ArrayList<>();
    return MailerContext.canonicalRecipients(l, s);
}
 
Example 5
Source File: Gh1117.java    From actframework with Apache License 2.0 5 votes vote down vote up
/**
 * Note the issue only occur when executing CLI command and it has to be manually verified.
 */
@GetAction
@PropertySpec("-bar")
@Command("gh1117")
public Iterable<Foo> test() {
    return C.list(new Foo());
}
 
Example 6
Source File: TableCursor.java    From actframework with Apache License 2.0 5 votes vote down vote up
private List get() {
    int history = pageSize * pageNo++;
    if (history >= data.size()) {
        return C.list();
    }
    return C.list(data).drop(history).take(pageSize);
}
 
Example 7
Source File: LangTest.java    From java-tool with Apache License 2.0 5 votes vote down vote up
@Test
public void testPredicateOr() {
    C.List<String> l = C.list("a.xml", "b.html", "c.txt", "d.txt");
    l = l.filter(S.F.endsWith(".xml").or(S.F.endsWith(".html")));
    yes(l.contains("a.xml"));
    yes(l.contains("b.html"));
    no(l.contains("c.txt"));
    no(l.contains("d.txt"));
}
 
Example 8
Source File: BooleanArrayActionParameterBindingTest.java    From actframework with Apache License 2.0 4 votes vote down vote up
@Override
protected List<Boolean> nonEmptyList() {
    return C.list(true, false, true, true);
}
 
Example 9
Source File: ShortArrayActionParameterBindingTest.java    From actframework with Apache License 2.0 4 votes vote down vote up
@Override
protected List<Short> nonEmptyList() {
    return C.list(x(-1), x(0), x(-1), x(126));
}
 
Example 10
Source File: ControllerClassMetaInfo.java    From actframework with Apache License 2.0 4 votes vote down vote up
public List<String> withList() {
    return C.list(withList);
}
 
Example 11
Source File: FilteredTreeNode.java    From actframework with Apache License 2.0 4 votes vote down vote up
public FilteredTreeNode(TreeNode root, TreeNodeFilter filter) {
    this(C.<TreeNode>list(), root, filter);
}
 
Example 12
Source File: Ends.java    From actframework with Apache License 2.0 4 votes vote down vote up
@Override
protected List<String> aliases() {
    return C.list("endsWith", "end", "endWith");
}
 
Example 13
Source File: SourceInfoAvailableActAppException.java    From actframework with Apache License 2.0 4 votes vote down vote up
@Override
public List<String> lines() {
    return null == srcInfo ? C.<String>list() : srcInfo.lines();
}
 
Example 14
Source File: FloatArrayActionParameterBindingTest.java    From actframework with Apache License 2.0 4 votes vote down vote up
@Override
protected List<Float> nonEmptyList() {
    return C.list(-1.01F, 0.0F, -1.01F, Float.MAX_VALUE, Float.MIN_VALUE);
}
 
Example 15
Source File: GroupInterceptorMetaInfo.java    From actframework with Apache License 2.0 4 votes vote down vote up
public C.List<InterceptorMethodMetaInfo> finallyList() {
    return C.list(finallyList);
}
 
Example 16
Source File: IntArrayActionParameterBindingTest.java    From actframework with Apache License 2.0 4 votes vote down vote up
@Override
protected List<Integer> nonEmptyList() {
    return C.list(-1, 0, -1, 126);
}
 
Example 17
Source File: StartsIgnoreCase.java    From actframework with Apache License 2.0 4 votes vote down vote up
@Override
protected List<String> aliases() {
    return C.list("startsWithIgnoreCase", "startIgnoreCase", "startWithIgnoreCase");
}
 
Example 18
Source File: BigIntegerArrayActionParameterBindingTest.java    From actframework with Apache License 2.0 4 votes vote down vote up
@Override
protected List<BigInteger> nonEmptyList() {
    return C.list(b(-1), b(0), b(-1), b(123421421));
}
 
Example 19
Source File: Starts.java    From actframework with Apache License 2.0 4 votes vote down vote up
@Override
protected List<String> aliases() {
    return C.list("startsWith", "start", "startWith");
}
 
Example 20
Source File: GroupInterceptorMetaInfo.java    From actframework with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("unchecked")
public C.List<CatchMethodMetaInfo> catchList() {
    return C.list((List) catchList);
}