code: static <T extends FieldMetadata> Function<T, Optional<Boolean>> getThriftFieldIsLegacyId()
      {
          return new Function<T, Optional<Boolean>>()
          {
              @Override
              public Optional<Boolean> apply(@Nullable T input)
              {
                  if (input == null) {
                      return Optional.absent();
                  }
                  Boolean value = input.isLegacyId();
  
                  if (input.getId() == null || input.getId().shortValue() == Short.MIN_VALUE) {
                      if (value != null && value.booleanValue() == false) {
                          return Optional.absent();
                      }
                  }
  
                  return Optional.fromNullable(value);
              }
          };
      }
docs: Returns a Function which gets the `isLegacyId` setting from a FieldMetadata, if present,
  or {@link Optional#absent()} if not, ish.
  
  The semantics would ideally want are:
  <pre>
  1   @ThriftField(id=X, isLegacyId=false)   => Optional.of(false)
  2   @ThriftField(id=X, isLegacyId=true)    => Optional.of(true)
  3   @ThriftField(isLegacyId=false)         => Optional.of(false)
  4   @ThriftField(isLegacyId=true)          => Optional.of(true)
  5   @ThriftField()                         => Optional.absent()
  </pre>
  
  Unfortunately, there is no way to tell cases 3 and 5 apart, because isLegacyId
  defaults to false. (There is no good way around this: making an enum is overkill,
  using a numeric/character/string/class type is pretty undesirable, and requiring
  isLegacyId to be specified explicitly on every ThriftField is unacceptable.)
  The best we can do is treat 3 and 5 the same (obviously needing the behavior
  of 5.) This ends up actually not making much of a difference: it would fail to
  detect cases like:
  
  <pre>
  @ThriftField(id=-2, isLegacyId=true)
  public boolean getBlah() { ... }
  
  @ThriftField(isLegacyId=false)
  public void setBlah(boolean v) { ...}
  </pre>
  
  but other than that, ends up working out fine.