本文整理了Java中org.riotfamily.common.util.Generics.newHashSet()
方法的一些代码示例,展示了Generics.newHashSet()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Generics.newHashSet()
方法的具体详情如下:
包路径:org.riotfamily.common.util.Generics
类名称:Generics
方法名:newHashSet
暂无
代码示例来源:origin: riotfamily/riot
public Interceptions(SessionFactory sessionFactory) {
this(sessionFactory, Generics.newHashSet());
}
代码示例来源:origin: riotfamily/riot
@SuppressWarnings("unchecked")
public InterceptorChain(HttpServletRequest request,
HttpServletResponse response) {
this.request = request;
this.response = response;
appliedInterceptors = (Set<RequestInterceptor>) request.getAttribute(APPLIED_INTERCEPTORS);
if (appliedInterceptors == null) {
appliedInterceptors = Generics.newHashSet();
request.setAttribute(APPLIED_INTERCEPTORS, appliedInterceptors);
}
}
代码示例来源:origin: riotfamily/riot
public void afterPropertiesSet() throws Exception {
if (ignoredAnnotations == null) {
ignoredAnnotations = Generics.newHashSet();
}
if (supportedAnnotations == null) {
supportedAnnotations = Generics.newHashSet();
}
if (ignoredTypes == null) {
ignoredTypes = Generics.newHashSet();
}
if (supportedTypes == null) {
supportedTypes = Generics.newHashSet();
}
ignoredAnnotations.add(PathVariable.class);
supportedAnnotations.addAll(Arrays.asList(
RequestParam.class, RequestHeader.class, CookieValue.class));
ignoredTypes.addAll(Arrays.asList(
Model.class, ModelMap.class, Map.class, Errors.class,
BindingResult.class, OutputStream.class, Writer.class,
HttpServletResponse.class));
supportedTypes.addAll(Arrays.asList(
Locale.class, Principal.class));
}
代码示例来源:origin: riotfamily/riot
private Set<Object> getKeys() {
HashSet<Object> keys = Generics.newHashSet();
Iterator<Element> it = items.getElements().iterator();
while (it.hasNext()) {
MapItem item = (MapItem) it.next();
keys.add(item.getKey());
}
return keys;
}
代码示例来源:origin: riotfamily/riot
@SuppressWarnings("unchecked")
private void deleteOrphanedFiles(final Session session) {
log.info("Looking for orphaned files ...");
List<Long> fileIds = session.createQuery(
"select id from " + RiotFile.class.getName()).list();
Set<Long> referencedIds = Generics.newHashSet();
for (String hql : fileQueries) {
log.info(hql);
referencedIds.addAll(session.createQuery(hql).list());
}
log.info("Deleting [{}] orphaned files ...", fileIds.size() - referencedIds.size());
for (Long id : fileIds) {
if (!referencedIds.contains(id)) {
delete(session, id);
}
}
}
代码示例来源:origin: riotfamily/riot
private void unmarshal() {
if (map == null) {
if (xml == null) {
map = new ContentMapImpl(this);
}
else {
Assert.isTrue(!xmlRequiresUpdate, "xmlRequiresUpdate must be false if map is null");
unmarshalling = true;
fragments.clear();
references = Generics.newHashSet();
map = marshaller.unmarshal(this, xml);
xmlRequiresUpdate = false;
unmarshalling = false;
}
}
}
代码示例来源:origin: riotfamily/riot
private Set<String> getCacheEntrySet(SecondLevelCacheStatistics slStats) {
Set<String> entities = Generics.newHashSet();
/* Liefert z.Zt ClassCastException.
* (http://opensource.atlassian.com/projects/hibernate/browse/HHH-2815)
*/
Map<?,?> entries = slStats.getEntries();
if (slStats != null && entries != null) {
for (Iterator<?> iterator = entries.entrySet().iterator(); iterator.hasNext();) {
Entry<?,?> entry = (Entry<?,?>) iterator.next();
if (entry.getValue() instanceof CacheEntry) {
String clzz = ((CacheEntry)entry.getValue()).getSubclass();
if (clzz != null) {
entities.add(clzz);
}
}
}
}
return entities;
}
代码示例来源:origin: riotfamily/riot
private void marshal() {
if (xml == null || xmlRequiresUpdate) {
dirty |= xmlRequiresUpdate;
references = Generics.newHashSet();
xml = marshaller.marshal(getMap());
xmlRequiresUpdate = false;
}
}
代码示例来源:origin: riotfamily/riot
@Override
public void setApplicationContext(ApplicationContext ctx) {
super.setApplicationContext(ctx);
tasks = SpringUtils.orderedBeans(ctx, ScheduledTask.class);
Set<String> triggerNames = Generics.newHashSet();
for (ScheduledTask task : tasks) {
for (String name : task.getTriggerNames()) {
triggerNames.add(name);
}
}
for (Trigger trigger : SpringUtils.listBeansOfTypeIncludingAncestors(ctx, Trigger.class)) {
AbstractTrigger abstractTrigger = (AbstractTrigger) trigger;
if (triggerNames.contains(abstractTrigger.getName())) {
triggers.add(trigger);
}
}
}
代码示例来源:origin: riotfamily/riot
@RemoteMethod
public void discard(Long[] containerIds) {
if (containerIds != null) {
for (Long id : Generics.newHashSet(Arrays.asList(containerIds))) {
if (id != null) {
ContentContainer container = ContentContainer.load(id);
assertIsEditGranted(container);
container.discard();
}
}
}
nofifyUsers();
}
代码示例来源:origin: riotfamily/riot
@RemoteMethod
public void publish(Long[] containerIds) {
if (containerIds != null) {
for (Long id : Generics.newHashSet(Arrays.asList(containerIds))) {
if (id != null) {
ContentContainer container = ContentContainer.load(id);
assertIsPublishGranted(container);
container.publish();
}
}
}
nofifyUsers();
}
代码示例来源:origin: riotfamily/riot
public static Set<Object> getReferences(SessionFactory sessionFactory, Object bean) {
References references = new References();
Class<?> clazz = Hibernate.getClass(bean);
while (!Object.class.equals(clazz)) {
references.addAll(getReferencingClasses(sessionFactory, clazz));
clazz = clazz.getSuperclass();
}
if (!references.isEmpty()) {
Set<Object> referringObjects = Generics.newHashSet();
for (ClassReference reference: references.getEntityReferences()) {
String entityName = sessionFactory.getClassMetadata(reference.getMappedClass()).getEntityName();
String hql = String.format("from %s where %s = :bean", entityName, reference.getPropertyName());
Query query = sessionFactory.getCurrentSession().createQuery(hql).setParameter("bean", bean);
for (Object obj : query.list()) {
referringObjects.add(obj);
}
}
for (ClassReference reference : references.getCollectionReferences()) {
String entityName = sessionFactory.getClassMetadata(reference.getMappedClass()).getEntityName();
String hql = String.format("select count(*) from %s where :bean in elements(%s)", entityName, reference.getPropertyName());
Query query = sessionFactory.getCurrentSession().createQuery(hql).setParameter("bean", bean);
for (Object obj : query.list()) {
referringObjects.add(obj);
}
}
return referringObjects;
}
return null;
}
内容来源于网络,如有侵权,请联系作者删除!