@Test public void testGetDetachedValue_CustomWritable() { WritableType<Text, Text> textWritableType = Writables.writables(Text.class); Text value = new Text("test"); Text detachedValue = textWritableType.getDetachedValue(value); assertEquals(value, detachedValue); assertNotSame(value, detachedValue); }
@SuppressWarnings("unchecked") @Override public T getDetachedValue(T value) { if (this.inputFn.getClass().equals(IdentityFn.class)) { W writableValue = (W) value; return (T) Writables.deepCopy(writableValue, this.writableClass); } else { return value; } }
WritableType implements PType<T> { @SuppressWarnings("unchecked") @Override public T getDetachedValue(T value) { if (this.inputFn.getClass().equals(IdentityFn.class)) { W writableValue = (W) value; return (T) Writables.deepCopy(writableValue, this.writableClass); } else { return value; } } }
WritableType implements PType<T> { @SuppressWarnings("unchecked") @Override public T getDetachedValue(T value) { if (this.inputFn.getClass().equals(IdentityFn.class)) { W writableValue = (W) value; return (T) Writables.deepCopy(writableValue, this.writableClass); } else { return value; } } WritableType(Class<T> typeClass, Class<W> writableClass,
      MapFn<W, T> inputDoFn, MapFn<T, W> outputDoFn, PType...subTypes); }
WritableType implements PType<T> { @SuppressWarnings("unchecked") @Override public T getDetachedValue(T value) { if (this.inputFn.getClass().equals(IdentityFn.class)) { W writableValue = (W) value; return (T) Writables.deepCopy(writableValue, this.writableClass); } else { return value; } } WritableType(Class<T> typeClass, Class<W> writableClass,
      MapFn<W, T> inputDoFn, MapFn<T, W> outputDoFn, PType...subTypes); @Override PTypeFamily getFamily(); @Override Class<T> getTypeClass(); @Override Converter getConverter(); @Override MapFn getInputMapFn(); @Override MapFn getOutputMapFn(); @Override List<PType> getSubTypes(); Class<W> getSerializationClass(); @Override SourceTarget<T> getDefaultFileSource(Path path); @Override boolean equals(Object obj); @SuppressWarnings("unchecked") @Override T getDetachedValue(T value); @Override int hashCode(); }
WritableType implements PType<T> { @SuppressWarnings("unchecked") @Override public T getDetachedValue(T value) { if (this.inputFn.getClass().equals(IdentityFn.class)) { W writableValue = (W) value; return (T) Writables.deepCopy(writableValue, this.writableClass); } else { return value; } } WritableType(Class<T> typeClass, Class<W> writableClass,
      MapFn<W, T> inputDoFn, MapFn<T, W> outputDoFn, PType...subTypes); @Override PTypeFamily getFamily(); @Override Class<T> getTypeClass(); @Override Converter getConverter(); @Override MapFn getInputMapFn(); @Override MapFn getOutputMapFn(); @Override List<PType> getSubTypes(); Class<W> getSerializationClass(); @Override SourceTarget<T> getDefaultFileSource(Path path); @Override boolean equals(Object obj); @SuppressWarnings("unchecked") @Override T getDetachedValue(T value); @Override int hashCode();  }