當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。