List of usage examples for com.fasterxml.jackson.core JsonParser getByteValue
public byte getByteValue() throws IOException, JsonParseException
From source file:org.example.testcases.BasicTypesDeSerializer.java
private BasicTypes readObject(JsonParser jp) throws IOException { BasicTypes basicTypes = new BasicTypes(); for (JsonToken jsonToken; (jsonToken = jp.nextToken()) != null && (jsonToken != END_OBJECT);) { if (FIELD_NAME != jsonToken) continue; final String fieldName = jp.getCurrentName(); switch (fieldName) { case "aString": jsonToken = jp.nextToken(); // read value basicTypes.aString = jp.getText(); break; case "aBoolean": jsonToken = jp.nextToken(); // read value basicTypes.aBoolean = jp.getBooleanValue(); break; case "aFloat": jsonToken = jp.nextToken(); // read value basicTypes.aFloat = jp.getFloatValue(); break; case "aDouble": jsonToken = jp.nextToken(); // read value basicTypes.aDouble = jp.getDoubleValue(); break; case "aInt": jsonToken = jp.nextToken(); // read value basicTypes.aInt = jp.getIntValue(); break; case "aShort": jsonToken = jp.nextToken(); // read value basicTypes.aShort = jp.getShortValue(); break; case "aByte": jsonToken = jp.nextToken(); // read value basicTypes.aByte = jp.getByteValue(); break; default:// ww w. j a va2 s .co m // decide what to do; } } return basicTypes; }
From source file:org.hippoecm.frontend.service.restproxy.custom.json.deserializers.AnnotationJsonDeserializer.java
protected Byte[] deserializeByteArrayAnnotationAttribute(JsonParser jsonParser) throws JsonParseException, IOException { List<Byte> byteArray = new ArrayList<Byte>(); while (jsonParser.nextToken() != JsonToken.END_ARRAY) { byteArray.add(jsonParser.getByteValue()); }// ww w.j av a2 s.c om return byteArray.toArray(new Byte[byteArray.size()]); }