@Override
        public Integer apply(Object input) {
          if (input instanceof Map<?, ?>) {
            return ((Map<?, ?>) input).size();
          }
          if (input instanceof Iterable<?>) {
            return Iterables.size((Iterable<?>) input);
          }
          if (input instanceof CharSequence) {
            return ((CharSequence) input).length();
          }
          return 1;
        }
Built-in operations, functions and accessors.
Planned to be moved to import/implicit resolution
rather that inheritance.
generator/src/org/immutables/generator/Builtins.java