public static RegularImmutableSortedSet<Object> instantiate(SerializationStreamReader reader) throws SerializationException { /* * Nothing we can do, but we're already assuming the serialized form is * correctly typed, anyway. */ @SuppressWarnings("unchecked") Comparator<Object> comparator = (Comparator<Object>) reader.readObject(); List<Object> elements = new ArrayList<Object>(); Collection_CustomFieldSerializerBase.deserialize(reader, elements); /* * For this custom field serializer to be invoked, the set must have been * RegularImmutableSortedSet before it's serialized. Since * RegularImmutableSortedSet always have one or more elements, * ImmutableSortedSet.copyOf always return a RegularImmutableSortedSet back. */ return (RegularImmutableSortedSet<Object>) ImmutableSortedSet.copyOf(comparator, elements); }
public static void serialize(SerializationStreamWriter writer, Range<?> instance) throws SerializationException { if (instance.hasLowerBound()) { writer.writeBoolean(true); writer.writeBoolean(instance.lowerBoundType() == BoundType.CLOSED); writer.writeObject(instance.lowerEndpoint()); } else { writer.writeBoolean(false); } if (instance.hasUpperBound()) { writer.writeBoolean(true); writer.writeBoolean(instance.upperBoundType() == BoundType.CLOSED); writer.writeObject(instance.upperEndpoint()); } else { writer.writeBoolean(false); } }
/** * Generate dataset module based on path and id * * @param path * dataset path * @param id * dataset uuid * @return Dataset * @throws Exception */ public static Dataset buildDataset(String path, String id) throws Exception { if (HDFSIO.exist(path)) { Dataset dataset = new Dataset(); List list; try { Dataset temp = SecureDao.getObject(dataset, " and id = '" + id + "'"); if ( temp != null ) { dataset = temp; } else { dataset.setId(id); dataset.setName("id" + id); dataset.setPath(path); } } catch (Exception e) { e.printStackTrace(); throw new SerializationException(e); } return dataset; } else { System.out.println("DataSet is return null"); return null; } }
public static LinkedListMultimap<Object, Object> instantiate(SerializationStreamReader in) throws SerializationException { LinkedListMultimap<Object, Object> multimap = LinkedListMultimap.create(); int size = in.readInt(); for (int i = 0; i < size; i++) { Object key = in.readObject(); Object value = in.readObject(); multimap.put(key, value); } return multimap; }
public static ImmutableTable<Object, Object, Object> instantiate(SerializationStreamReader reader) throws SerializationException { ImmutableTable.Builder<Object, Object, Object> builder = ImmutableTable.builder(); int rowCount = reader.readInt(); for (int i = 0; i < rowCount; i++) { Object rowKey = reader.readObject(); int colCount = reader.readInt(); for (int j = 0; j < colCount; j++) { builder.put(rowKey, reader.readObject(), reader.readObject()); } } return builder.build(); }
public static void serialize( SerializationStreamWriter writer, ImmutableTable<Object, Object, Object> table) throws SerializationException { writer.writeInt(table.rowKeySet().size()); for (Object rowKey : table.rowKeySet()) { writer.writeObject(rowKey); Map_CustomFieldSerializerBase.serialize(writer, table.row(rowKey)); } }
static ImmutableSortedMap<Object, Object> instantiate(SerializationStreamReader reader) throws SerializationException { /* * Nothing we can do, but we're already assuming the serialized form is * correctly typed, anyway. */ @SuppressWarnings("unchecked") Comparator<Object> comparator = (Comparator<Object>) reader.readObject(); SortedMap<Object, Object> entries = new TreeMap<Object, Object>(comparator); Map_CustomFieldSerializerBase.deserialize(reader, entries); return ImmutableSortedMap.orderedBy(comparator).putAll(entries).build(); }
@CanIgnoreReturnValue public static Multimap<Object, Object> populate( SerializationStreamReader reader, Multimap<Object, Object> multimap) throws SerializationException { int keyCount = reader.readInt(); for (int i = 0; i < keyCount; ++i) { Object key = reader.readObject(); int valueCount = reader.readInt(); for (int j = 0; j < valueCount; ++j) { Object value = reader.readObject(); multimap.put(key, value); } } return multimap; }
public static void serialize(SerializationStreamWriter writer, Multimap<?, ?> instance) throws SerializationException { writer.writeInt(instance.asMap().size()); for (Map.Entry<?, ? extends Collection<?>> entry : instance.asMap().entrySet()) { writer.writeObject(entry.getKey()); writer.writeInt(entry.getValue().size()); for (Object value : entry.getValue()) { writer.writeObject(value); } } }
static Multiset<Object> populate(SerializationStreamReader reader, Multiset<Object> multiset) throws SerializationException { int distinctElements = reader.readInt(); for (int i = 0; i < distinctElements; i++) { Object element = reader.readObject(); int count = reader.readInt(); multiset.add(element, count); } return multiset; }
static void serialize(SerializationStreamWriter writer, Multiset<?> instance) throws SerializationException { int entryCount = instance.entrySet().size(); writer.writeInt(entryCount); for (Multiset.Entry<?> entry : instance.entrySet()) { writer.writeObject(entry.getElement()); writer.writeInt(entry.getCount()); } }
@SuppressWarnings("unchecked") public static TreeMultimap<Object, Object> instantiate(SerializationStreamReader in) throws SerializationException { Comparator<Object> keyComparator = (Comparator<Object>) in.readObject(); Comparator<Object> valueComparator = (Comparator<Object>) in.readObject(); return (TreeMultimap<Object, Object>) Multimap_CustomFieldSerializerBase.populate( in, TreeMultimap.create(keyComparator, valueComparator)); }
public static RegularImmutableAsList<Object> instantiate(SerializationStreamReader reader) throws SerializationException { ArrayList<Object> elements = new ArrayList<Object>(); Collection_CustomFieldSerializerBase.deserialize(reader, elements); ImmutableList<Object> delegate = ImmutableList.copyOf(elements); return new RegularImmutableAsList<Object>(delegate, delegate); }
static <T extends StandardTable<Object, Object, Object>> T populate( SerializationStreamReader reader, T table) throws SerializationException { Map<?, ?> hashMap = (Map<?, ?>) reader.readObject(); for (Entry<?, ?> row : hashMap.entrySet()) { table.row(row.getKey()).putAll((Map<?, ?>) row.getValue()); } return table; }
public static void serialize( SerializationStreamWriter writer, RegularImmutableSortedSet<?> instance) throws SerializationException { writer.writeObject(instance.comparator()); Collection_CustomFieldSerializerBase.serialize(writer, instance); }
public static RegularImmutableSet<Object> instantiate(SerializationStreamReader reader) throws SerializationException { List<Object> elements = Lists.newArrayList(); Collection_CustomFieldSerializerBase.deserialize(reader, elements); /* * For this custom field serializer to be invoked, the set must have been * RegularImmutableSet before it's serialized. Since RegularImmutableSet * always have two or more elements, ImmutableSet.copyOf always return * a RegularImmutableSet back. */ return (RegularImmutableSet<Object>) ImmutableSet.copyOf(elements); }
public static <E extends Enum<E>> ImmutableEnumSet<?> instantiate( SerializationStreamReader reader) throws SerializationException { List<E> deserialized = Lists.newArrayList(); Collection_CustomFieldSerializerBase.deserialize(reader, deserialized); /* * It is safe to cast to ImmutableEnumSet because in order for it to be * serialized as an ImmutableEnumSet, it must be non-empty to start * with. */ return (ImmutableEnumSet<?>) Sets.immutableEnumSet(deserialized); }
public static Range<?> instantiate(SerializationStreamReader reader) throws SerializationException { Cut lowerBound; boolean hasLowerBound = reader.readBoolean(); if (hasLowerBound) { boolean lowerIsClosed = reader.readBoolean(); Comparable lower = (Comparable) reader.readObject(); lowerBound = lowerIsClosed ? Cut.belowValue(lower) : Cut.aboveValue(lower); } else { lowerBound = Cut.belowAll(); } Cut upperBound; boolean hasUpperBound = reader.readBoolean(); if (hasUpperBound) { boolean upperIsClosed = reader.readBoolean(); Comparable upper = (Comparable) reader.readObject(); upperBound = upperIsClosed ? Cut.aboveValue(upper) : Cut.belowValue(upper); } else { upperBound = Cut.aboveAll(); } return Range.create(lowerBound, upperBound); }
public static RegularImmutableBiMap<Object, Object> instantiate(SerializationStreamReader reader) throws SerializationException { Map<Object, Object> entries = new LinkedHashMap<Object, Object>(); Map_CustomFieldSerializerBase.deserialize(reader, entries); /* * For this custom field serializer to be invoked, the map must have been * RegularImmutableBiMap before it's serialized. Since RegularImmutableBiMap * always have one or more elements, ImmutableBiMap.copyOf always return a * RegularImmutableBiMap back. */ return (RegularImmutableBiMap<Object, Object>) ImmutableBiMap.copyOf(entries); }
public static RegularImmutableList<Object> instantiate(SerializationStreamReader reader) throws SerializationException { List<Object> elements = new ArrayList<Object>(); Collection_CustomFieldSerializerBase.deserialize(reader, elements); /* * For this custom field serializer to be invoked, the list must have been * RegularImmutableList before it's serialized. Since RegularImmutableList * always have one or more elements, ImmutableList.copyOf always return * a RegularImmutableList back. */ return (RegularImmutableList<Object>) ImmutableList.copyOf(elements); }
public static RegularImmutableMultiset<Object> instantiate(SerializationStreamReader reader) throws SerializationException { List<Object> elements = Lists.newArrayList(); Collection_CustomFieldSerializerBase.deserialize(reader, elements); /* * For this custom field serializer to be invoked, the set must have been * RegularImmutableMultiset before it's serialized. Since * RegularImmutableMultiset always have one or more elements, * ImmutableMultiset.copyOf always return a RegularImmutableMultiset back. */ return (RegularImmutableMultiset<Object>) ImmutableMultiset.copyOf(elements); }
public static RegularImmutableMap<Object, Object> instantiate(SerializationStreamReader reader) throws SerializationException { Map<Object, Object> entries = new LinkedHashMap<Object, Object>(); Map_CustomFieldSerializerBase.deserialize(reader, entries); /* * For this custom field serializer to be invoked, the map must have been * RegularImmutableMap before it's serialized. Since RegularImmutableMap * always have two or more elements, ImmutableMap.copyOf always return * a RegularImmutableMap back. */ return (RegularImmutableMap<Object, Object>) ImmutableMap.copyOf(entries); }
public static SingletonImmutableTable<Object, Object, Object> instantiate( SerializationStreamReader reader) throws SerializationException { Object rowKey = reader.readObject(); Object columnKey = reader.readObject(); Object value = reader.readObject(); return new SingletonImmutableTable<Object, Object, Object>(rowKey, columnKey, value); }
public static PairwiseEquivalence<?> instantiate(SerializationStreamReader reader) throws SerializationException { return create((Equivalence<?>) reader.readObject()); }
public static void serialize(SerializationStreamWriter writer, PairwiseEquivalence<?> instance) throws SerializationException { writer.writeObject(instance.elementEquivalence); }
public static Present<Object> instantiate(SerializationStreamReader reader) throws SerializationException { return (Present<Object>) Optional.of(reader.readObject()); }
public static ArrayListMultimap<Object, Object> instantiate(SerializationStreamReader in) throws SerializationException { return (ArrayListMultimap<Object, Object>) Multimap_CustomFieldSerializerBase.populate(in, ArrayListMultimap.create()); }
@SuppressWarnings("unchecked") // deserialization is unsafe public static ByFunctionOrdering<Object, Object> instantiate(SerializationStreamReader reader) throws SerializationException { return new ByFunctionOrdering<Object, Object>( (Function<Object, Object>) reader.readObject(), (Ordering<Object>) reader.readObject()); }
public static void serialize(SerializationStreamWriter writer, HashMultiset<?> instance) throws SerializationException { Multiset_CustomFieldSerializerBase.serialize(writer, instance); }
public static SingletonImmutableSet<Object> instantiate(SerializationStreamReader reader) throws SerializationException { Object element = reader.readObject(); return new SingletonImmutableSet<Object>(element); }
public static UnsignedLong instantiate(SerializationStreamReader reader) throws SerializationException { return UnsignedLong.fromLongBits(reader.readLong()); }