/*
 * Copyright 2017-2017 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.hellojavaer.ddal.ddr.expression.el.function;

/**
 *
 * @author <a href="mailto:hellojavaer@gmail.com">Kaiming Zou</a>,created on 25/04/2017.
 */
public class FormatFunction {

    public static String format(String format, Object... args) {
        return String.format(format, args);
    }
}

@@ -17,17 +17,17 @@
 2017-201
-7
+8
  the ori
@@ -676,252 +676,1496 @@
 n;%0A%0A
-/**%0A *%0A * @author %3Ca href=%22mailto:hellojavaer@gmail.com%22%3EKaiming Zou%3C/a%3E,created on 25/04/2017.%0A */%0Apublic class FormatFunction %7B%0A%0A    public static String format(String format, Object... args) %7B%0A        return String.format(format, args);%0A    %7D
+import com.googlecode.concurrentlinkedhashmap.ConcurrentLinkedHashMap;%0Aimport com.googlecode.concurrentlinkedhashmap.Weighers;%0A%0Aimport java.text.SimpleDateFormat;%0Aimport java.util.Map;%0A%0A/**%0A *%0A * @author %3Ca href=%22mailto:hellojavaer@gmail.com%22%3EKaiming Zou%3C/a%3E,created on 25/04/2017.%0A */%0Apublic class FormatFunction %7B%0A%0A    private static ThreadLocal%3CMap%3E dateFormatCache = new ThreadLocal%3CMap%3E() %7B%0A%0A                                                        @Override%0A                                                        protected Map initialValue() %7B%0A                                                            return new ConcurrentLinkedHashMap.Builder%3CString, Map%3E()//%0A                                                            .maximumWeightedCapacity(100)//%0A                                                            .weigher(Weighers.singleton())//%0A                                                            .build();%0A                                                        %7D%0A                                                    %7D;%0A%0A    public static String format(String format, Object... args) %7B%0A        return String.format(format, args);%0A    %7D%0A%0A    public static String dateFormat(String format, Object date) %7B%0A        Map%3CString, SimpleDateFormat%3E map = dateFormatCache.get();%0A        SimpleDateFormat df = map.get(format);%0A        if (df == null) %7B%0A            df = new SimpleDateFormat(format);%0A            map.put(format, df);%0A        %7D%0A        return df.format(date);%0A    %7D%0A
 %0A%7D%0A

add method 'dateFormat' for EL expression