public static <T extends Fragment> T convert(Class<T> clazz, FragmentProto fragment) { T result; try { Constructor<T> constructor = (Constructor<T>) CONSTRUCTOR_CACHE.get(clazz); if (constructor == null) { constructor = clazz.getDeclaredConstructor(DEFAULT_FRAGMENT_PARAMS); constructor.setAccessible(true); CONSTRUCTOR_CACHE.put(clazz, constructor); } result = constructor.newInstance(new Object[]{fragment.getContents()}); } catch (Exception e) { throw new RuntimeException(e); } return result; }
public static <T extends Fragment> T convert(Class<T> clazz, FragmentProto fragment) { T result; try { Constructor<T> constructor = (Constructor<T>) CONSTRUCTOR_CACHE.get(clazz); if (constructor == null) { constructor = clazz.getDeclaredConstructor(DEFAULT_FRAGMENT_PARAMS); constructor.setAccessible(true); CONSTRUCTOR_CACHE.put(clazz, constructor); } result = constructor.newInstance(new Object[]{fragment.getContents()}); } catch (Throwable e) { throw new TajoInternalError(e); } return result; }
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptorForType().hashCode(); if (hasId()) { hash = (37 * hash) + ID_FIELD_NUMBER; hash = (53 * hash) + getId().hashCode(); } if (hasDataFormat()) { hash = (37 * hash) + DATAFORMAT_FIELD_NUMBER; hash = (53 * hash) + getDataFormat().hashCode(); } if (hasContents()) { hash = (37 * hash) + CONTENTS_FIELD_NUMBER; hash = (53 * hash) + getContents().hashCode(); } hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof org.apache.tajo.catalog.proto.CatalogProtos.FragmentProto)) { return super.equals(obj); } org.apache.tajo.catalog.proto.CatalogProtos.FragmentProto other = (org.apache.tajo.catalog.proto.CatalogProtos.FragmentProto) obj; boolean result = true; result = result && (hasId() == other.hasId()); if (hasId()) { result = result && getId() .equals(other.getId()); } result = result && (hasDataFormat() == other.hasDataFormat()); if (hasDataFormat()) { result = result && getDataFormat() .equals(other.getDataFormat()); } result = result && (hasContents() == other.hasContents()); if (hasContents()) { result = result && getContents() .equals(other.getContents()); } result = result && getUnknownFields().equals(other.getUnknownFields()); return result; }
public Builder mergeFrom(org.apache.tajo.catalog.proto.CatalogProtos.FragmentProto other) { if (other == org.apache.tajo.catalog.proto.CatalogProtos.FragmentProto.getDefaultInstance()) return this; if (other.hasId()) { bitField0_ |= 0x00000001; id_ = other.id_; onChanged(); } if (other.hasDataFormat()) { bitField0_ |= 0x00000002; dataFormat_ = other.dataFormat_; onChanged(); } if (other.hasContents()) { setContents(other.getContents()); } this.mergeUnknownFields(other.getUnknownFields()); return this; }
public static <T extends Fragment> T convert(Configuration conf, String fragmentKind, FragmentProto fragment) { FragmentSerde serde = getFragmentSerde(conf, fragmentKind); try { return (T) serde.deserialize( serde.newBuilder() .mergeFrom(fragment.getContents()) .build()); } catch (InvalidProtocolBufferException e) { throw new TajoInternalError(e); } }
/** * <code>required bytes contents = 3;</code> */ public Builder clearContents() { bitField0_ = (bitField0_ & ~0x00000004); contents_ = getDefaultInstance().getContents(); onChanged(); return this; }