BrightSide Workbench Full Report + Source Code
org.turro.action.Parameters Class Reference

Public Member Functions

String get (String key)
 
Parameters add (String key, Object value)
 
Parameters url (String url)
 
String raw ()
 
String raw (String separator)
 
String plain ()
 
String plain (String separator)
 
String encoded ()
 
KeyValueMap asMap ()
 

Static Public Member Functions

static Parameters instance ()
 
static Parameters copy (Parameters pars)
 
static Parameters path (String path)
 
static Parameters from (Map< String, String[]> parameterMap)
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 38 of file Parameters.java.

Member Function Documentation

◆ add()

Parameters org.turro.action.Parameters.add ( String  key,
Object  value 
)

Definition at line 48 of file Parameters.java.

48  {
49  parameters.put(key, Converter.STANDARD.convert(value, String.class));
50  return this;
51  }
Here is the caller graph for this function:

◆ asMap()

KeyValueMap org.turro.action.Parameters.asMap ( )

Definition at line 100 of file Parameters.java.

100  {
101  return new KeyValueMap(parameters);
102  }
Here is the caller graph for this function:

◆ copy()

static Parameters org.turro.action.Parameters.copy ( Parameters  pars)
static

Definition at line 120 of file Parameters.java.

120  {
121  Parameters instance = instance();
122  instance.parameters.putAll(pars.parameters);
123  return instance;
124  }
static Parameters instance()
Here is the call graph for this function:

◆ encoded()

String org.turro.action.Parameters.encoded ( )

Definition at line 90 of file Parameters.java.

90  {
91  StringBuilder sb = new StringBuilder();
92  if(!Strings.isBlank(url)) {
93  sb.append(url).append("?");
94  }
95  return sb.append(ENCODED).append("=")
96  .append(Base64.getUrlEncoder().encodeToString(raw(";").getBytes(charset)))
97  .toString();
98  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ from()

static Parameters org.turro.action.Parameters.from ( Map< String, String[]>  parameterMap)
static

Definition at line 130 of file Parameters.java.

130  {
131  Parameters instance = instance();
132  if(parameterMap != null) {
133  parameterMap.keySet().forEach((key) -> {
134  if(ENCODED.equals(key)) {
135  try {
136  KeyValueMap kvm = new KeyValueMap(decode(parameterMap.get(key)[0]));
137  if(kvm != null) instance.addAll(kvm);
138  } catch (ParserException ex) {
139  WebLoggers.info(Parameters.class).exception(ex).log();
140  }
141  } else {
142  instance.add(key, URLDecoder.decode(parameterMap.get(key)[0], charset));
143  }
144  });
145  }
146  return instance;
147  }
Parameters add(String key, Object value)
Definition: Parameters.java:48
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get()

String org.turro.action.Parameters.get ( String  key)

Definition at line 40 of file Parameters.java.

40  {
41  return parameters.get(key);
42  }

◆ instance()

static Parameters org.turro.action.Parameters.instance ( )
static

Definition at line 116 of file Parameters.java.

116  {
117  return new Parameters();
118  }
Here is the caller graph for this function:

◆ path()

static Parameters org.turro.action.Parameters.path ( String  path)
static

Definition at line 126 of file Parameters.java.

126  {
127  return instance().url(path);
128  }
static Parameters path(String path)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ plain() [1/2]

String org.turro.action.Parameters.plain ( )

Definition at line 74 of file Parameters.java.

74  {
75  return plain("&");
76  }
Here is the caller graph for this function:

◆ plain() [2/2]

String org.turro.action.Parameters.plain ( String  separator)

Definition at line 78 of file Parameters.java.

78  {
79  StringBuilder sb = new StringBuilder();
80  if(!Strings.isBlank(url)) {
81  sb.append(url).append("?");
82  }
83  for(Map.Entry<String, String> entry : parameters.entrySet()) {
84  if(!sb.isEmpty()) sb.append(separator);
85  sb.append(entry.getKey()).append("=").append(URLEncoder.encode(entry.getValue(), charset));
86  }
87  return sb.toString();
88  }

◆ raw() [1/2]

String org.turro.action.Parameters.raw ( )

Definition at line 58 of file Parameters.java.

58  {
59  return raw("&");
60  }
Here is the caller graph for this function:

◆ raw() [2/2]

String org.turro.action.Parameters.raw ( String  separator)

Definition at line 62 of file Parameters.java.

62  {
63  StringBuilder sb = new StringBuilder();
64  if(!Strings.isBlank(url)) {
65  sb.append(url).append("?");
66  }
67  for(Map.Entry<String, String> entry : parameters.entrySet()) {
68  if(!sb.isEmpty()) sb.append(separator);
69  sb.append(entry.getKey()).append("=").append(entry.getValue());
70  }
71  return sb.toString();
72  }

◆ url()

Parameters org.turro.action.Parameters.url ( String  url)

Definition at line 53 of file Parameters.java.

53  {
54  this.url = url;
55  return this;
56  }

The documentation for this class was generated from the following file: