• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java C类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



C类属于org.osgl.util包,在下文中一共展示了C类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
 
开发者ID:actframework,项目名称:act-storage,代码行数:18,代码来源:StorageServiceManager.java


示例2: initService

import org.osgl.util.C; //导入依赖的package包/类
private void initService(String ssId, Map<String, String> conf) {
    Map<String, String> svcConf = C.newMap();
    String prefix = "ss." + (S.empty(ssId) ? "" : ssId + ".");
    for (String key : conf.keySet()) {
        if (key.startsWith(prefix)) {
            String o = conf.get(key);
            svcConf.put(key.substring(prefix.length()), o);
        }
    }
    String impl = svcConf.remove("impl");
    String svcId = S.empty(ssId) ? DEFAULT : ssId;
    if (null == impl) {
        throw new ConfigurationException("Cannot init storage service[%s]: implementation not specified", svcId);
    }
    StoragePlugin plugin = StoragePluginManager.instance().plugin(impl);
    if (null == plugin) {
        throw new ConfigurationException("Cannot init storage service[%s]: implementation not found", svcId);
    }
    svcConf.put(IStorageService.CONF_ID, "".equals(ssId) ? DEFAULT : ssId);
    IStorageService svc = plugin.initStorageService(ssId, app(), svcConf);
    serviceById.put(svcId, svc);
    logger.info("storage service[%s] initialized", svcId);
}
 
开发者ID:actframework,项目名称:act-storage,代码行数:24,代码来源:StorageServiceManager.java


示例3: registerFactoryMethod

import org.osgl.util.C; //导入依赖的package包/类
private void registerFactoryMethod(final Object instance, final Method factory) {
    Type retType = factory.getGenericReturnType();
    Annotation[] factoryAnnotations = factory.getAnnotations();
    final BeanSpec spec = BeanSpec.of(retType, factoryAnnotations, this);
    final MethodInjector methodInjector = methodInjector(factory, C.<BeanSpec>empty());
    addIntoRegistry(spec, decorate(spec, new Provider() {
        @Override
        public Object get() {
            return methodInjector.applyTo(instance);
        }

        @Override
        public String toString() {
            return S.fmt("%s::%s", instance.getClass().getName(), methodInjector.method.getName());
        }
    }, true), factoryAnnotations.length == 0);
    fireProviderRegisteredEvent(spec.rawType());
}
 
开发者ID:osglworks,项目名称:java-di,代码行数:19,代码来源:Genie.java


示例4: 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();
}
 
开发者ID:osglworks,项目名称:java-di,代码行数:24,代码来源:BeanSpec.java


示例5: 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;
}
 
开发者ID:osglworks,项目名称:java-di,代码行数:20,代码来源:FibonacciSeriesLoader.java


示例6: annotatedElementLoaderProvider

import org.osgl.util.C; //导入依赖的package包/类
@Provides
public static AnnotatedElementLoader annotatedElementLoaderProvider() {
    return new AnnotatedElementLoader() {
        @Override
        protected List<Class<?>> load(
                Class<? extends Annotation> annoClass,
                boolean loadNonPublic,
                boolean loadAbstract
        ) {
            if (annoClass == BindingType.class) {
                if (loadNonPublic && loadAbstract) {
                    return C.list(PublicAnnotated.class, PrivateAnnotated.class, AbstractAnnotated.class);
                }
                if (loadNonPublic) {
                    return C.list(PublicAnnotated.class, PrivateAnnotated.class);
                }
                if (loadAbstract) {
                    return C.list(PublicAnnotated.class, AbstractAnnotated.class);
                }
                return C.<Class<?>>list(PublicAnnotated.class);
            }
            throw E.unsupport();
        }
    };
}
 
开发者ID:osglworks,项目名称:java-di,代码行数:26,代码来源:AnnotatedClasses.java


示例7: 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();
        }
    };
}
 
开发者ID:osglworks,项目名称:java-di,代码行数:23,代码来源:TypedClasses.java


示例8: save

import org.osgl.util.C; //导入依赖的package包/类
@Override
public List<MODEL_TYPE> save(Iterable<MODEL_TYPE> iterable) {
    List<MODEL_TYPE> list = C.list(iterable);
    if (list.isEmpty()) {
        return list;
    }
    Transaction transaction = ebean().createTransaction(TxIsolation.READ_COMMITED);
    transaction.setBatchMode(true);
    transaction.setBatchSize(list.size());
    try {
        ebean().saveAll(list);
        transaction.commit();
    } catch (RuntimeException e) {
        transaction.rollback();
        throw e;
    } finally {
        transaction.end();
    }
    return list;
}
 
开发者ID:actframework,项目名称:act-ebean,代码行数:21,代码来源:EbeanDao.java


示例9: 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();
//            }
//        };
    }
 
开发者ID:actframework,项目名称:act-ebean,代码行数:18,代码来源:EbeanQuery.java


示例10: 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;
}
 
开发者ID:actframework,项目名称:act-aaa-plugin,代码行数:20,代码来源:DynamicPermissionCheckHelperBase.java


示例11: 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;
}
 
开发者ID:actframework,项目名称:actframework,代码行数:25,代码来源:Zen.java


示例12: loadConfFromDir_

import org.osgl.util.C; //导入依赖的package包/类
private Map loadConfFromDir_(File confDir) {
    File[] confFiles = confDir.listFiles(new FilenameFilter() {
        @Override
        public boolean accept(File dir, String name) {
            return name.endsWith(".properties") || name.endsWith(".conf");
        }
    });
    if (null == confFiles) {
        return C.Map();
    } else {
        Map map = new HashMap<>();
        int n = confFiles.length;
        for (int i = 0; i < n; ++i) {
            map.putAll(loadConfFromFile(confFiles[i]));
        }
        return map;
    }
}
 
开发者ID:actframework,项目名称:actframework,代码行数:19,代码来源:ConfLoader.java


示例13: setup

import org.osgl.util.C; //导入依赖的package包/类
@Before
public void setup() throws Exception {
    super.setup();
    scanner = new CommanderByteCodeScanner();
    scannerManager = mock(AppCodeScannerManager.class);
    jobManager = mock(JobManager.class);
    classLoader = new TestingAppClassLoader(mockApp);
    dispatcher = new CliDispatcher(mockApp);
    when(mockApp.classLoader()).thenReturn(classLoader);
    infoSrc = classLoader.commanderClassMetaInfoManager();
    when(mockApp.classLoader()).thenReturn(classLoader);
    when(mockApp.cliDispatcher()).thenReturn(dispatcher);
    when(mockApp.scannerManager()).thenReturn(scannerManager);
    when(mockApp.jobManager()).thenReturn(jobManager);
    when(mockAppConfig.possibleControllerClass(anyString())).thenReturn(true);
    when(mockRouter.isActionMethod(anyString(), anyString())).thenReturn(false);
    C.List<AppByteCodeScanner> scanners = $.cast(C.listOf(scanner));
    when(scannerManager.byteCodeScanners()).thenReturn(scanners);
    scanner.setApp(mockApp);
    base = new File("./target/test-classes");
}
 
开发者ID:actframework,项目名称:actframework,代码行数:22,代码来源:CommanderByteCodeScannerTest.java


示例14: defaultWords

import org.osgl.util.C; //导入依赖的package包/类
private static List<String> defaultWords() {
    return C.listOf(
            "Beautiful is better than ugly.",
            "Explicit is better than implicit.",
            "Simple is better than complex.",
            "Complex is better than complicated.",
            "Flat is better than nested.",
            "Sparse is better than dense.",
            "Readability counts.",
            "Special cases aren't special enough to break the rules. \n" +
                    "Although practicality beats purity.",
            "Errors should never pass silently \n" +
                    "Unless explicitly silenced.",
            "In the face of ambiguity, refuse the temptation to guess.",
            "There should be one-- and preferably only one --obvious way to do it.\n" +
                    "Although that way may not be obvious at first unless you're Dutch.",
            "Now is better than never. \n" +
                    "Although never is often better than *right* now.",
            "If the implementation is hard to explain, it's a bad idea.",
            "If the implementation is easy to explain, it may be a good idea.",
            "Namespaces are one honking great idea -- let's do more of those!",
            "Simple things should be simple, complex things should be possible."
    );
}
 
开发者ID:actframework,项目名称:actframework,代码行数:25,代码来源:Zen.java


示例15: staticWithoutReturnValue

import org.osgl.util.C; //导入依赖的package包/类
@Test
public void staticWithoutReturnValue() {
    scan(StaticWithoutReturnType.class);
    CommanderClassMetaInfo classMetaInfo = infoSrc.commanderMetaInfo(StaticWithoutReturnType.class.getName());
    CommandMethodMetaInfo methodMetaInfo = classMetaInfo.command("foo.bar");
    eq("doIt", methodMetaInfo.methodName());
    eq(StaticWithoutReturnType.class.getName() + ".doIt", methodMetaInfo.fullName());
    eq("help", methodMetaInfo.helpMsg());
    yes(methodMetaInfo.isStatic());
    assertNull(methodMetaInfo.propertySpec());
    eq(AsmTypes.RETURN_VOID, methodMetaInfo.returnType());
    C.List<CommandParamMetaInfo> params = methodMetaInfo.params();
    eq(2, params.size());

    CommandParamMetaInfo op = params.get(0);
    eq("op1", op.name());
    ParamOptionAnnoInfo anno = op.optionInfo();
    eq("-o", anno.lead1());
    eq("--op1", anno.lead2());

    op = params.get(1);
    eq("num", op.name());
    anno = op.optionInfo();
    eq("-n", anno.lead1());
    eq("--number", anno.lead2());
}
 
开发者ID:actframework,项目名称:actframework,代码行数:27,代码来源:CommanderByteCodeScannerTest.java


示例16: check

import org.osgl.util.C; //导入依赖的package包/类
private void check(Map<String, Long> newTimestamps) {
    C.List<FsEvent> events = C.newSizedList(3);

    C.Set<String> set0 = C.set(timestamps.keySet());
    C.Set<String> set1 = C.set(newTimestamps.keySet());

    C.Set<String> added = set1.without(set0);
    if (!added.isEmpty()) {
        events.add(createEvent(FsEvent.Kind.CREATE, added));
    }

    C.Set<String> removed = set0.without(set1);
    if (!removed.isEmpty()) {
        events.add(createEvent(FsEvent.Kind.DELETE, removed));
    }

    C.Set<String> retained = set1.withIn(set0);
    C.Set<String> modified = modified(retained, newTimestamps);
    if (!modified.isEmpty()) {
        events.add(createEvent(FsEvent.Kind.MODIFY, modified));
    }

    if (!events.isEmpty()) {
        trigger(events.toArray(new FsEvent[events.size()]));
    }
}
 
开发者ID:actframework,项目名称:actframework,代码行数:27,代码来源:FsChangeDetector.java


示例17: 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;
}
 
开发者ID:actframework,项目名称:actframework,代码行数:24,代码来源:EndpointTester.java


示例18: mergeFromWithList

import org.osgl.util.C; //导入依赖的package包/类
private void mergeFromWithList(final ControllerClassMetaInfoManager infoBase, final App app) {
    C.Set<String> withClasses = this.withList;
    if (withClasses.isEmpty()) {
        return;
    }
    ClassInfoRepository repo = app.classLoader().classInfoRepository();
    for (final String withClass : withClasses) {
        String curWithClass = withClass;
        ControllerClassMetaInfo withClassInfo = infoBase.controllerMetaInfo(curWithClass);
        while (null == withClassInfo && !"java.lang.Object".equals(curWithClass)) {
            ClassNode node = repo.node(curWithClass);
            if (null != node) {
                node = node.parent();
            }
            if (null == node) {
                break;
            }
            curWithClass = node.name();
            withClassInfo = infoBase.controllerMetaInfo(curWithClass);
        }
        if (null != withClassInfo) {
            withClassInfo.merge(infoBase, app);
            interceptors.mergeFrom(withClassInfo.interceptors);
        }
    }
}
 
开发者ID:actframework,项目名称:actframework,代码行数:27,代码来源:ActionMethodMetaInfo.java


示例19: calibrate

import org.osgl.util.C; //导入依赖的package包/类
protected static Map<String, String> calibrate(Map<String, String> conf, String prefix) {
    Map<String, String> map = C.newMap();
    for (String key : conf.keySet()) {
        String val = conf.get(key);
        if (!key.startsWith("storage")) {
            key = prefix + key;
        }
        map.put(key, val);
    }
    return map;
}
 
开发者ID:actframework,项目名称:act-storage,代码行数:12,代码来源:StoragePlugin.java


示例20: 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();
}
 
开发者ID:actframework,项目名称:act-storage,代码行数:11,代码来源:StorageServiceAdmin.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java HftpFileSystem类代码示例发布时间:2022-05-22
下一篇:
Java BuildMessage1类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap