本文整理汇总了Java中org.osgl.util.C.newList方法的典型用法代码示例。如果您正苦于以下问题:Java C.newList方法的具体用法?Java C.newList怎么用?Java C.newList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.osgl.util.C
的用法示例。
在下文中一共展示了C.newList方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: managedFields
import org.osgl.util.C; //导入方法依赖的package包/类
public List<String> managedFields(String className) {
List<String> fields = managedFieldByClass.get(className);
if (null == fields) {
fields = C.newList();
Set<String> ss = storageFields();
for (String s: ss) {
if (s.startsWith(className + ":")) {
String fn = S.after(s, ":");
if (S.notEmpty(fn)) {
fields.add(fn);
}
}
}
managedFieldByClass.put(className, fields);
}
return fields;
}
示例2: toString
import org.osgl.util.C; //导入方法依赖的package包/类
@Override
public String toString() {
StringBuilder sb = S.builder(type());
if (S.notBlank(name)) {
sb.append("(").append(name).append(")");
}
C.List<Object> list = C.newList();
if (null != valueLoader) {
list.append(valueLoader);
} else {
list.append(qualifiers).append(elementLoaders).append(filters);
if (null != mapKey) {
list.append(mapKey);
}
}
if (null != scope) {
list.append(scope.getSimpleName());
}
if (!list.isEmpty()) {
sb.append("@[").append(S.join(", ", list)).append("]");
}
return sb.toString();
}
示例3: load
import org.osgl.util.C; //导入方法依赖的package包/类
@Override
public List<Integer> load(Map<String, Object> options, BeanSpec container, Genie genie) {
int max = toInt(options.get("max"));
int n1 = 1, n2 = 1, f;
List<Integer> list = C.newList();
list.add(n1);
list.add(n2);
for (;;) {
f = n1 + n2;
n1 = n2;
n2 = f;
if (f < max) {
list.add(f);
} else {
break;
}
}
return list;
}
示例4: typedElementLoader
import org.osgl.util.C; //导入方法依赖的package包/类
@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();
}
};
}
示例5: fetch
import org.osgl.util.C; //导入方法依赖的package包/类
@Override
public Iterable<MODEL_TYPE> fetch() {
C.List<MODEL_TYPE> list = C.newList();
QueryIterator<MODEL_TYPE> qi = findIterate();
while (qi.hasNext()) {
list.add(qi.next());
}
qi.close();
return list;
// we need to close the query iterable right now otherwise it hold the data connection forever
// return new Iterable<MODEL_TYPE>() {
// @Override
// public Iterator<MODEL_TYPE> iterator() {
// return findIterate();
// }
// };
}
示例6: permissions
import org.osgl.util.C; //导入方法依赖的package包/类
/**
*
* @return
*/
@Override
public List<? extends Permission> permissions() {
List<String> names = permissionNames();
if (names.isEmpty()) {
return C.list();
}
AAAContext aaa = AAA.context();
AAAPersistentService ps = aaa.getPersistentService();
List<Permission> perms = C.newList();
for (String name: names) {
Permission p = ps.findByName(name, Permission.class);
perms.add($.notNull(p));
}
return perms;
}
示例7: prepareJsonData
import org.osgl.util.C; //导入方法依赖的package包/类
protected Map<String, Object> prepareJsonData(List<$.T2<String, Object>> params) {
Map<String, Object> map = C.newMap();
if (null != params) {
for ($.T2<String, Object> pair : params) {
String key = pair._1;
Object val = pair._2;
if (map.containsKey(key)) {
List list;
Object x = map.get(key);
if (x instanceof List) {
list = $.cast(x);
} else {
list = C.newList(x);
map.put(key, list);
}
list.add(val);
} else {
map.put(key, val);
}
}
}
return map;
}
示例8: loadWords
import org.osgl.util.C; //导入方法依赖的package包/类
private static List<String> loadWords() {
URL url = Zen.class.getResource("/act_zen.txt");
List<String> words = C.newList(defaultWords());
if (null != url) {
try {
List<String> myWords = IO.readLines(url.openStream());
if (!myWords.isEmpty()) {
words = myWords;
}
} catch (Exception e) {
// ignore it
}
}
List<String> retVal = new ArrayList<>(words.size());
for (String s : words) {
if (s.contains("\n")) {
s = s.replaceAll("\n", "\n ");
} else if (s.contains("\\n")) {
s = s.replaceAll("\\\\n", "\n ");
}
retVal.add(s);
}
return retVal;
}
示例9: listSObjectFields
import org.osgl.util.C; //导入方法依赖的package包/类
@Command(value = "act.ss.list, act.ss.print", help = "List all storage field info")
@PropertySpec("className,fieldName,updatePolicy,serviceId,contextPath")
public Collection<FieldServiceInfo> listSObjectFields() {
Set<String> fields = ssm.storageFields();
C.List<FieldServiceInfo> l = C.newList();
for (String s : fields) {
l.add(new FieldServiceInfo(s));
}
return l.sorted();
}
示例10: filters
import org.osgl.util.C; //导入方法依赖的package包/类
private static C.List<FilterInfo> filters(Genie genie, BeanSpec spec) {
C.List<FilterInfo> list = C.newList();
Set<Annotation> annotations = spec.filters();
for (Annotation anno : annotations) {
Class<? extends Annotation> annoClass = anno.annotationType();
Filter filterTag = (Filter.class == annoClass) ? (Filter) anno : annoClass.getAnnotation(Filter.class);
ElementFilter loader = genie.get(filterTag.value());
list.add(new FilterInfo(loader, filterTag.reverse(), anno, spec));
}
return list;
}
示例11: get
import org.osgl.util.C; //导入方法依赖的package包/类
@Override
public List<Integer> get() {
List<Integer> list = C.newList();
for (int i = 0; i < 10; ++i) {
list.add(N.randInt(100));
}
return list;
}
示例12: randomBlogs
import org.osgl.util.C; //导入方法依赖的package包/类
private static List<Blog> randomBlogs() {
List<Blog> list = C.newList();
int max = N.randInt(10) + 1;
for (int i = 0; i < max; ++i) {
list.add(Blog.random());
}
return list;
}
示例13: retrieveCsrfToken
import org.osgl.util.C; //导入方法依赖的package包/类
public List<Cookie> retrieveCsrfToken($.Var<String> csrf) throws IOException {
url("/csrf");
List<Cookie> cookies = cookies();
List<Cookie> returnCookies = C.newList();
for (Cookie cookie : cookies) {
if ("act-xsrf-token".equals(cookie.name())) {
csrf.set(cookie.value());
} else {
returnCookies.add(cookie);
}
}
return returnCookies;
}
示例14: tokenOf
import org.osgl.util.C; //导入方法依赖的package包/类
private static List<String> tokenOf(Class<?> entryClass) {
C.List<String> tokens = C.newList();
tokens.addAll(classNameTokensReversed(entryClass));
Class<?> enclosingClass = entryClass.getEnclosingClass();
while (null != enclosingClass) {
tokens.addAll(classNameTokensReversed(enclosingClass));
enclosingClass = entryClass.getEnclosingClass();
}
String pkgName = JavaNames.packageNameOf(entryClass);
tokens.append(S.fastSplit(pkgName, ".").reverse());
return tokens.reverse();
}
示例15: ReflectedSimpleEventListener
import org.osgl.util.C; //导入方法依赖的package包/类
ReflectedSimpleEventListener(String className, String methodName, List<BeanSpec> paramTypes, boolean isStatic) {
this.isStatic = isStatic;
this.paramTypes = C.newList();
this.providedParamTypes = C.newList();
DependencyInjector injector = Act.injector();
boolean cutOff = false;
if (null == paramTypes) {
paramTypes = C.list();
}
for (int i = paramTypes.size() - 1; i >= 0; --i) {
BeanSpec spec = paramTypes.get(i);
if (ParamValueLoaderService.provided(spec, injector)) {
E.unexpectedIf(cutOff, "provided(injected) argument must be put at the end of passed in argument list");
providedParamTypes.add(spec.rawType());
} else {
cutOff = true;
this.paramTypes.add(spec.rawType());
}
}
this.paramTypes = this.paramTypes.reverse();
this.providedParamSize = this.providedParamTypes.size();
if (providedParamSize > 0) {
this.providedParamTypes = this.providedParamTypes.reverse();
}
Class[] argList = new Class[paramTypes.size()];
for (int i = 0; i < argList.length; ++i) {
argList[i] = paramTypes.get(i).rawType();
}
this.hostClass = Act.app().classForName(className);
this.method = $.getMethod(hostClass, methodName, argList);
this.isAsync = EventBus.isAsync(hostClass) || EventBus.isAsync(method);
}