List of usage examples for org.apache.cassandra.db.marshal InetAddressType instance
InetAddressType instance
To view the source code for org.apache.cassandra.db.marshal InetAddressType instance.
Click Source Link
From source file:clojurewerkz.cassaforte.Codec.java
License:Apache License
private static AbstractType getCodecInternal(DataType type) { switch (type.getName()) { case ASCII://from w w w .j a v a 2 s. c o m return AsciiType.instance; case BIGINT: return LongType.instance; case BLOB: return BytesType.instance; case BOOLEAN: return BooleanType.instance; case COUNTER: return CounterColumnType.instance; case DECIMAL: return DecimalType.instance; case DOUBLE: return DoubleType.instance; case FLOAT: return FloatType.instance; case INET: return InetAddressType.instance; case INT: return Int32Type.instance; case TEXT: return UTF8Type.instance; case TIMESTAMP: return DateType.instance; case UUID: return UUIDType.instance; case VARCHAR: return UTF8Type.instance; case VARINT: return IntegerType.instance; case TIMEUUID: return TimeUUIDType.instance; case LIST: return ListType.getInstance(getCodec(type.getTypeArguments().get(0))); case SET: return SetType.getInstance(getCodec(type.getTypeArguments().get(0))); case MAP: return MapType.getInstance(getCodec(type.getTypeArguments().get(0)), getCodec(type.getTypeArguments().get(1))); default: throw new RuntimeException("Unknown type"); } }
From source file:com.datastax.driver.core.ArrayBackedRow.java
License:Apache License
public InetAddress getInet(int i) { metadata.checkType(i, DataType.Name.INET); ByteBuffer value = data.get(i); if (value == null || value.remaining() == 0) return null; return InetAddressType.instance.compose(value); }
From source file:com.datastax.driver.core.BoundStatement.java
License:Apache License
/** * Sets the {@code i}th value to the provided inet address. * * @param i the index of the variable to set. * @param v the value to set./* www. j a v a 2 s .c om*/ * @return this BoundStatement. * * @throws IndexOutOfBoundsException if {@code i < 0 || i >= this.preparedStatement().variables().size()}. * @throws InvalidTypeException if column {@code i} is not of type INET. */ public BoundStatement setInet(int i, InetAddress v) { metadata().checkType(i, DataType.Name.INET); return setValue(i, v == null ? null : InetAddressType.instance.decompose(v)); }
From source file:com.datastax.driver.core.Codec.java
License:Apache License
private static AbstractType<?> getCodecInternal(DataType type) { switch (type.getName()) { case ASCII://from www . j av a 2 s .c om return AsciiType.instance; case BIGINT: return LongType.instance; case BLOB: return BytesType.instance; case BOOLEAN: return BooleanType.instance; case COUNTER: return CounterColumnType.instance; case DECIMAL: return DecimalType.instance; case DOUBLE: return DoubleType.instance; case FLOAT: return FloatType.instance; case INET: return InetAddressType.instance; case INT: return Int32Type.instance; case TEXT: return UTF8Type.instance; case TIMESTAMP: return DateType.instance; case UUID: return UUIDType.instance; case VARCHAR: return UTF8Type.instance; case VARINT: return IntegerType.instance; case TIMEUUID: return TimeUUIDType.instance; case LIST: return ListType.getInstance(getCodec(type.getTypeArguments().get(0))); case SET: return SetType.getInstance(getCodec(type.getTypeArguments().get(0))); case MAP: return MapType.getInstance(getCodec(type.getTypeArguments().get(0)), getCodec(type.getTypeArguments().get(1))); // We don't interpret custom values in any way case CUSTOM: return BytesType.instance; default: throw new RuntimeException("Unknown type"); } }
From source file:com.datastax.driver.core.Row.java
License:Apache License
/** * Returns the {@code i}th value of this row as an InetAddress. * * @param i the index ({@code 0 <= i < size()}) of the column to retrieve. * @return the value of the {@code i}th column in this row as an InetAddress. * If the value is NULL, {@code null} is returned. * * @throws IndexOutOfBoundsException if {@code i < 0 || i >= this.columns().size()}. * @throws InvalidTypeException if column {@code i} is not of type INET. */// w w w . j av a2 s.c om public InetAddress getInet(int i) { metadata.checkType(i, DataType.Name.INET); ByteBuffer value = data.get(i); if (value == null || value.remaining() == 0) return null; return InetAddressType.instance.compose(value); }
From source file:com.stratio.cassandra.index.schema.ColumnMapperInet.java
License:Apache License
/** * Builds a new {@link ColumnMapperInet}. *//*from w ww . j ava 2 s . com*/ @JsonCreator public ColumnMapperInet() { super(new AbstractType<?>[] { AsciiType.instance, UTF8Type.instance, InetAddressType.instance }, new AbstractType[] {}); }
From source file:com.stratio.cassandra.index.schema.ColumnMapperString.java
License:Apache License
/** * Builds a new {@link ColumnMapperString}. *//*from w w w . ja va2s. c om*/ @JsonCreator public ColumnMapperString() { super(new AbstractType<?>[] { AsciiType.instance, UTF8Type.instance, Int32Type.instance, LongType.instance, IntegerType.instance, FloatType.instance, DoubleType.instance, BooleanType.instance, UUIDType.instance, TimeUUIDType.instance, TimestampType.instance, BytesType.instance, InetAddressType.instance }, new AbstractType[] { UTF8Type.instance }); }
From source file:com.stratio.cassandra.index.schema.ColumnMapperText.java
License:Apache License
/** * Builds a new {@link ColumnMapperText} using the specified Lucene {@link Analyzer}. * @param analyzerClassName The Lucene {@link Analyzer} to be used. *//*from www .j a va 2 s . c o m*/ @JsonCreator public ColumnMapperText(@JsonProperty("analyzer") String analyzerClassName) { super(new AbstractType<?>[] { AsciiType.instance, UTF8Type.instance, Int32Type.instance, LongType.instance, IntegerType.instance, FloatType.instance, DoubleType.instance, BooleanType.instance, UUIDType.instance, TimeUUIDType.instance, TimestampType.instance, BytesType.instance, InetAddressType.instance }, new AbstractType[] {}); if (analyzerClassName != null) { this.analyzer = AnalyzerFactory.getAnalyzer(analyzerClassName); } else { this.analyzer = Schema.DEFAULT_ANALYZER; } }
From source file:com.stratio.cassandra.lucene.schema.mapping.InetMapper.java
License:Apache License
/** * Builds a new {@link InetMapper}./* w w w. ja v a 2 s .com*/ * * @param name The name of the mapper. * @param indexed If the field supports searching. * @param sorted If the field supports sorting. */ public InetMapper(String name, Boolean indexed, Boolean sorted) { super(name, indexed, sorted, AsciiType.instance, UTF8Type.instance, InetAddressType.instance); }
From source file:com.stratio.cassandra.lucene.schema.mapping.StringMapper.java
License:Apache License
/** * Builds a new {@link StringMapper}.//w w w . jav a 2s .c o m * * @param name The name of the mapper. * @param indexed If the field supports searching. * @param sorted If the field supports sorting. * @param caseSensitive If the getAnalyzer must be case sensitive. */ public StringMapper(String name, Boolean indexed, Boolean sorted, Boolean caseSensitive) { super(name, indexed, sorted, AsciiType.instance, UTF8Type.instance, Int32Type.instance, LongType.instance, IntegerType.instance, FloatType.instance, DoubleType.instance, BooleanType.instance, UUIDType.instance, TimeUUIDType.instance, TimestampType.instance, BytesType.instance, InetAddressType.instance); this.caseSensitive = caseSensitive == null ? DEFAULT_CASE_SENSITIVE : caseSensitive; }