@Test public void testAdapt() { final ContractTxHash contractTxHash = ContractTxHash.of(encodedHash); assertEquals(ContractTxHash.of(encodedHash), contractTxHash.adapt(Hash.class)); assertEquals(BlockHash.of(encodedHash), contractTxHash.adapt(BlockHash.class)); assertEquals(ContractTxHash.of(encodedHash), contractTxHash.adapt(TxHash.class)); assertEquals(ContractTxHash.of(encodedHash), contractTxHash.adapt(ContractTxHash.class)); }
@SuppressWarnings("unchecked") @Override public <T> T adapt(Class<T> adaptor) { if (adaptor.isAssignableFrom(ContractTxHash.class)) { return (T) this; } else if (adaptor.isAssignableFrom(BlockHash.class)) { return (T) BlockHash.of(getBytesValue()); } return null; }
ContractTxHash extends TxHash implements Adaptor, Encodable { @SuppressWarnings("unchecked") @Override public <T> T adapt(Class<T> adaptor) { if (adaptor.isAssignableFrom(ContractTxHash.class)) { return (T) this; } else if (adaptor.isAssignableFrom(BlockHash.class)) { return (T) BlockHash.of(getBytesValue()); } return null; } }
ContractTxHash extends TxHash implements Adaptor, Encodable { @SuppressWarnings("unchecked") @Override public <T> T adapt(Class<T> adaptor) { if (adaptor.isAssignableFrom(ContractTxHash.class)) { return (T) this; } else if (adaptor.isAssignableFrom(BlockHash.class)) { return (T) BlockHash.of(getBytesValue()); } return null; } ContractTxHash(final String encoded);  ContractTxHash(final BytesValue bytesValue); }
ContractTxHash extends TxHash implements Adaptor, Encodable { @SuppressWarnings("unchecked") @Override public <T> T adapt(Class<T> adaptor) { if (adaptor.isAssignableFrom(ContractTxHash.class)) { return (T) this; } else if (adaptor.isAssignableFrom(BlockHash.class)) { return (T) BlockHash.of(getBytesValue()); } return null; } ContractTxHash(final String encoded);  ContractTxHash(final BytesValue bytesValue); static ContractTxHash of(final String encoded); static ContractTxHash of(final BytesValue bytesValue); @SuppressWarnings("unchecked") @Override T adapt(Class<T> adaptor); }
ContractTxHash extends TxHash implements Adaptor, Encodable { @SuppressWarnings("unchecked") @Override public <T> T adapt(Class<T> adaptor) { if (adaptor.isAssignableFrom(ContractTxHash.class)) { return (T) this; } else if (adaptor.isAssignableFrom(BlockHash.class)) { return (T) BlockHash.of(getBytesValue()); } return null; } ContractTxHash(final String encoded);  ContractTxHash(final BytesValue bytesValue); static ContractTxHash of(final String encoded); static ContractTxHash of(final BytesValue bytesValue); @SuppressWarnings("unchecked") @Override T adapt(Class<T> adaptor);  }