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


Java ClassLoaderUtils.unwrapFromProxy方法代码示例

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


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

示例1: testIsWorkflowAttribute

import org.kuali.rice.core.api.util.ClassLoaderUtils; //导入方法依赖的package包/类
@Test
public void testIsWorkflowAttribute() throws Exception {
    RuleTemplateBo template = KEWServiceLocator.getRuleTemplateService().findByRuleTemplateName("TemplateWithRuleValidationAttribute");
    List<RuleTemplateAttributeBo> ruleTemplateAttributes = (List<RuleTemplateAttributeBo>) template.getRuleTemplateAttributes();
    int index = 0;
    for (RuleTemplateAttributeBo ruleTemplateAttribute : ruleTemplateAttributes) {
        boolean isWorkflowAttribute = ruleTemplateAttribute.isWorkflowAttribute();
        Object attribute = ruleTemplateAttribute.getAttribute();
        attribute = ClassLoaderUtils.unwrapFromProxy(attribute);
        if (index == 0) {
            // should be the TestRuleAttribute
            assertNotNull(attribute);
            assertEquals("Should be TestRuleAttribute", TestRuleAttribute.class, attribute.getClass());
            assertTrue("TestRuleAttribute is a workflow attribute.", isWorkflowAttribute);
        } else if (index == 1) {
            // should be the TestRuleValidationAttribute so should be null
            assertEquals("Should be TestRuleValidationAttribute", TestRuleValidationAttribute.class,
                    attribute.getClass());
            assertFalse("TestRuleValidationAttribute is not a workflow attribute", isWorkflowAttribute);
        }
        index++;
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:24,代码来源:RuleTemplateAttributeTest.java

示例2: testIsWorkflowAttribute

import org.kuali.rice.core.api.util.ClassLoaderUtils; //导入方法依赖的package包/类
@Test
public void testIsWorkflowAttribute() throws Exception {
    RuleTemplateBo template = KEWServiceLocator.getRuleTemplateService().findByRuleTemplateName("TemplateWithRuleValidationAttribute");
    List<RuleTemplateAttributeBo> ruleTemplateAttributes = (List<RuleTemplateAttributeBo>) template.getRuleTemplateAttributes();
    int index = 0;
    for (RuleTemplateAttributeBo ruleTemplateAttribute : ruleTemplateAttributes) {
        boolean isWorkflowAttribute = ruleTemplateAttribute.isWorkflowAttribute();
        Object attribute = ruleTemplateAttribute.getAttribute();
        attribute = ClassLoaderUtils.unwrapFromProxy(attribute);
        if (index == 0) {
            // should be the TestRuleAttribute
            assertNotNull(attribute);
            assertEquals("Should be TestRuleAttribute", TestRuleAttribute.class, attribute.getClass());
            assertTrue("TestRuleAttribute is a workflow attribute.", isWorkflowAttribute);
        } else if (index == 1) {
            // should be the TestRuleValidationAttribute so should be null
            assertEquals("Should be TestRuleValidationAttribute", TestRuleValidationAttribute.class, attribute.getClass());
            assertFalse("TestRuleValidationAttribute is not a workflow attribute", isWorkflowAttribute);
        }
        index++;
    }
}
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:23,代码来源:RuleTemplateAttributeTest.java

示例3: getHandlerAdapter

import org.kuali.rice.core.api.util.ClassLoaderUtils; //导入方法依赖的package包/类
@Override
protected HandlerAdapter getHandlerAdapter(Object handler) throws ServletException {
	if (handler instanceof HttpRequestHandler) {
		return new HttpRequestHandlerAdapter();
	} else if (handler instanceof Controller) {
		Object unwrappedHandler = ClassLoaderUtils.unwrapFromProxy(handler);
		if (unwrappedHandler instanceof CXFServletControllerAdapter) {
			// TODO this just seems weird as this controller is initially null when it's created, does there need to be some synchronization here?
			((CXFServletControllerAdapter)unwrappedHandler).setController(cxfServletController);
		}			
		return new SimpleControllerHandlerAdapter();
	}
	throw new RiceRuntimeException("handler of type " + handler.getClass().getName() + " is not known and can't be used by " + KSBDispatcherServlet.class.getName());
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:15,代码来源:KSBDispatcherServlet.java

示例4: testGetWorkflowAttribute

import org.kuali.rice.core.api.util.ClassLoaderUtils; //导入方法依赖的package包/类
@Test
public void testGetWorkflowAttribute() throws Exception {
    RuleTemplateBo template = KEWServiceLocator.getRuleTemplateService().findByRuleTemplateName("TemplateWithRuleValidationAttribute");
    List<RuleTemplateAttributeBo> ruleTemplateAttributes = (List<RuleTemplateAttributeBo>) template.getRuleTemplateAttributes();
    int index = 0;
    for (RuleTemplateAttributeBo ruleTemplateAttribute : ruleTemplateAttributes) {
        boolean runtimeThrown = false;
        WorkflowRuleAttribute attribute = null;
        try {
            attribute = ruleTemplateAttribute.getWorkflowAttribute();
        } catch (RuntimeException e) {
            runtimeThrown = true;
        }
        if (index == 0) {
            // should be the TestRuleAttribute
            assertFalse("RuntimeException should not have been thrown.", runtimeThrown);
            assertNotNull("Attribute should exist.", attribute);
            attribute = (WorkflowRuleAttribute) ClassLoaderUtils.unwrapFromProxy(attribute);
            assertEquals("Should be TestRuleAttribute", TestRuleAttribute.class, attribute.getClass());
        } else if (index == 1) {
            // should be the TestRuleDelegationAttribute so should be null
            assertTrue("RuntimeException should have been thrown.", runtimeThrown);
            assertNull("This should be the rule delegation attribute, not a WorkflowAttribute.", attribute);
        }
        index++;
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:28,代码来源:RuleTemplateAttributeTest.java


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