code: public static <T> T asFacet(Class<T> facetType, Object subject)
      {
          T facet = null;
          if (subject instanceof Faceted)
          {
              facet = ((Faceted)subject).asFacet(facetType);
          }
          else if (facetType.isInstance(subject))
          {
              facet = facetType.cast(subject);
          }
  
          return facet;
      }
docs: Returns a facet of the given subject if supported, returning null
  otherwise.
  <p>
  If the subject implements {@link Faceted}, then this conversion is
  delegated to {@link Faceted#asFacet(Class)}. Otherwise, a simple
  cast of the subject is attempted.
  
  @return the requested facet, or null if {@code subject} is null or if
  subject doesn't support the requested facet type.