コード例 #1
0
ファイル: CassandraUtils.java プロジェクト: forjsharp/archiva
  public static <A, B> HColumn<A, B> column(final A name, final B value) {

    return HFactory.createColumn(
        name, //
        value, //
        (Serializer<A>) SerializerTypeInferer.getSerializer(name), //
        (Serializer<B>) SerializerTypeInferer.getSerializer(value));
  }
コード例 #2
0
  @SuppressWarnings("unchecked")
  @Override
  public Object set(int index, Object element) {
    serialized = null;

    if (element instanceof Component) {
      Component prev = components.set(index, (Component<?>) element);
      if (prev != null) {
        return prev.getValue();
      }
      return null;
    }

    element = mapIfNumber(element);
    Serializer s = serializerForPosition(index);
    if (s == null) {
      s = SerializerTypeInferer.getSerializer(element);
    }
    String c = comparatorForPosition(index);
    if (c == null) {
      c = comparatorForSerializer(s);
    }
    Component prev =
        components.set(index, new Component(element, null, s, c, ComponentEquality.EQUAL));
    if (prev != null) {
      return prev.getValue();
    }
    return null;
  }
コード例 #3
0
  @SuppressWarnings("unchecked")
  public <T> AbstractComposite addComponent(int index, T element, ComponentEquality equality) {
    serialized = null;

    if (element instanceof Component) {
      components.add(index, (Component<?>) element);
      return this;
    }

    Serializer s = serializerForPosition(index);
    if (s == null) {
      s = SerializerTypeInferer.getSerializer(element);
    }
    String c = comparatorForPosition(index);
    if (c == null) {
      c = comparatorForSerializer(s);
    }
    components.add(index, new Component(element, null, s, c, equality));
    setSerializerByPosition(index, s);
    return this;
  }
コード例 #4
0
 @SuppressWarnings("unchecked")
 public <V> HColumn<N, V> querySingleColumn(K key, N columnName, Class<V> valueClass) {
   return querySingleColumn(
       key, columnName, (Serializer<V>) SerializerTypeInferer.getSerializer(valueClass));
 }