Code example for JsonPrimitive

0
public class JsonSubnetMaskAdapter extends JsonAdapter<SubnetMask> { 
	 
	@Override 
	public JsonElement serialize(SubnetMask src, Type typeOfSrc,
			JsonSerializationContext context) {
		return new JsonPrimitive(src.toDottedString());
	} 
	 
	@Override 
	public SubnetMask deserialize(JsonElement json, Type typeOfT,
			JsonDeserializationContext context) throws JsonParseException {
		return new SubnetMask(json.getAsJsonPrimitive().getAsString());
	} 
	 
} 
Connect your IDE to all the code out there  Get Codota for Java