(Dict.Prop<T> key, Object value, Function<String, Box> alias, Predicate<Node> load)
| 200 | Pattern extractClass = Pattern.compile("%%(.*?)%%(.*)", Pattern.DOTALL); |
| 201 | |
| 202 | private <T> T fromValue(Dict.Prop<T> key, Object value, Function<String, Box> alias, Predicate<Node> load) throws InstantiationException, IllegalAccessException, IOException, ClassNotFoundException { |
| 203 | if (value == null) return null; |
| 204 | |
| 205 | if (value instanceof String) { |
| 206 | if (((String) value).startsWith("%%")) { |
| 207 | Matcher m = extractClass.matcher(((String) value)); |
| 208 | m.find(); |
| 209 | String className = m.group(1); |
| 210 | String content = m.group(2); |
| 211 | |
| 212 | return (T) fromValue(key, className, content, alias, load); |
| 213 | } |
| 214 | } |
| 215 | |
| 216 | if (value instanceof Node) { |
| 217 | // consider this a little... |
| 218 | Log.log("error.raft", () -> "cannot deserialize box reference"); |
| 219 | return null; |
| 220 | // return (T) _loadBox((String) ((Node) value).getProperty("uid"), alias, load); |
| 221 | } |
| 222 | |
| 223 | return (T) value; |
| 224 | } |
| 225 | |
| 226 | |
| 227 |
no test coverage detected