本文整理汇总了Java中org.apache.cassandra.cql3.Term类的典型用法代码示例。如果您正苦于以下问题:Java Term类的具体用法?Java Term怎么用?Java Term使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Term类属于org.apache.cassandra.cql3包,在下文中一共展示了Term类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: fromJSONObject
import org.apache.cassandra.cql3.Term; //导入依赖的package包/类
@Override
public Term fromJSONObject(Object parsed) throws MarshalException
{
if (parsed instanceof Long)
return new Constants.Value(ByteBufferUtil.bytes((Long) parsed));
try
{
return new Constants.Value(TimestampType.instance.fromString((String) parsed));
}
catch (ClassCastException exc)
{
throw new MarshalException(String.format(
"Expected a long or a datestring representation of a date value, but got a %s: %s",
parsed.getClass().getSimpleName(), parsed));
}
}
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:18,代码来源:DateType.java
示例2: fromJSONObject
import org.apache.cassandra.cql3.Term; //导入依赖的package包/类
@Override
public Term fromJSONObject(Object parsed) throws MarshalException
{
try
{
String parsedString = (String) parsed;
if (!parsedString.startsWith("0x"))
throw new MarshalException(String.format("String representation of blob is missing 0x prefix: %s", parsedString));
return new Constants.Value(BytesType.instance.fromString(parsedString.substring(2)));
}
catch (ClassCastException | MarshalException exc)
{
throw new MarshalException(String.format("Value '%s' is not a valid blob representation: %s", parsed, exc.getMessage()));
}
}
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:17,代码来源:BytesType.java
示例3: fromJSONObject
import org.apache.cassandra.cql3.Term; //导入依赖的package包/类
@Override
public Term fromJSONObject(Object parsed) throws MarshalException
{
try
{
if (parsed instanceof String)
return new Constants.Value(fromString((String) parsed));
Number parsedNumber = (Number) parsed;
if (!(parsedNumber instanceof Integer || parsedNumber instanceof Long))
throw new MarshalException(String.format("Expected a bigint value, but got a %s: %s", parsed.getClass().getSimpleName(), parsed));
return new Constants.Value(getSerializer().serialize(parsedNumber.longValue()));
}
catch (ClassCastException exc)
{
throw new MarshalException(String.format(
"Expected a bigint value, but got a %s: %s", parsed.getClass().getSimpleName(), parsed));
}
}
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:21,代码来源:LongType.java
示例4: fromJSONObject
import org.apache.cassandra.cql3.Term; //导入依赖的package包/类
@Override
public Term fromJSONObject(Object parsed) throws MarshalException
{
try
{
if (parsed instanceof String)
return new Constants.Value(fromString((String) parsed));
Number parsedNumber = (Number) parsed;
if (!(parsedNumber instanceof Integer))
throw new MarshalException(String.format("Expected an int value, but got a %s: %s", parsed.getClass().getSimpleName(), parsed));
return new Constants.Value(getSerializer().serialize(parsedNumber.intValue()));
}
catch (ClassCastException exc)
{
throw new MarshalException(String.format(
"Expected an int value, but got a %s: %s", parsed.getClass().getSimpleName(), parsed));
}
}
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:21,代码来源:Int32Type.java
示例5: fromJSONObject
import org.apache.cassandra.cql3.Term; //导入依赖的package包/类
@Override
public Term fromJSONObject(Object parsed) throws MarshalException
{
try
{
if (parsed instanceof String)
return new Constants.Value(fromString((String) parsed));
else
return new Constants.Value(getSerializer().serialize(((Number) parsed).doubleValue()));
}
catch (ClassCastException exc)
{
throw new MarshalException(String.format(
"Expected a double value, but got a %s: %s", parsed.getClass().getSimpleName(), parsed));
}
}
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:17,代码来源:DoubleType.java
示例6: fromJSONObject
import org.apache.cassandra.cql3.Term; //导入依赖的package包/类
@Override
public Term fromJSONObject(Object parsed) throws MarshalException
{
if (parsed instanceof String)
parsed = Json.decodeJson((String) parsed);
if (!(parsed instanceof List))
throw new MarshalException(String.format(
"Expected a list (representing a set), but got a %s: %s", parsed.getClass().getSimpleName(), parsed));
List list = (List) parsed;
Set<Term> terms = new HashSet<>(list.size());
for (Object element : list)
{
if (element == null)
throw new MarshalException("Invalid null element in set");
terms.add(elements.fromJSONObject(element));
}
return new Sets.DelayedValue(elements, terms);
}
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:22,代码来源:SetType.java
示例7: fromJSONObject
import org.apache.cassandra.cql3.Term; //导入依赖的package包/类
@Override
public Term fromJSONObject(Object parsed) throws MarshalException
{
if (parsed instanceof Long)
return new Constants.Value(ByteBufferUtil.bytes((Long) parsed));
try
{
return new Constants.Value(TimestampType.instance.fromString((String) parsed));
}
catch (ClassCastException exc)
{
throw new MarshalException(String.format(
"Expected a long or a datestring representation of a timestamp value, but got a %s: %s",
parsed.getClass().getSimpleName(), parsed));
}
}
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:18,代码来源:TimestampType.java
示例8: fromJSONObject
import org.apache.cassandra.cql3.Term; //导入依赖的package包/类
@Override
public Term fromJSONObject(Object parsed) throws MarshalException
{
if (parsed instanceof String)
parsed = Json.decodeJson((String) parsed);
if (!(parsed instanceof List))
throw new MarshalException(String.format(
"Expected a list, but got a %s: %s", parsed.getClass().getSimpleName(), parsed));
List list = (List) parsed;
List<Term> terms = new ArrayList<>(list.size());
for (Object element : list)
{
if (element == null)
throw new MarshalException("Invalid null element in list");
terms.add(elements.fromJSONObject(element));
}
return new Lists.DelayedValue(terms);
}
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:22,代码来源:ListType.java
示例9: fromJSONObject
import org.apache.cassandra.cql3.Term; //导入依赖的package包/类
@Override
public Term fromJSONObject(Object parsed) throws MarshalException
{
if (parsed instanceof String)
parsed = Json.decodeJson((String) parsed);
if (!(parsed instanceof Map))
throw new MarshalException(String.format(
"Expected a map, but got a %s: %s", parsed.getClass().getSimpleName(), parsed));
Map<Object, Object> map = (Map<Object, Object>) parsed;
Map<Term, Term> terms = new HashMap<>(map.size());
for (Map.Entry<Object, Object> entry : map.entrySet())
{
if (entry.getKey() == null)
throw new MarshalException("Invalid null key in map");
if (entry.getValue() == null)
throw new MarshalException("Invalid null value in map");
terms.put(keys.fromJSONObject(entry.getKey()), values.fromJSONObject(entry.getValue()));
}
return new Maps.DelayedValue(keys, terms);
}
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:25,代码来源:MapType.java
示例10: fromJSONObject
import org.apache.cassandra.cql3.Term; //导入依赖的package包/类
@Override
public Term fromJSONObject(Object parsed) throws MarshalException
{
try
{
if (parsed instanceof String)
return new Constants.Value(fromString((String) parsed));
else
return new Constants.Value(getSerializer().serialize(((Number) parsed).floatValue()));
}
catch (ClassCastException exc)
{
throw new MarshalException(String.format(
"Expected a float value, but got a %s: %s", parsed.getClass().getSimpleName(), parsed));
}
}
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:17,代码来源:FloatType.java
示例11: prepare
import org.apache.cassandra.cql3.Term; //导入依赖的package包/类
public Term prepare(ColumnSpecification receiver) throws InvalidRequestException
{
Function fun = Functions.get(functionName, terms, receiver);
List<Term> parameters = new ArrayList<Term>(terms.size());
boolean allTerminal = true;
for (int i = 0; i < terms.size(); i++)
{
Term t = terms.get(i).prepare(Functions.makeArgSpec(receiver, fun, i));
if (t instanceof NonTerminal)
allTerminal = false;
parameters.add(t);
}
// If all parameters are terminal and the function is pure, we can
// evaluate it now, otherwise we'd have to wait execution time
return allTerminal && fun.isPure()
? makeTerminal(fun, execute(fun, parameters))
: new FunctionCall(fun, parameters);
}
开发者ID:dprguiuc,项目名称:Cassandra-Wasef,代码行数:21,代码来源:FunctionCall.java
示例12: fromJSONObject
import org.apache.cassandra.cql3.Term; //导入依赖的package包/类
public Term fromJSONObject(Object parsed) throws MarshalException
{
try
{
return new Constants.Value(fromString((String) parsed));
}
catch (ClassCastException exc)
{
throw new MarshalException(String.format(
"Expected a string representation of a time value, but got a %s: %s", parsed.getClass().getSimpleName(), parsed));
}
}
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:13,代码来源:TimeType.java
示例13: fromJSONObject
import org.apache.cassandra.cql3.Term; //导入依赖的package包/类
@Override
public Term fromJSONObject(Object parsed) throws MarshalException
{
if (!(parsed instanceof String))
throw new MarshalException(String.format("Expected an empty string, but got: %s", parsed));
if (!((String) parsed).isEmpty())
throw new MarshalException(String.format("'%s' is not empty", parsed));
return new Constants.Value(ByteBufferUtil.EMPTY_BYTE_BUFFER);
}
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:11,代码来源:EmptyType.java
示例14: fromJSONObject
import org.apache.cassandra.cql3.Term; //导入依赖的package包/类
@Override
public Term fromJSONObject(Object parsed) throws MarshalException
{
try
{
return new Constants.Value(InetAddressType.instance.fromString((String) parsed));
}
catch (ClassCastException exc)
{
throw new MarshalException(String.format(
"Expected a string representation of an inet value, but got a %s: %s", parsed.getClass().getSimpleName(), parsed));
}
}
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:14,代码来源:InetAddressType.java
示例15: fromJSONObject
import org.apache.cassandra.cql3.Term; //导入依赖的package包/类
@Override
public Term fromJSONObject(Object parsed) throws MarshalException
{
try
{
return new Constants.Value(fromString((String) parsed));
}
catch (ClassCastException exc)
{
throw new MarshalException(String.format(
"Expected a UTF-8 string, but got a %s: %s", parsed.getClass().getSimpleName(), parsed));
}
}
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:14,代码来源:UTF8Type.java
示例16: fromJSONObject
import org.apache.cassandra.cql3.Term; //导入依赖的package包/类
@Override
public Term fromJSONObject(Object parsed) throws MarshalException
{
try
{
return new Constants.Value(fromString((String) parsed));
}
catch (ClassCastException exc)
{
throw new MarshalException(String.format(
"Expected an ascii string, but got a %s: %s", parsed.getClass().getSimpleName(), parsed));
}
}
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:14,代码来源:AsciiType.java
示例17: fromJSONObject
import org.apache.cassandra.cql3.Term; //导入依赖的package包/类
public Term fromJSONObject(Object parsed) throws MarshalException
{
if (parsed instanceof String || parsed instanceof Number)
return new Constants.Value(fromString(String.valueOf(parsed)));
throw new MarshalException(String.format(
"Expected a short value, but got a %s: %s", parsed.getClass().getSimpleName(), parsed));
}
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:9,代码来源:ShortType.java
示例18: fromJSONObject
import org.apache.cassandra.cql3.Term; //导入依赖的package包/类
@Override
public Term fromJSONObject(Object parsed) throws MarshalException
{
try
{
return new Constants.Value(getSerializer().serialize(new BigDecimal(parsed.toString())));
}
catch (NumberFormatException exc)
{
throw new MarshalException(String.format("Value '%s' is not a valid representation of a decimal value", parsed));
}
}
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:13,代码来源:DecimalType.java
示例19: fromJSONObject
import org.apache.cassandra.cql3.Term; //导入依赖的package包/类
public Term fromJSONObject(Object parsed) throws MarshalException
{
if (parsed instanceof String || parsed instanceof Number)
return new Constants.Value(fromString(String.valueOf(parsed)));
throw new MarshalException(String.format(
"Expected a byte value, but got a %s: %s", parsed.getClass().getSimpleName(), parsed));
}
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:9,代码来源:ByteType.java
示例20: fromJSONObject
import org.apache.cassandra.cql3.Term; //导入依赖的package包/类
@Override
public Term fromJSONObject(Object parsed) throws MarshalException
{
try
{
return new Constants.Value(getSerializer().serialize(new BigInteger(parsed.toString())));
}
catch (NumberFormatException exc)
{
throw new MarshalException(String.format(
"Value '%s' is not a valid representation of a varint value", parsed));
}
}
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:14,代码来源:IntegerType.java
注:本文中的org.apache.cassandra.cql3.Term类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论