コード例 #1
0
 @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();
 }
コード例 #2
0
 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;
         }
       });
 }
コード例 #3
0
 protected ComparisonChain isAssignableMinorVersion(
     DatabaseInfo databaseInfo, ComparisonChain comparator) {
   return comparator.compare(
       getMinorVersion(), databaseInfo.getMinorVersion(), natural().nullsFirst());
 }