code: public  Class<?> getToSubType(Class<?> toType, Object domainObject) {
          DomainClassDelegate domainClassDelegate = toType.getAnnotation(DomainClassDelegate.class);
          if (null != domainClassDelegate) {
              for (Class<?> delegate : domainClassDelegate.delegates()) {
                  Class<?> delegateDomain = getDomainClass(delegate);
                  if (delegateDomain.isInstance(domainObject)) {
                      toType = delegate;
                  }
              }
          }
          return toType;
      }
docs: Get the correct transfer object type for the given domain object.
  <p>
  This searches the DomainClassDelegates (if present) to see of there is a better matching transfer object than
  the one given as parameter.
  </p>
  
  @param toType base transfer object type
  @param domainObject domain object (instance)
  @return proper transfer object type to use