| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| SingleValueAttribute |
|
| 1.0;1 |
| 1 | package org.codeforamerica.open311.facade.data; | |
| 2 | ||
| 3 | import java.util.HashMap; | |
| 4 | import java.util.Map; | |
| 5 | ||
| 6 | /** | |
| 7 | * Single valued attribute useful for the <a | |
| 8 | * href="http://wiki.open311.org/GeoReport_v2#POST_Service_Request">POST Service | |
| 9 | * Request</a> operation. | |
| 10 | * | |
| 11 | * @author Santiago MunĂn <santimunin@gmail.com> | |
| 12 | * | |
| 13 | */ | |
| 14 | public class SingleValueAttribute implements Attribute { | |
| 15 | /** | |
| 16 | * Code of the attribute. | |
| 17 | */ | |
| 18 | private String code; | |
| 19 | /** | |
| 20 | * Value of the attribute. | |
| 21 | */ | |
| 22 | private String value; | |
| 23 | ||
| 24 | public SingleValueAttribute(String code, String value) { | |
| 25 | 3 | super(); |
| 26 | 3 | this.code = code; |
| 27 | 3 | this.value = value; |
| 28 | 3 | } |
| 29 | ||
| 30 | /** | |
| 31 | * @return A single pair (attribute[CODE], value) in a | |
| 32 | * <code>Map<String, String></code>. | |
| 33 | */ | |
| 34 | @Override | |
| 35 | public Map<String, String> generatePOSTRequestParameter() { | |
| 36 | 3 | Map<String, String> result = new HashMap<String, String>(); |
| 37 | 3 | result.put("attribute[" + code + "]", value); |
| 38 | 3 | return result; |
| 39 | } | |
| 40 | ||
| 41 | } |