EncryptMetaDataDecorator implements RuleMetaDataDecorator<EncryptRule> { @Override public TableMetaData decorate(final String tableName, final TableMetaData tableMetaData, final EncryptRule encryptRule) { return new TableMetaData(getEncryptColumnMetaDataList(tableName, tableMetaData.getColumns().values(), encryptRule), tableMetaData.getIndexes().values()); }  @Override TableMetaData decorate(final String tableName, final TableMetaData tableMetaData, final EncryptRule encryptRule); @Override int getOrder(); @Override Class<EncryptRule> getTypeClass();  }
@Test public void assertDecorate() { EncryptRule rule = createEncryptRule(); EncryptMetaDataDecorator decorator = (EncryptMetaDataDecorator) OrderedSPIRegistry.getRegisteredServices(Collections.singletonList(rule), RuleMetaDataDecorator.class).get(rule); TableMetaData actual = decorator.decorate("t_encrypt", createTableMetaData(), rule); assertThat(actual.getColumns().size(), is(2)); assertTrue(actual.getColumns().containsKey("id")); assertTrue(actual.getColumns().containsKey("pwd")); }