This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn foo [x] | |
(cond | |
(instance? Integer x) "Integer" | |
(instance? String x) "String" | |
(instance? Boolean x) "Boolean")) | |
(defn transient-foo [n] | |
(loop [cnt n col (transient [])] | |
(if (= cnt 0) (persistent! col) | |
(recur (dec cnt) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn foo [x] | |
(cond | |
(instance? Integer x) "Integer" | |
(instance? String x) "String" | |
(instance? Boolean x) "Boolean")) | |
(defn array-foo [n] | |
(let [items (object-array ["foo" 23 true]) result (object-array (* 3 n))] | |
(dotimes [i n] | |
(dotimes [j 3] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.apache.ibatis.executor; | |
import java.sql.BatchUpdateException; | |
import java.sql.Connection; | |
import java.sql.SQLException; | |
import java.sql.Statement; | |
import java.util.ArrayList; | |
import java.util.Collections; | |
import java.util.HashMap; | |
import java.util.List; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
${date?date?string.medium} | |
${time?time?string.medium} | |
${month?string("MM-yyyy")} | |
${boolean?string("${yes}", "${no}")} | |
[#if boolean]${greeting}[/#if] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static Map<String, Object> getDataModel() { | |
HashMap<String, Object> datamodel = new HashMap<>(); | |
datamodel.put("date", new Date()); | |
datamodel.put("time", new Date()); | |
datamodel.put("month", new Date()); | |
datamodel.put("boolean", true); | |
datamodel.put("yes", getBundle().getString("yes")); | |
datamodel.put("no", getBundle().getString("no")); | |
datamodel.put("greeting", format(getBundle().getString("hello"), "Freemarker")); | |
return datamodel; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Jun 13, 2012 | |
4:39:47 PM | |
06-2012 | |
Yes | |
Hello Freemarker! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class LocalizingWrapper extends BeansWrapper { | |
private Provider<Locale> localeProvider; | |
public LocalizingWrapper(Provider<Locale> localeProvider) { | |
this.localeProvider = localeProvider; | |
} | |
@Override | |
public TemplateModel wrap(Object object) throws TemplateModelException { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class LocalDateModel extends BeanModel implements TemplateScalarModel { | |
private final LocalDate object; | |
private final Locale locale; | |
public LocalDateModel(LocalDate object, Locale locale, BeansWrapper wrapper) { | |
super(object, wrapper); | |
this.object = object; | |
this.locale = locale; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
${date} | |
${time} | |
${month} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@BaseName("de.oehme.examples.freemarkerI18n.easyway.localization.messages") | |
public enum Messages { | |
YES, | |
NO, | |
HELLO | |
} |
OlderNewer