All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.mygreen.cellformatter.term.TextTerm Maven / Gradle / Ivy

The newest version!
package com.github.mygreen.cellformatter.term;

import java.util.Locale;

import com.github.mygreen.cellformatter.lang.ArgUtils;
import com.github.mygreen.cellformatter.lang.MSLocale;
import com.github.mygreen.cellformatter.tokenizer.Token;


/**
 * テキスト用の書式用の特別な項
 * @author T.TSUCHIE
 *
 */
public abstract class TextTerm implements Term {
    
    public static AtMarkTerm atMark(final Token.Symbol token) {
        return new AtMarkTerm(token);
    } 
    
    /**
     * 記号'@'の項
     */
    public static class AtMarkTerm extends TextTerm {
        
        private final Token.Symbol token;
        
        public AtMarkTerm(final Token.Symbol token) {
            ArgUtils.notNull(token, "token");
            this.token = token;
        }
        
        @Override
        public String format(final String value, final MSLocale formatLocale, final Locale runtimeLocale) {
            return value == null ? "" : value;
        }
        
        public Token.Symbol getToken() {
            return token;
        }
        
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy