當前位置: 首頁>>代碼示例>>Java>>正文


Java PropertyExpression類代碼示例

本文整理匯總了Java中net.sourceforge.stripes.util.bean.PropertyExpression的典型用法代碼示例。如果您正苦於以下問題:Java PropertyExpression類的具體用法?Java PropertyExpression怎麽用?Java PropertyExpression使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


PropertyExpression類屬於net.sourceforge.stripes.util.bean包,在下文中一共展示了PropertyExpression類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: evaluate

import net.sourceforge.stripes.util.bean.PropertyExpression; //導入依賴的package包/類
public void evaluate(NoAnnotation bean) throws Exception {
    String[] properties = bean.getTestProperties();
    boolean[] expect = bean.getExpectSuccess();

    Class<? extends NoAnnotation> beanType = bean.getClass();
    MockRoundtrip trip = new MockRoundtrip(getMockServletContext(), beanType);
    for (String p : properties)
        trip.addParameter(p, p + "Value");
    trip.execute();

    bean = trip.getActionBean(beanType);
    for (int i = 0; i < properties.length; i++) {
        String fullName = beanType.getSimpleName() + "." + properties[i];
        log.debug("Testing binding security on ", fullName);
        PropertyExpression pe = PropertyExpression.getExpression(properties[i]);
        PropertyExpressionEvaluation eval = new PropertyExpressionEvaluation(pe, bean);
        Object value = eval.getValue();
        Assert.assertEquals(value != null, expect[i], "Property " + fullName + " should"
                + (expect[i] ? " not" : "") + " be null but it is" + (expect[i] ? "" : " not"));
    }
}
 
開發者ID:scarcher2,項目名稱:stripes,代碼行數:22,代碼來源:BindingSecurityTests.java


注:本文中的net.sourceforge.stripes.util.bean.PropertyExpression類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。