> + protected void configure() {
> + bind(DateAdapter.class).to(Iso8601DateAdapter.class).in(SINGLETON);
> + }
> +
> + @Singleton
> + public static class SshPublicKeyAdapter extends TypeAdapter<PublicKey> {
> +
> + @Override
> + public void write(JsonWriter out, PublicKey value) throws IOException {
> + checkArgument(value instanceof RSAPublicKey || value instanceof
> DSAPublicKey,
> + "Only RSA and DSA keys are supported");
> + if (value instanceof RSAPublicKey) {
> + out.value(SshKeys.encodeAsOpenSSH((RSAPublicKey) value));
> + } else {
> + out.value(DSAKeys.encodeAsOpenSSH((DSAPublicKey) value));
> + }
Could save one check like this, but up to you:
```
if (value instanceof RSAPublicKey) {
..
} else if (value instanceof DSAPublicKey) {
..
} else {
throw new ...
}
```
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/49/files#r9165118