@SuppressWarnings("unchecked") public <T> AbstractComposite setComponent(int index, T value, Serializer<T> s, String comparator, ComponentEquality equality) { serialized = null; while (components.size() <= index) { components.add(null); } components.set(index, new Component(value, null, s, comparator, equality)); return this; }
@SuppressWarnings("unchecked") public <T> AbstractComposite addComponent(int index, T value, Serializer<T> s, String comparator, ComponentEquality equality) { serialized = null; if (value == null) { throw new NullPointerException("Unable able to add null component"); } if (index < 0) { index = components.size(); } while (components.size() < index) { components.add(null); } components.add(index, new Component(value, null, s, comparator, equality)); return this; }
@SuppressWarnings("unchecked") public void deserialize(ByteBuffer b) { serialized = b.duplicate(); components = new ArrayList<Component<?>>(); String comparator = null; int i = 0; while ((comparator = getComparator(i, b)) != null) { ByteBuffer data = getWithShortLength(b); if (data != null) { Serializer<?> s = getSerializer(i, comparator); ComponentEquality equality = ComponentEquality.fromByte(b.get()); components.add(new Component(null, data.slice(), s, comparator, equality)); } else { throw new RuntimeException("Missing component data in composite type"); } i++; } }
@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; }
@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; }
@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)); return this; }
@SuppressWarnings("unchecked") public void deserialize(ByteBuffer b) { serialized = b.duplicate(); components = new ArrayList<Component<?>>(); String comparator = null; int i = 0; while ((comparator = getComparator(i, b)) != null) { ByteBuffer data = getWithShortLength(b); if (data != null) { Serializer<?> s = getSerializer(i, comparator); ComponentEquality equality = ComponentEquality.fromByte(b.get()); components.add(new Component(null, data.slice(), s, comparator, equality)); } else { throw new RuntimeException("Missing component data in composite type"); } i++; } }
@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; }
@SuppressWarnings("unchecked") public void deserialize(ByteBuffer b) { serialized = b.duplicate(); components = new ArrayList<Component<?>>(); String comparator = null; int i = 0; while ((comparator = getComparator(i, b)) != null) { ByteBuffer data = getWithShortLength(b); if (data != null) { Serializer<?> s = getSerializer(i, comparator); ComponentEquality equality = ComponentEquality.fromByte(b.get()); components.add(new Component(null, data.slice(), s, comparator, equality)); } else { throw new RuntimeException("Missing component data in composite type"); } i++; } }
@SuppressWarnings("unchecked") public <T> AbstractComposite addComponent(int index, T value, Serializer<T> s, String comparator, ComponentEquality equality) { serialized = null; if (value == null) { throw new NullPointerException("Unable able to add null component"); } if (index < 0) { index = components.size(); } while (components.size() < index) { components.add(null); } components.add(index, new Component(value, null, s, comparator, equality)); return this; }
@SuppressWarnings("unchecked") public <T> AbstractComposite addComponent(int index, T value, Serializer<T> s, String comparator, ComponentEquality equality) { serialized = null; if (value == null) { throw new NullPointerException("Unable able to add null component"); } if (index < 0) { index = components.size(); } while (components.size() < index) { components.add(null); } components.add(index, new Component(value, null, s, comparator, equality)); return this; }
@SuppressWarnings("unchecked") public <T> AbstractComposite setComponent(int index, T value, Serializer<T> s, String comparator, ComponentEquality equality) { serialized = null; while (components.size() <= index) { components.add(null); } components.set(index, new Component(value, null, s, comparator, equality)); return this; }
@SuppressWarnings("unchecked") public <T> AbstractComposite setComponent(int index, T value, Serializer<T> s, String comparator, ComponentEquality equality) { serialized = null; while (components.size() <= index) { components.add(null); } components.set(index, new Component(value, null, s, comparator, equality)); return this; }
@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; }
@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; }