forked from snowplow/snowplow-java-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPayload.java
More file actions
74 lines (66 loc) · 2.55 KB
/
Payload.java
File metadata and controls
74 lines (66 loc) · 2.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*
* Copyright (c) 2015 Snowplow Analytics Ltd. All rights reserved.
*
* This program is licensed to you under the Apache License Version 2.0,
* and you may not use this file except in compliance with the Apache License Version 2.0.
* You may obtain a copy of the Apache License Version 2.0 at http://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the Apache License Version 2.0 is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Apache License Version 2.0 for the specific language governing permissions and limitations there under.
*/
package com.snowplowanalytics.snowplow.tracker.payload;
// Java
import java.util.Map;
/**
* The Payload is used to store all the parameters and configurations that are used
* to send data via the HTTP GET/POST request.
*/
public interface Payload {
/**
* Add a key-value pair to the payload:
* - Checks that the key is not null or empty
* - Checks that the value is not null or empty
*
* @param key The parameter key
* @param value The parameter value as a String
*/
void add(String key, String value);
/**
* Add all the mappings from the specified map. The effect is the equivalent to that of calling:
* - add(String key, String value) for each key value pair.
*
* @param map Key-Value pairs to be stored in this payload
*/
void addMap(Map<String, String> map);
/**
* Add a map to the Payload with a key dependent on the base 64 encoding option you choose using the
* two keys provided.
*
* @param map Map to be converted to a String and stored as a value
* @param base64Encoded The option you choose to encode the data
* @param typeEncoded The key that would be set if the encoding option was set to true
* @param typeNotEncoded They key that would be set if the encoding option was set to false
*/
void addMap(Map map, boolean base64Encoded, String typeEncoded, String typeNotEncoded);
/**
* Returns the Payload as a HashMap.
*
* @return A HashMap
*/
Map getMap();
/**
* Returns the byte size of a payload.
*
* @return A long representing the byte size of the payload.
*/
long getByteSize();
/**
* Returns the Payload as a string. This is essentially the toString from the ObjectNode used
* to store the Payload.
*
* @return A string value of the Payload.
*/
String toString();
}