Java Code Examples for org.osgl.util.C#Set
The following examples show how to use
org.osgl.util.C#Set .
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: ActionMethodMetaInfo.java From actframework with Apache License 2.0 | 6 votes |
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); } } }
Example 2
Source File: ControllerClassMetaInfo.java From actframework with Apache License 2.0 | 6 votes |
private void mergeFromWithList(final ControllerClassMetaInfoManager infoBase, final App app) { C.Set<String> withClasses = C.newSet(); getAllWithList(withClasses, infoBase); final ControllerClassMetaInfo me = this; 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); } } }
Example 3
Source File: FsChangeDetector.java From actframework with Apache License 2.0 | 6 votes |
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()])); } }
Example 4
Source File: ElementLoaderProvider.java From java-di with Apache License 2.0 | 5 votes |
private ElementLoaderProvider(BeanSpec spec, Provider<T> provider, Genie genie) { this.realProvider = provider; C.List<LoaderInfo> loaders = loaders(genie, spec).sorted(); this.loader = loaders.first(); List<? extends FilterInfo> tail = loaders.head(-1); this.filters = C.Set(filters(genie, spec).append(tail)); this.genie = genie; }
Example 5
Source File: EventBus.java From actframework with Apache License 2.0 | 5 votes |
/** * Find the permutation of arg types. E.g * * Suppose a declared argTypes is: * * ``` * (List, ISObject) * ``` * * Then permutation of the argTypes includes: * * ``` * (List, ISObject) * (ArrayList, ISObject) * (LinkedList, ISObject) * (ArrayList, SObject) * (LinkedList, SObject) * ... * ``` * * @param argTypes * @return */ private static Set<List<Class>> permutationOf(List<Class> argTypes) { int len = argTypes.size(); if (len == 0) { return C.Set(); } // get type candidates for each arg position final AppClassLoader classLoader = Act.app().classLoader(); ClassInfoRepository repo = classLoader.classInfoRepository(); final List<List<Class>> candidates = new ArrayList<>(); for (int i = 0; i < len; ++i) { Class type = argTypes.get(i); final List<Class> list = new ArrayList<>(); list.add(type); candidates.add(list); ClassNode node = repo.findNode(type); if (null != node) { node.visitPublicSubTreeNodes(new Lang.Visitor<ClassNode>() { @Override public void visit(ClassNode classNode) throws Lang.Break { list.add(Act.classForName(classNode.name())); } }); } } // generate permutation of argTypes return permutationOf(candidates, candidates.size() - 1); }
Example 6
Source File: FsChangeDetector.java From actframework with Apache License 2.0 | 5 votes |
private Set<String> prependContext(C.Set<String> paths) { return C.set(paths.map(new $.F1<String, String>() { @Override public String apply(String s) throws NotAppliedException, $.Break { return context + s; } })); }
Example 7
Source File: OsglSetProvider.java From java-di with Apache License 2.0 | 4 votes |
@Override public C.Set<?> get() { return C.newSet(); }
Example 8
Source File: InterceptorMethodMetaInfo.java From actframework with Apache License 2.0 | 4 votes |
public Set<String> whiteList() { return C.Set(whiteList); }
Example 9
Source File: InterceptorMethodMetaInfo.java From actframework with Apache License 2.0 | 4 votes |
public Set<String> blackList() { return C.Set(blackList); }
Example 10
Source File: MasterEntityMetaInfoRepo.java From actframework with Apache License 2.0 | 4 votes |
@Inject public MasterEntityMetaInfoRepo(final App app) { super(app); EMPTY = new EntityMetaInfoRepo(app){ @Override public void registerEntityOrMappedSuperClass(String className) { E.unsupport(); } @Override public void registerEntityName(String className, String entityName) { E.unsupport(); } @Override public void markEntityListenersFound(String className) { E.unsupport(); } @Override public void registerCreatedAtField(String className, String fieldName) { E.unsupport(); } @Override public void registerLastModifiedAtField(String className, String fieldName) { E.unsupport(); } @Override public void registerIdField(String className, String fieldName) { E.unsupport(); } @Override public void registerColumnName(String className, String fieldName, String columnName) { E.unsupport(); } @Override public boolean isRegistered(String className) { return false; } @Override public Set<Class> entityClasses() { return C.Set(); } @Override public EntityClassMetaInfo classMetaInfo(Class<?> entityClass) { return null; } @Override public EntityClassMetaInfo classMetaInfo(String className) { return null; } @Override protected void releaseResources() { } @Override void register(Class<?> entityClass, EntityClassMetaInfo info) { E.unsupport(); } }; registerEntityAnnotation(Entity.class); registerMappedSuperClassAnnotation(MappedSuperclass.class); registerEntityListenerAnnotation(EntityListeners.class); final MasterEntityMetaInfoRepo me = this; JobManager jobManager = app.jobManager(); jobManager.on(SysEventId.CLASS_LOADED, "MasterEntityMetaInfoRepo:findAndRegisterEntityClasses", new Runnable() { @Override public void run() { final ClassInfoRepository classRepo = app.classLoader().classInfoRepository(); for (Map.Entry<String, EntityClassMetaInfo> entry : lookup.entrySet()) { Class<?> entityClass = app.classForName(entry.getKey()); EntityClassMetaInfo info = entry.getValue(); info.mergeFromMappedSuperClasses(classRepo, me); register(entityClass, info); DB db = entityClass.getAnnotation(DB.class); String dbId = (null == db ? DB.DEFAULT : db.value()).toUpperCase(); EntityMetaInfoRepo repo = regions.get(dbId); if (null == repo) { repo = new EntityMetaInfoRepo(app); regions.put(dbId, repo); } repo.register(entityClass, info); } } }); jobManager.on(SysEventId.DEPENDENCY_INJECTOR_PROVISIONED, "MasterEntityMetaInfoRepo:registerEntityMetaInfoRepo.Provider", new Runnable() { @Override public void run() { app.injector().registerNamedProvider(EntityMetaInfoRepo.class, app.getInstance(EntityMetaInfoRepo.Provider.class)); } }); }
Example 11
Source File: ClassInfoRepository.java From actframework with Apache License 2.0 | 4 votes |
public Set<Method> methodsWithAnnotation(Class<? extends Annotation> annoType) { Set<Method> set = methodAnnotationLookup.get(annoType); return null == set ? C.<Method>Set() : set; }
Example 12
Source File: FsChangeDetector.java From actframework with Apache License 2.0 | 4 votes |
private FsEvent createEvent(FsEvent.Kind kind, C.Set<String> paths) { return new FsEvent(kind, prependContext(paths)); }