19 package org.turro.action;
23 import java.util.TreeSet;
24 import org.turro.string.Strings;
25 import org.turro.annotation.UserSummary;
26 import org.turro.elephant.context.Application;
27 import org.turro.elephant.context.IConstructor;
28 import org.turro.marker.ElephantMarker;
29 import org.turro.reflection.Instances;
39 iSummary.init(constructor);
45 String prevSummary =
null, separator = renderSeparator(constructor);
46 StringBuilder sb =
new StringBuilder();
48 String summary = iSummary.render(constructor);
49 if(!Strings.isBlank(summary)) {
50 if(!Strings.isBlank(prevSummary)) {
54 prevSummary = summary;
64 if(attr instanceof Number) {
65 return ((Number) attr).doubleValue() != 0.0;
70 public static boolean isTrue(String attribute) {
72 if(attr instanceof Boolean) {
73 return ((Boolean) attr).booleanValue();
82 public static Object
getAttribute(String attribute, Object defaultValue) {
84 return value ==
null ? defaultValue : value;
103 private static String renderSeparator(
IConstructor constructor) {
106 return marker.
parse(
"iterator",
"separator");
111 private static Set<IUserSummary> getSortedSummaries() {
112 return new TreeSet<>(Instances.cached().byAnnotation(UserSummary.class, IUserSummary.class));
115 private UserSummaries() {
static Object getAttribute(String attribute, Object defaultValue)
static boolean isNotZero(String attribute)
static void setAttribute(String attribute, Object value)
static Map< String, Object > getAttributes()
static Object getAttribute(String attribute)
static void initSummaries(IConstructor constructor)
static void removeAttributes()
static String parseSummaries(IConstructor constructor)
static boolean isTrue(String attribute)
IConstructor getConstructor()
static Application getApplication()
String parse(String rootTmpl, String tmpl)
Object findAttribute(String key)
Map< String, Object > getSessionAttributeMap(String prefix)
void setSessionAttribute(String key, Object value)
void removeSessionAttribute(String key)