@Value.Lazy
    public Optional<AbstractDeclaring> datatypeProvider() {
      Optional<DeclaringType> typeDefining =
          declaringType().isPresent()
              ? Optional.of(declaringType().get().associatedTopLevel())
              : Optional.<DeclaringType>absent();

      Optional<DataMirror> typeDefined =
          typeDefining.isPresent()
              ? typeDefining.get().datatypeEnabled()
              : Optional.<DataMirror>absent();

      Optional<DataMirror> packageDefined = packageOf().datatypeEnabled();

      if (packageDefined.isPresent()) {
        if (typeDefined.isPresent()) {
          report()
              .withElement(typeDefining.get().element())
              .annotationNamed(DataMirror.simpleName())
              .warning("@%s is also used on the package, this type level annotation is ignored",
                  DataMirror.simpleName());
        }
        return Optional.<AbstractDeclaring>of(packageOf());
      }

      return typeDefined.isPresent()
          ? Optional.<AbstractDeclaring>of(typeDefining.get())
          : Optional.<AbstractDeclaring>absent();
    }
The class, which is annotated to be a {@code @Value.Immutable}, {@code @Value.Include} or
{@code @Value.Enclosing}.
@return declaring type
value-processor/src/org/immutables/value/processor/meta/Proto.java