예제 #1
0
  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));
 }