String字符串操作, el表达式,spel表达式,Aviator表达式解析, ognl表达式

StringPool

package jodd.util;

public interface StringPool {

	String JODD        		= "jodd";
	String AMPERSAND        = "&";
	String AND              = "and";
	String AT               = "@";
	String ASTERISK         = "*";
	String STAR             = ASTERISK;
	String BACK_SLASH       = "\\";
	String COLON            = ":";
	String COMMA            = ",";
	String DASH             = "-";
	String DOLLAR           = "$";
	String DOT              = ".";
	String DOTDOT           = "..";
	String DOT_CLASS        = ".class";
	String DOT_JAVA         = ".java";
	String EMPTY            = "";
	String EQUALS           = "=";
	String FALSE            = "false";
	String SLASH            = "/";
	String HASH             = "#";
	String HAT              = "^";
	String LEFT_BRACE       = "{";
	String LEFT_BRACKET     = "(";
	String LEFT_CHEV        = "<";
	String NEWLINE          = "\n";
	String N                = "n";
	String NO               = "no";
	String NULL             = "null";
	String OFF              = "off";
	String ON               = "on";
	String PERCENT          = "%";
	String PIPE             = "|";
	String PLUS             = "+";
	String QUESTION_MARK    = "?";
	String EXCLAMATION_MARK = "!";
	String QUOTE            = "\"";
	String RETURN           = "\r";
	String TAB              = "\t";
	String RIGHT_BRACE      = "}";
	String RIGHT_BRACKET    = ")";
	String RIGHT_CHEV       = ">";
	String SEMICOLON        = ";";
	String SINGLE_QUOTE     = "'";
	String BACKTICK         = "`";
	String SPACE            = " ";
	String LEFT_SQ_BRACKET  = "[";
	String RIGHT_SQ_BRACKET = "]";
	String TRUE             = "true";
	String UNDERSCORE       = "_";
	String UTF_8            = "UTF-8";
	String US_ASCII			= "US-ASCII";
	String ISO_8859_1       = "ISO-8859-1";
	String Y                = "y";
	String YES              = "yes";
	String ONE 				= "1";
	String ZERO				= "0";
	String DOLLAR_LEFT_BRACE= "${";
	String CRLF				= "\r\n";

	String HTML_NBSP		= "&nbsp;";
	String HTML_AMP			= "&amp";
	String HTML_QUOTE 		= "&quot;";
	String HTML_LT 			= "&lt;";
	String HTML_GT 			= "&gt;";

	// ---------------------------------------------------------------- array

	String[] EMPTY_ARRAY = new String[0];
}

String

package java.lang

String.format("%s %s", OAuth2AccessToken.BEARER_TYPE, token)

OGNL表达式

    //非根元素
    @Test
    public void testOgnl1() throws OgnlException {
        //创建一个Ognl上下文对象
        OgnlContext context = new OgnlContext();


        /**
         * 2.OgnlContext放入对象数据
         */
        //创建对象,设置对象属性
        UserDemo user = new UserDemo();
        user.setId(100);
        user.setName("Jack");
        //【往非根元素放入数据,取值的时候表达式要用“#”】
        context.put("user",user);
        //获取对象属性
        //使用这种方式也可以获取
        Object s = context.get("user");
        System.out.println(s);


        //使用Ognl表达式来获取
        //举例:例如标签<s:a value="#user.id">取值,实际上就是运行了下面的代码获取的
        //先构建一个Ognl表达式,再解析表达式
        Object ognl = Ognl.parseExpression("#user.id");//构建Ognl表达式
        Object value1 = Ognl.getValue(ognl, context, context.getRoot());//解析表达式
        System.out.println(value1);

    }

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值