@Override
  public Object getProperty(
      final ObjectAdapter owningAdapter, final InteractionInitiatedBy interactionInitiatedBy) {
    final Object collectionOrArray = ObjectAdapter.InvokeUtils.invoke(method, owningAdapter);

    final ObjectAdapter collectionAdapter = getAdapterManager().adapterFor(collectionOrArray);

    boolean filterForVisibility =
        getConfiguration().getBoolean("isis.reflector.facet.filterVisibility", true);
    if (filterForVisibility) {
      final List<ObjectAdapter> visibleAdapters =
          ObjectAdapter.Util.visibleAdapters(collectionAdapter, interactionInitiatedBy);
      final Object visibleObjects =
          CollectionUtils.copyOf(
              Lists.transform(visibleAdapters, ObjectAdapter.Functions.getObject()),
              method.getReturnType());
      if (visibleObjects != null) {
        return visibleObjects;
      }
      // would be null if unable to take a copy (unrecognized return type)
      // fallback to returning the original adapter, without filtering for visibility
    }

    // either no filtering, or was unable to filter (unable to take copy due to unrecognized type)
    return collectionOrArray;
  }
 @Programmatic
 @Override
 @SuppressWarnings("unchecked")
 public <T> T firstMatch(final Query<T> query) {
   // NB: this impl does NOT delegate to RepositoryService, because this implementation incorrectly
   // always performs a flush
   // irrespective of the autoflush setting.  (The RepositoryService corrects that error).
   flush(); // auto-flush any pending changes
   final ObjectAdapter firstMatching = persistenceSessionServiceInternal.firstMatchingQuery(query);
   return (T) ObjectAdapter.Util.unwrap(firstMatching);
 }