⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 defaultformatter.java

📁 本系统有十分强大的功能
💻 JAVA
字号:
package org.opencustomer.framework.db.util.engine.configuration;

import java.util.Locale;

import org.apache.struts.taglib.TagUtils;
import org.apache.struts.util.MessageResources;
import org.opencustomer.framework.webapp.util.html.Formatter;

public class DefaultFormatter implements Formatter {

    private final static String KEY_PATTERN = "\\{key:.+\\}";
    
    public DefaultFormatter() {
    }

    public String format(MessageResources resources, Locale locale, Object value) {
        String formattedValue = "";
        
        if(value != null) {
            String myValue = value.toString();
            
            if(myValue.matches(KEY_PATTERN)) {
                myValue = resources.getMessage(locale, myValue.substring(5,myValue.length()-1));
            }
            
            formattedValue = TagUtils.getInstance().filter(myValue);
        }

        return formattedValue;
    }
    
    @Override
    public Object clone() {
        try {
            DefaultFormatter format   = (DefaultFormatter)super.clone();
            
            return format;
        } catch(CloneNotSupportedException e) {
            throw new InternalError();
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -