@Deprecated public static JavaType mapType(Class<? extends Map> mapType, JavaType keyType, JavaType valueType) { return instance.constructMapType(mapType, keyType, valueType); }
@Deprecated public static JavaType mapType(Class<? extends Map> mapClass, Class<?> keyType, Class<?> valueType) { return instance.constructMapType(mapClass, type(keyType), instance.constructType(valueType)); }
public static KafkaCheckpoint deserialize(InputStream inputStream) throws IOException { TypeFactory typeFactory = _mapper.getTypeFactory(); MapType mapType = typeFactory.constructMapType(HashMap.class, Integer.class, Long.class); HashMap<Integer, Long> checkpoint = _mapper.readValue(inputStream, mapType); return new KafkaCheckpoint(checkpoint); }
throw new IllegalArgumentException("Need exactly 2 parameter types for Map types ("+parametrized.getName()+")"); resultType = constructMapType((Class<Map<?,?>>)parametrized, parameterTypes[0], parameterTypes[1]);
Class<?> valueClass = Object.class; str = TypeFactory.defaultInstance().constructMapType(EnumMap.class, enumClass, valueClass).toCanonical(); } else { String end = str.substring(9);
@Deprecated public static JavaType mapType(Class<? extends Map> mapType, JavaType keyType, JavaType valueType) { return instance.constructMapType(mapType, keyType, valueType); }
@Deprecated public static JavaType mapType(Class<? extends Map> mapClass, Class<?> keyType, Class<?> valueType) { return instance.constructMapType(mapClass, type(keyType), instance.constructType(valueType)); }
throw new IllegalArgumentException("Need exactly 2 parameter types for Map types ("+parametrized.getName()+")"); resultType = constructMapType((Class<Map<?,?>>)parametrized, parameterTypes[0], parameterTypes[1]);
Class<?> valueClass = Object.class; str = TypeFactory.defaultInstance().constructMapType(EnumMap.class, enumClass, valueClass).toCanonical(); } else { String end = str.substring(9);
public static Map<String, Object> string2Map(String json) { JavaType type = typeFactory.constructMapType(HashMap.class, String.class, Object.class); try { return MAPPER.readValue(json, type); } catch(Exception e) { return null; } }
public static <K, V> Map<K, V> string2Map(String json, Class<K> keyClazz, Class<V> valueClazz) { JavaType type = typeFactory.constructMapType(HashMap.class, keyClazz, valueClazz); try { return MAPPER.readValue(json, type); } catch(Exception e) { return null; } }
@Deprecated @SuppressWarnings("unchecked") public static JavaType mapType(Class<? extends Map> mapType, JavaType keyType, JavaType valueType) { return instance.constructMapType(mapType, keyType, valueType); }
public static Map<String, Object> jsonToMap(String jsonString) throws IOException { ObjectMapper mapper = new ObjectMapper(); MapType type = mapper.getTypeFactory().constructMapType(Map.class, String.class, Object.class); Map<String, Object> data = mapper.readValue(jsonString, type); return data; }
public static KafkaCheckpoint deserialize(InputStream inputStream) throws IOException { TypeFactory typeFactory = _mapper.getTypeFactory(); MapType mapType = typeFactory.constructMapType(HashMap.class, Integer.class, Long.class); HashMap<Integer, Long> checkpoint = _mapper.readValue(inputStream, mapType); return new KafkaCheckpoint(checkpoint); }
public static KafkaCheckpoint deserialize(InputStream inputStream) throws IOException { TypeFactory typeFactory = _mapper.getTypeFactory(); MapType mapType = typeFactory.constructMapType(HashMap.class, Integer.class, Long.class); HashMap<Integer, Long> checkpoint = _mapper.readValue(inputStream, mapType); return new KafkaCheckpoint(checkpoint); }
@Override public <K, V> Map<K, V> readMap(String json, Class<K> keyClass, Class<V> valueClass) throws CoreRtException { TypeFactory typeFactory = TypeFactory.defaultInstance(); MapType mapType = typeFactory.constructMapType(HashMap.class, keyClass, valueClass); try { return OBJECT_MAPPER.readValue(json, mapType); } catch (IOException e) { throw new CoreRtException(e); } }
@Deprecated public static JavaType mapType(Class<? extends Map> mapClass, Class<?> keyType, Class<?> valueType) { return instance.constructMapType(mapClass, type(keyType), instance.constructType(valueType)); }
public static KafkaCheckpoint deserialize(InputStream inputStream) throws IOException { TypeFactory typeFactory = _mapper.getTypeFactory(); MapType mapType = typeFactory.constructMapType(HashMap.class, Integer.class, Long.class); HashMap<Integer, Long> checkpoint = _mapper.readValue(inputStream, mapType); return new KafkaCheckpoint(checkpoint); }
@Deprecated @SuppressWarnings("unchecked") public static JavaType mapType(Class<? extends Map> mapClass, Class<?> keyType, Class<?> valueType) { return instance.constructMapType(mapClass, type(keyType), instance.constructType(valueType)); }
@Test public void testContentFail() throws Exception { KeyStore.PrivateKeyEntry entry = getPrivateKeyEntry(getKeyStore("PKCS12", "ticket/ca1test2.p12", "test2"), "1", "test2"); Map<String, String> map = new ObjectMapper().readValue( Base64.decodeBase64(new TicketEncoder(entry.getCertificate(), entry.getPrivateKey()).encode("content")), TypeFactory.defaultInstance().constructMapType(HashMap.class, String.class, String.class) ); map.put("data", "Content"); String modifiedTicket = new Base64(0).encodeToString(new ObjectMapper().writeValueAsString(map).getBytes( StandardCharsets.UTF_8)); assertThrows(GeneralSecurityException.class, () -> new TicketDecoder(getKeyStore("JKS", "ticket/ca1.jks", "changeit"), "1.2.3.4").decode(modifiedTicket)); }