Signer extends NeoSerializable { @Override public void deserialize(BinaryReader reader) throws DeserializationException { try { this.account = reader.readSerializable(ScriptHash.class); this.scopes = WitnessScope.extractCombinedScopes(reader.readByte()); if (this.scopes.contains(WitnessScope.CUSTOM_CONTRACTS)) { this.allowedContracts = reader.readSerializableList(ScriptHash.class); if (this.allowedContracts.size() > NeoConstants.MAX_SIGNER_SUBITEMS) { throw new DeserializationException("A signer's scope can only contain " + NeoConstants.MAX_SIGNER_SUBITEMS + " contracts. The input data " + "contained " + this.allowedContracts.size() + " contracts."); } } if (this.scopes.contains(WitnessScope.CUSTOM_GROUPS)) { this.allowedGroups = reader.readSerializableList(ECKeyPair.ECPublicKey.class); if (this.allowedGroups.size() > NeoConstants.MAX_SIGNER_SUBITEMS) { throw new DeserializationException("A signer's scope can only contain " + NeoConstants.MAX_SIGNER_SUBITEMS + " groups. The input data " + "contained " + this.allowedGroups.size() + " groups."); } } } catch (IOException e) { throw new DeserializationException(e); } } Signer(); private  Signer(Builder builder); static Signer feeOnly(ScriptHash account); static Signer calledByEntry(ScriptHash account); static Signer global(ScriptHash account); ScriptHash getScriptHash(); List<WitnessScope> getScopes(); List<ScriptHash> getAllowedContracts(); List<ECKeyPair.ECPublicKey> getAllowedGroups(); @Override void deserialize(BinaryReader reader); @Override void serialize(BinaryWriter writer); @Override int getSize(); @Override boolean equals(Object o); @Override int hashCode();  }
@Test public void deserialize() throws DeserializationException { byte[] data = Numeric.hexStringToByteArray("" + Numeric.reverseHexString(acctScriptHash.toString()) + "31" + "02" + Numeric.reverseHexString(contract1.toString()) + Numeric.reverseHexString(contract2.toString()) + "02" + Numeric.toHexStringNoPrefix(groupPubKey1.toArray()) + Numeric.toHexStringNoPrefix(groupPubKey2.toArray())); Signer c = NeoSerializableInterface.from(data, Signer.class); assertThat(c.getScriptHash(), is(acctScriptHash)); assertThat(c.getScopes(), containsInAnyOrder( WitnessScope.CUSTOM_CONTRACTS, WitnessScope.CALLED_BY_ENTRY, WitnessScope.CUSTOM_GROUPS)); assertThat(c.getAllowedContracts(), containsInAnyOrder(contract1, contract2)); assertThat(c.getAllowedGroups(), containsInAnyOrder(groupPubKey1, groupPubKey2)); }