Creates a part from the encoded and decoded strings. @param encoded part string @param decoded part string
(String encoded, String decoded)
| 2056 | * @param decoded part string |
| 2057 | */ |
| 2058 | static Part from(String encoded, String decoded) { |
| 2059 | // We have to check both encoded and decoded in case one is |
| 2060 | // NOT_CACHED. |
| 2061 | |
| 2062 | if (encoded == null) { |
| 2063 | return NULL; |
| 2064 | } |
| 2065 | if (encoded.length() == 0) { |
| 2066 | return EMPTY; |
| 2067 | } |
| 2068 | |
| 2069 | if (decoded == null) { |
| 2070 | return NULL; |
| 2071 | } |
| 2072 | if (decoded .length() == 0) { |
| 2073 | return EMPTY; |
| 2074 | } |
| 2075 | |
| 2076 | return new Part(encoded, decoded); |
| 2077 | } |
| 2078 | |
| 2079 | private static class EmptyPart extends Part { |
| 2080 | public EmptyPart(String value) { |
no test coverage detected