/** * Compose. * * @param value * the value * @param clazz * the clazz * @return the byte[] */ private static byte[] compose(Object value, Class clazz) { return BooleanType.instance.decompose((Boolean) value).array(); }
/** * Decompose. * * @param value * the value * @param clazz * the clazz * @return the object */ private static Object decompose(Object value, Class clazz) { ByteBuffer buf = ByteBuffer.wrap((byte[]) value, 0, ((byte[]) value).length); return BooleanType.instance.compose(buf); } }
@Override public Term fromJSONObject(Object parsed) throws MarshalException { if (parsed instanceof String) return new Constants.Value(fromString((String) parsed)); else if (!(parsed instanceof Boolean)) throw new MarshalException(String.format( "Expected a boolean value, but got a %s: %s", parsed.getClass().getSimpleName(), parsed)); return new Constants.Value(getSerializer().serialize((Boolean) parsed)); }
@Override public String toJSONString(ByteBuffer buffer, ProtocolVersion protocolVersion) { return getSerializer().deserialize(buffer).toString(); }
@Override public Term fromJSONObject(Object parsed) throws MarshalException { if (parsed instanceof String) return new Constants.Value(fromString((String) parsed)); else if (!(parsed instanceof Boolean)) throw new MarshalException(String.format( "Expected a boolean value, but got a %s: %s", parsed.getClass().getSimpleName(), parsed)); return new Constants.Value(getSerializer().serialize((Boolean) parsed)); }
@Override public String toJSONString(ByteBuffer buffer, ProtocolVersion protocolVersion) { return getSerializer().deserialize(buffer).toString(); }
return BooleanType.instance.decompose(Boolean.valueOf(value.toString()));
@Override public Term fromJSONObject(Object parsed) throws MarshalException { if (parsed instanceof String) return new Constants.Value(fromString((String) parsed)); else if (!(parsed instanceof Boolean)) throw new MarshalException(String.format( "Expected a boolean value, but got a %s: %s", parsed.getClass().getSimpleName(), parsed)); return new Constants.Value(getSerializer().serialize((Boolean) parsed)); }
public boolean getBoolean(String column) { return BooleanType.instance.compose(data.get(column)); }
@Override public String toJSONString(ByteBuffer buffer, ProtocolVersion protocolVersion) { return getSerializer().deserialize(buffer).toString(); }
private static byte[] compose(Object value, Class clazz) { return BooleanType.instance.decompose((Boolean) value).array(); }
@Override public Term fromJSONObject(Object parsed) throws MarshalException { if (parsed instanceof String) return new Constants.Value(fromString((String) parsed)); else if (!(parsed instanceof Boolean)) throw new MarshalException(String.format( "Expected a boolean value, but got a %s: %s", parsed.getClass().getSimpleName(), parsed)); return new Constants.Value(getSerializer().serialize((Boolean) parsed)); }
private static Object decompose(Object value, Class clazz) { ByteBuffer buf = ByteBuffer.wrap((byte[]) value, 0, ((byte[]) value).length); return BooleanType.instance.compose(buf); } }
@Override public String toJSONString(ByteBuffer buffer, ProtocolVersion protocolVersion) { return getSerializer().deserialize(buffer).toString(); }
public ByteBuffer fromString(String source) throws MarshalException { if (source.isEmpty()|| source.equalsIgnoreCase(Boolean.FALSE.toString())) return decompose(false); if (source.equalsIgnoreCase(Boolean.TRUE.toString())) return decompose(true); throw new MarshalException(String.format("Unable to make boolean from '%s'", source)); }
public boolean getBoolean(String column) { return BooleanType.instance.compose(data.get(column)); }
public ByteBuffer fromString(String source) throws MarshalException { if (source.isEmpty()|| source.equalsIgnoreCase(Boolean.FALSE.toString())) return decompose(false); if (source.equalsIgnoreCase(Boolean.TRUE.toString())) return decompose(true); throw new MarshalException(String.format("Unable to make boolean from '%s'", source)); }
public boolean getBoolean(String column) { return BooleanType.instance.compose(data.get(column)); }
public ByteBuffer fromString(String source) throws MarshalException { if (source.isEmpty()|| source.equalsIgnoreCase(Boolean.FALSE.toString())) return decompose(false); if (source.equalsIgnoreCase(Boolean.TRUE.toString())) return decompose(true); throw new MarshalException(String.format("unable to make boolean from '%s'", source)); }
public boolean getBoolean(String column) { return BooleanType.instance.compose(data.get(column)); }