/** * Compose and add. * * @param entity * the entity * @param cqlMetadata * the cql metadata * @param thriftColumnValue * the thrift column value * @param thriftColumnName * the thrift column name */ private void composeAndAdd(HashMap entity, CqlMetadata cqlMetadata, Object thriftColumnValue, String thriftColumnName) { byte[] columnName = thriftColumnName.getBytes(); Map<ByteBuffer, String> schemaTypes = this.clientBase.getCqlMetadata().getValue_types(); AbstractType<?> type = null; try { type = TypeParser.parse(schemaTypes.get(ByteBuffer.wrap((byte[]) columnName))); } catch (SyntaxException | ConfigurationException e) { log.error(e.getMessage()); throw new KunderaException("Error while parsing CQL Type " + e); } entity.put(thriftColumnName, type.compose(ByteBuffer.wrap((byte[]) thriftColumnValue))); }
/** * Compose column value. * * @param cqlMetadata * the cql metadata * @param thriftColumnValue * the thrift column value * @param thriftColumnName * the thrift column name * @return the object */ private Object composeColumnValue(CqlMetadata cqlMetadata, byte[] thriftColumnValue, byte[] thriftColumnName) { Map<ByteBuffer, String> schemaTypes = cqlMetadata.getValue_types(); AbstractType<?> type = null; try { type = TypeParser.parse(schemaTypes.get(ByteBuffer.wrap(thriftColumnName))); } catch (SyntaxException | ConfigurationException ex) { log.error(ex.getMessage()); throw new KunderaException("Error while deserializing column value " + ex); } if (type.isCollection()) { return ((CollectionSerializer) type.getSerializer()) .deserializeForNativeProtocol(ByteBuffer.wrap(thriftColumnValue), ProtocolVersion.V2); } return type.compose(ByteBuffer.wrap(thriftColumnValue)); }
private static AbstractType<?> parseType(String str) { return TypeParser.parse(str); }
public Custom(String className) throws SyntaxException, ConfigurationException { this(TypeParser.parse(className)); }
public Custom(String className) throws SyntaxException, ConfigurationException { this(TypeParser.parse(className)); }
private static AbstractType<?> parseType(String str) { return TypeParser.parse(str); }
private static AbstractType<?> parseType(String str) { return TypeParser.parse(str); }
public static AbstractType<?> parse(CharSequence compareWith) throws SyntaxException, ConfigurationException { return parse(compareWith == null ? null : compareWith.toString()); }
public static AbstractType<?> parse(CharSequence compareWith) throws SyntaxException, ConfigurationException { return parse(compareWith == null ? null : compareWith.toString()); }
public static AbstractType<?> parse(CharSequence compareWith) throws SyntaxException, ConfigurationException { return parse(compareWith == null ? null : compareWith.toString()); }
public static AbstractType<?> parse(CharSequence compareWith) throws SyntaxException, ConfigurationException { return parse(compareWith == null ? null : compareWith.toString()); }
private static List<AbstractType<?>> argsListFromString(String s) { List<AbstractType<?>> argTypes = new ArrayList<>(); for(String type : Splitter.on("^").omitEmptyStrings().trimResults().split(s)) argTypes.add(TypeParser.parse(type)); return argTypes; } }
private static List<AbstractType<?>> argsListFromString(String s) { List<AbstractType<?>> argTypes = new ArrayList<>(); for(String type : Splitter.on("^").omitEmptyStrings().trimResults().split(s)) argTypes.add(TypeParser.parse(type)); return argTypes; } }
private AbstractType<?> readType(DataInputPlus in) throws IOException { ByteBuffer raw = ByteBufferUtil.readWithVIntLength(in); return TypeParser.parse(UTF8Type.instance.compose(raw)); }
private AbstractType<?> readType(DataInputPlus in) throws IOException { ByteBuffer raw = ByteBufferUtil.readWithVIntLength(in); return TypeParser.parse(UTF8Type.instance.compose(raw)); }
private AbstractType<?> readType(DataInputPlus in) throws IOException { ByteBuffer raw = ByteBufferUtil.readWithVIntLength(in); return TypeParser.parse(UTF8Type.instance.compose(raw)); }
private AbstractType<?> readType(DataInputPlus in) throws IOException { ByteBuffer raw = ByteBufferUtil.readWithVIntLength(in); return TypeParser.parse(UTF8Type.instance.compose(raw)); }
public AbstractType<?> getComparator() throws ConfigurationException, SyntaxException { return TypeParser.parse((comparators.get(getPropertyString(KW_COMPARATOR, "text")) != null) ? comparators.get(getPropertyString(KW_COMPARATOR, "text")) : getPropertyString(KW_COMPARATOR, "text")); }
private static List<AbstractType<?>> argsListFromString(String s) { List<AbstractType<?>> argTypes = new ArrayList<>(); for(String type : Splitter.on("^").omitEmptyStrings().trimResults().split(s)) argTypes.add(TypeParser.parse(type)); return argTypes; } }