return (T) (Byte) id.getAsByte();
@Override public EntityData.Value deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { EntityData.Value.Builder value = EntityData.Value.newBuilder(); if (json.isJsonPrimitive()) { extractPrimitive(value, json); } else if (json.isJsonObject()) { extractMap(json, context, value); } else if (json.isJsonArray()) { JsonArray jsonArray = json.getAsJsonArray(); TByteList byteList = new TByteArrayList(); for (JsonElement element : jsonArray) { if (element.isJsonArray()) { value.addValue((EntityData.Value) context.deserialize(element, EntityData.Value.class)); } else if (element.isJsonObject()) { value.addValue((EntityData.Value) context.deserialize(element, EntityData.Value.class)); } else if (element.isJsonPrimitive()) { extractPrimitive(value, element); if (element.getAsJsonPrimitive().isNumber()) { try { byteList.add(element.getAsByte()); } catch (NumberFormatException nfe) { byteList.add((byte) 0); } } } } value.setBytes(ByteString.copyFrom(byteList.toArray())); } return value.build(); }
@Override public byte getAsByte() { if (elements.size() == 1) { return elements.get(0).getAsByte(); } throw new IllegalStateException(); }
@Override public Byte deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { return json.getAsByte(); }
public static Byte getByteFromJson(JsonElement value) { if (value.isJsonNull()) { return null; } return value.getAsByte(); }
@Override public byte getAsByte() { if (elements.size() == 1) { return elements.get(0).getAsByte(); } throw new IllegalStateException(); }
@Override public byte getAsByte() { if (elements.size() == 1) { return elements.get(0).getAsByte(); } throw new IllegalStateException(); }
@Override public byte getAsByte() { if (elements.size() == 1) { return elements.get(0).getAsByte(); } throw new IllegalStateException(); }
@Override public byte getAsByte() { if (elements.size() == 1) { return elements.get(0).getAsByte(); } throw new IllegalStateException(); }
@Override public byte getAsByte() { if (elements.size() == 1) { return elements.get(0).getAsByte(); } throw new IllegalStateException(); }
private byte[] getKey(final JsonArray array) { final byte[] key = new byte[array.size()]; for (int i = 0; i < array.size(); i++) { key[i] = array.get(i).getAsByte(); } return key; }
@Override public byte getAsByte() { if (elements.size() == 1) { return elements.get(0).getAsByte(); } throw new IllegalStateException(); }
@Override public byte getAsByte() { if (elements.size() == 1) { return elements.get(0).getAsByte(); } throw new IllegalStateException(); }
private byte[] generateBaseQualities(JsonArray alignedQuality) { byte[] baseQualities = new byte[alignedQuality.size()]; Iterator<JsonElement> iter = alignedQuality.iterator(); int i = 0; while (iter.hasNext()) { baseQualities[i++] = iter.next().getAsByte(); } return baseQualities; }
public static byte asByte(JsonObject json, Object... path) { JsonElement elem = asJson(json, path); return elem == null ? null : elem.getAsByte(); }
@Override public void byteProperty(PropertyName name, JsonObject context) throws IOException { JsonElement prop = property(context, name); if (prop == null) { return; } builder.add(name, prop.getAsByte()); }
final int ttl = publish.get("ttl").getAsByte();
public Byte deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { try { return json.getAsByte(); } catch (NumberFormatException e) { throw new JsonSyntaxException(e); } catch (UnsupportedOperationException e) { throw new JsonSyntaxException(e); } catch (IllegalStateException e) { throw new JsonSyntaxException(e); } }
return (T) (Character) input.getAsCharacter(); } else if (expected == byte.class || expected == Byte.class) { return (T) (Byte) input.getAsByte(); } else if (expected == short.class || expected == Short.class) { return (T) (Short) input.getAsShort();
return (T) (Byte) id.getAsByte();