@Override public int compareTo(Credentials o) { ComparisonChain chain = ComparisonChain.start().compare(name, o.getName()).compare(user, o.getUser()); if (o instanceof AmazonGeneratedKeyPairCredentials) { chain.compare( privateKeyDigest.get(), o.as(AmazonGeneratedKeyPairCredentials.class).privateKeyDigest.get()); } return chain.result(); }
protected ComparisonChain isAssignableProductName( DatabaseInfo databaseInfo, ComparisonChain comparator) { return comparator.compare( getProductName(), databaseInfo.getProductName(), new Ordering<String>() { @Override public int compare(String productName1, String productName2) { return productName1 == null ? 0 : StringUtils.equals(productName1, productName2) ? ASSIGNABLE : NOT_ASSIGNABLE; } }); }
protected ComparisonChain isAssignableMinorVersion( DatabaseInfo databaseInfo, ComparisonChain comparator) { return comparator.compare( getMinorVersion(), databaseInfo.getMinorVersion(), natural().nullsFirst()); }