当前位置: 首页>>代码示例>>Java>>正文


Java ClassUtils.getAllInterfaces方法代码示例

本文整理汇总了Java中org.apache.commons.lang.ClassUtils.getAllInterfaces方法的典型用法代码示例。如果您正苦于以下问题:Java ClassUtils.getAllInterfaces方法的具体用法?Java ClassUtils.getAllInterfaces怎么用?Java ClassUtils.getAllInterfaces使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.lang.ClassUtils的用法示例。


在下文中一共展示了ClassUtils.getAllInterfaces方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getInterfaces

import org.apache.commons.lang.ClassUtils; //导入方法依赖的package包/类
/**
 * Get a set of all of the interfaces that the element_class implements
 * 
 * @param element_class
 * @return
 */
@SuppressWarnings("unchecked")
public static Collection<Class<?>> getInterfaces(Class<?> element_class) {
    Set<Class<?>> ret = ClassUtil.CACHE_getInterfaceClasses.get(element_class);
    if (ret == null) {
        // ret = new HashSet<Class<?>>();
        // Queue<Class<?>> queue = new LinkedList<Class<?>>();
        // queue.add(element_class);
        // while (!queue.isEmpty()) {
        // Class<?> current = queue.poll();
        // for (Class<?> i : current.getInterfaces()) {
        // ret.add(i);
        // queue.add(i);
        // } // FOR
        // } // WHILE
        ret = new HashSet<Class<?>>(ClassUtils.getAllInterfaces(element_class));
        if (element_class.isInterface())
            ret.add(element_class);
        ret = Collections.unmodifiableSet(ret);
        ClassUtil.CACHE_getInterfaceClasses.put(element_class, ret);
    }
    return (ret);
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:29,代码来源:ClassUtil.java

示例2: getInterfaces

import org.apache.commons.lang.ClassUtils; //导入方法依赖的package包/类
/**
     * Get a set of all of the interfaces that the element_class implements
     * @param element_class
     * @return
     */
    @SuppressWarnings("unchecked")
    public static Collection<Class<?>> getInterfaces(Class<?> element_class) {
        Set<Class<?>> ret = ClassUtil.CACHE_getInterfaceClasses.get(element_class);
        if (ret == null) {
//            ret = new HashSet<Class<?>>();
//            Queue<Class<?>> queue = new LinkedList<Class<?>>();
//            queue.add(element_class);
//            while (!queue.isEmpty()) {
//                Class<?> current = queue.poll();
//                for (Class<?> i : current.getInterfaces()) {
//                    ret.add(i);
//                    queue.add(i);
//                } // FOR
//            } // WHILE
            ret = new HashSet<Class<?>>(ClassUtils.getAllInterfaces(element_class));
            if (element_class.isInterface()) ret.add(element_class);
            ret = Collections.unmodifiableSet(ret);
            ClassUtil.CACHE_getInterfaceClasses.put(element_class, ret);
        }
        return (ret);
    }
 
开发者ID:faclc4,项目名称:HTAPBench,代码行数:27,代码来源:ClassUtil.java

示例3: RegionServerEnvironment

import org.apache.commons.lang.ClassUtils; //导入方法依赖的package包/类
@edu.umd.cs.findbugs.annotations.SuppressWarnings(value="BC_UNCONFIRMED_CAST",
    justification="Intentional; FB has trouble detecting isAssignableFrom")
public RegionServerEnvironment(final Class<?> implClass,
    final Coprocessor impl, final int priority, final int seq,
    final Configuration conf, final RegionServerServices services) {
  super(impl, priority, seq, conf);
  this.regionServerServices = services;
  for (Object itf : ClassUtils.getAllInterfaces(implClass)) {
    Class<?> c = (Class<?>) itf;
    if (SingletonCoprocessorService.class.isAssignableFrom(c)) {// FindBugs: BC_UNCONFIRMED_CAST
      this.regionServerServices.registerService(
        ((SingletonCoprocessorService) impl).getService());
      break;
    }
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:17,代码来源:RegionServerCoprocessorHost.java

示例4: propertyBelongsTo

import org.apache.commons.lang.ClassUtils; //导入方法依赖的package包/类
private boolean propertyBelongsTo(Field field, MetaProperty metaProperty, List<Class> systemInterfaces) {
    String getterName = "get" + StringUtils.capitalize(metaProperty.getName());

    Class<?> aClass = field.getDeclaringClass();
    //noinspection unchecked
    List<Class> allInterfaces = ClassUtils.getAllInterfaces(aClass);
    for (Class intf : allInterfaces) {
        Method[] methods = intf.getDeclaredMethods();
        for (Method method : methods) {
            if (method.getName().equals(getterName) && method.getParameterTypes().length == 0) {
                if (systemInterfaces.contains(intf))
                    return true;
            }
        }
    }
    return false;
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:18,代码来源:MetaModelLoader.java

示例5: isUserQualifiedForOperationOnCeilingEntityViaDefaultPermissions

import org.apache.commons.lang.ClassUtils; //导入方法依赖的package包/类
public boolean isUserQualifiedForOperationOnCeilingEntityViaDefaultPermissions(String ceilingEntityFullyQualifiedName) {
    //the ceiling may be an impl, which will fail because entity permission is normally specified for the interface
    //try the passed in ceiling first, but also try an interfaces implemented
    List<String> testClasses = new ArrayList<String>();
    testClasses.add(ceilingEntityFullyQualifiedName);
    try {
        for (Object interfaze : ClassUtils.getAllInterfaces(Class.forName(ceilingEntityFullyQualifiedName))) {
            testClasses.add(((Class<?>) interfaze).getName());
        }
    } catch (Exception e) {
        throw new RuntimeException(e);
    }

    for (String testClass : testClasses) {
        Query query = em.createNamedQuery("BC_COUNT_BY_PERMISSION_AND_CEILING_ENTITY");
        query.setParameter("permissionNames", Arrays.asList(AdminSecurityService.DEFAULT_PERMISSIONS));
        query.setParameter("ceilingEntity", testClass);
        query.setHint(QueryHints.HINT_CACHEABLE, true);

        Long count = (Long) query.getSingleResult();
        if (count > 0) {
            return true;
        }
    }
    return false;
}
 
开发者ID:passion1014,项目名称:metaworks_framework,代码行数:27,代码来源:AdminPermissionDaoImpl.java

示例6: doesOperationExistForCeilingEntity

import org.apache.commons.lang.ClassUtils; //导入方法依赖的package包/类
public boolean doesOperationExistForCeilingEntity(PermissionType permissionType, String ceilingEntityFullyQualifiedName) {
    //the ceiling may be an impl, which will fail because entity permission is normally specified for the interface
    //try the passed in ceiling first, but also try an interfaces implemented
    List<String> testClasses = new ArrayList<String>();
    testClasses.add(ceilingEntityFullyQualifiedName);
    try {
        for (Object interfaze : ClassUtils.getAllInterfaces(Class.forName(ceilingEntityFullyQualifiedName))) {
            testClasses.add(((Class<?>) interfaze).getName());
        }
    } catch (Exception e) {
        throw new RuntimeException(e);
    }

    for (String testClass : testClasses) {
        Query query = em.createNamedQuery("BC_COUNT_PERMISSIONS_BY_TYPE_AND_CEILING_ENTITY");
        query.setParameter("type", permissionType.getType());
        query.setParameter("ceilingEntity", testClass);
        query.setHint(QueryHints.HINT_CACHEABLE, true);

        Long count = (Long) query.getSingleResult();
        if (count > 0) {
            return true;
        }
    }
    return false;
}
 
开发者ID:passion1014,项目名称:metaworks_framework,代码行数:27,代码来源:AdminPermissionDaoImpl.java

示例7: injectWebMembers

import org.apache.commons.lang.ClassUtils; //导入方法依赖的package包/类
private void injectWebMembers() throws Exception {
       DelegationRulesProxy delegationRulesProxy = new DelegationRulesProxy(getDelegationRules());
       Class delegationRulesClass = getDelegationRules().getClass();
       //System.err.println("delegation rules class: "+ delegationRulesClass);
       Class[] delegationRulesInterfaces = new Class[0]; // = delegationRulesClass.getInterfaces();
       List<Class> delegationRulesInterfaceList = (List<Class>) ClassUtils.getAllInterfaces(delegationRulesClass);
       delegationRulesInterfaces = delegationRulesInterfaceList.toArray(delegationRulesInterfaces);
       ClassLoader delegationRulesClassLoader = getDelegationRules().getClass().getClassLoader();
       Object o = Proxy.newProxyInstance(delegationRulesClassLoader, delegationRulesInterfaces, delegationRulesProxy);
       //setDelegationRules((List) o);

	if (Integer.parseInt(CoreFrameworkServiceLocator.getParameterService().getParameterValueAsString(KewApiConstants.KEW_NAMESPACE, KRADConstants.DetailTypes.RULE_DETAIL_TYPE, KewApiConstants.RULE_DELEGATE_LIMIT)) > getDelegationRules().size() || showDelegations) {
		for (Iterator iterator = getDelegationRules().iterator(); iterator.hasNext();) {
			RuleDelegationBo ruleDelegation = (RuleDelegationBo) iterator.next();
			WebRuleBaseValues webRule = new WebRuleBaseValues();
			webRule.load(ruleDelegation.getDelegationRule());
			webRule.edit(ruleDelegation.getDelegationRule());
			ruleDelegation.setDelegationRule(webRule);
		}
	}
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:22,代码来源:WebRuleResponsibility.java

示例8: suggestCollectionImplementation

import org.apache.commons.lang.ClassUtils; //导入方法依赖的package包/类
/**
 * Returns concrete class, for the given collection interface or abstract class. If given class
 * is already concrete, it will return that class.
 *
 * @param collectionClass collection class to find implementation for
 * @return concrete class
 */
public static Class<? extends Collection> suggestCollectionImplementation(Class<? extends Collection> collectionClass) {
    Class<? extends Collection> collClass = null;

    if (collectionClass != null && (collectionClass.isInterface() || Modifier.isAbstract(collectionClass.getModifiers()))) {
        // for interface such as List (or abstract classes), go to the implementation map
        collClass = COLLECTION_IMPLEMENTATIONS.get(collectionClass.getName());
    } else if (collectionClass != null &&
            ConstructorUtils.getAccessibleConstructor(collectionClass, new Class[0]) == null) {
        // this is an implementation class, but no default constructor, datanucleus collection for example
        // go through interfaces and try to find an interface we have in the collection map
        for (Object intClassObj : ClassUtils.getAllInterfaces(collectionClass)) {
            Class intClass = (Class) intClassObj;
            collClass = COLLECTION_IMPLEMENTATIONS.get(intClass.getName());
            if (collClass != null) {
                break;
            }
        }
    } else {
        // this is an implementation that can be instantiated, return it
        collClass = collectionClass;
    }
    return collClass == null ? ArrayList.class : collClass; // NOPMD - bug in PMD, objects to ArrayList.class here
}
 
开发者ID:motech,项目名称:motech,代码行数:31,代码来源:TypeHelper.java

示例9: isTagHost

import org.apache.commons.lang.ClassUtils; //导入方法依赖的package包/类
private static boolean isTagHost(IJavaType type) throws ClassNotFoundException, DebugException {
	try {
		Class<?> clazz = Class.forName(type.getName());
		List<?> interfaces = ClassUtils.getAllInterfaces(clazz);
		return interfaces.contains(Host.class);
	} catch(ClassNotFoundException e) {
		// outside of scope, we can ignore this
		return false;
	}
}
 
开发者ID:VisuFlow,项目名称:visuflow-plugin,代码行数:11,代码来源:StackExaminer.java

示例10: createEnvironment

import org.apache.commons.lang.ClassUtils; //导入方法依赖的package包/类
@Override
public MasterEnvironment createEnvironment(final Class<?> implClass,
    final Coprocessor instance, final int priority, final int seq,
    final Configuration conf) {
  for (Object itf : ClassUtils.getAllInterfaces(implClass)) {
    Class<?> c = (Class<?>) itf;
    if (CoprocessorService.class.isAssignableFrom(c)) {
      masterServices.registerService(((CoprocessorService)instance).getService());
    }
  }
  return new MasterEnvironment(implClass, instance, priority, seq, conf,
      masterServices);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:14,代码来源:MasterCoprocessorHost.java

示例11: createEnvironment

import org.apache.commons.lang.ClassUtils; //导入方法依赖的package包/类
@Override
public RegionEnvironment createEnvironment(Class<?> implClass,
    Coprocessor instance, int priority, int seq, Configuration conf) {
  // Check if it's an Endpoint.
  // Due to current dynamic protocol design, Endpoint
  // uses a different way to be registered and executed.
  // It uses a visitor pattern to invoke registered Endpoint
  // method.
  for (Object itf : ClassUtils.getAllInterfaces(implClass)) {
    Class<?> c = (Class<?>) itf;
    if (CoprocessorService.class.isAssignableFrom(c)) {
      region.registerService( ((CoprocessorService)instance).getService() );
    }
  }
  ConcurrentMap<String, Object> classData;
  // make sure only one thread can add maps
  synchronized (sharedDataMap) {
    // as long as at least one RegionEnvironment holds on to its classData it will
    // remain in this map
    classData = (ConcurrentMap<String, Object>)sharedDataMap.get(implClass.getName());
    if (classData == null) {
      classData = new ConcurrentHashMap<String, Object>();
      sharedDataMap.put(implClass.getName(), classData);
    }
  }
  return new RegionEnvironment(instance, priority, seq, conf, region,
      rsServices, classData);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:29,代码来源:RegionCoprocessorHost.java

示例12: getInterface

import org.apache.commons.lang.ClassUtils; //导入方法依赖的package包/类
public static Class<?> getInterface(Class<?> clz) {
    Class<?>[] interfaces = clz.getInterfaces();
    if(interfaces != null && interfaces.length > 0) {
        return interfaces[0];
    }
    List<Class<?>> allInterfaces = ClassUtils.getAllInterfaces(clz);
    if(CollectionUtils.isNotEmpty(allInterfaces)) {
        for(Class<?> tmp : allInterfaces) {
            if(InterfaceUtils.isValidType(tmp)) {
                return tmp;
            }
        }
    }
    return clz;
}
 
开发者ID:justimkiss,项目名称:bee,代码行数:16,代码来源:InterfaceUtils.java

示例13: postProcessBeanFactory

import org.apache.commons.lang.ClassUtils; //导入方法依赖的package包/类
@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
    log.info("Configuring remote services");

    BeanDefinitionRegistry registry = (BeanDefinitionRegistry) beanFactory;

    ApplicationContext coreContext = context.getParent();
    Map<String,Object> services = coreContext.getBeansWithAnnotation(Service.class);
    for (Map.Entry<String, Object> entry : services.entrySet()) {
        String serviceName = entry.getKey();
        Object service = entry.getValue();

        List<Class> serviceInterfaces = new ArrayList<>();
        List<Class> interfaces = ClassUtils.getAllInterfaces(service.getClass());
        for (Class intf : interfaces) {
            if (intf.getName().endsWith("Service"))
                serviceInterfaces.add(intf);
        }
        String intfName = null;
        if (serviceInterfaces.size() == 0) {
            log.error("Bean " + serviceName + " has @Service annotation but no interfaces named '*Service'. Ignoring it.");
        } else if (serviceInterfaces.size() > 1) {
            intfName = findLowestSubclassName(serviceInterfaces);
            if (intfName == null)
                log.error("Bean " + serviceName + " has @Service annotation and more than one interface named '*Service', " +
                        "but these interfaces are not from the same hierarchy. Ignoring it.");
        } else {
            intfName = serviceInterfaces.get(0).getName();
        }
        if (intfName != null) {
            BeanDefinition definition = new RootBeanDefinition(HttpServiceExporter.class);
            MutablePropertyValues propertyValues = definition.getPropertyValues();
            propertyValues.add("service", service);
            propertyValues.add("serviceInterface", intfName);
            registry.registerBeanDefinition("/" + serviceName, definition);
            log.debug("Bean " + serviceName + " configured for export via HTTP");
        }
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:40,代码来源:RemoteServicesBeanCreator.java

示例14: ServiceSecurityProxyInvocationHandler

import org.apache.commons.lang.ClassUtils; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public ServiceSecurityProxyInvocationHandler(final Object bean) {
    this.bean = bean;
    Class<? extends Object> clazz = bean.getClass();
    List<Class<?>> interfaces = ClassUtils.getAllInterfaces(clazz);
    Collection<Class<?>> serviceInterfaces = new HashSet<Class<?>>();
    for (Class<?> iface : interfaces) {
        if (Service.class.isAssignableFrom(clazz)) {
            serviceInterfaces.add(iface);
        }
    }
    this.serviceInterfaces = serviceInterfaces.toArray(new Class<?>[serviceInterfaces.size()]);
}
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:14,代码来源:ServiceSecurityProxyInvocationHandler.java

示例15: isUserQualifiedForOperationOnCeilingEntity

import org.apache.commons.lang.ClassUtils; //导入方法依赖的package包/类
public boolean isUserQualifiedForOperationOnCeilingEntity(AdminUser adminUser, PermissionType permissionType, String ceilingEntityFullyQualifiedName) {
    //the ceiling may be an impl, which will fail because entity permission is normally specified for the interface
    //try the passed in ceiling first, but also try an interfaces implemented
    List<String> testClasses = new ArrayList<String>();
    testClasses.add(ceilingEntityFullyQualifiedName);
    try {
        for (Object interfaze : ClassUtils.getAllInterfaces(Class.forName(ceilingEntityFullyQualifiedName))) {
            testClasses.add(((Class<?>) interfaze).getName());
        }
    } catch (Exception e) {
        throw new RuntimeException(e);
    }

    for (String testClass : testClasses) {
        Query query = em.createNamedQuery("BC_COUNT_PERMISSIONS_FOR_USER_BY_TYPE_AND_CEILING_ENTITY");
        query.setParameter("adminUser", adminUser);
        query.setParameter("type", permissionType.getType());
        query.setParameter("ceilingEntity", testClass);
        query.setHint(QueryHints.HINT_CACHEABLE, true);

        Long count = (Long) query.getSingleResult();
        if (count > 0) {
            return true;
        }
    }
    return false;
}
 
开发者ID:passion1014,项目名称:metaworks_framework,代码行数:28,代码来源:AdminPermissionDaoImpl.java


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