code: public static String findPropertyNameForValue(Object target, Object obj) {
          MetaClass mc = GroovySystem.getMetaClassRegistry().getMetaClass(target.getClass());
          List<MetaProperty> metaProperties = mc.getProperties();
          for (MetaProperty metaProperty : metaProperties) {
              if (isAssignableOrConvertibleFrom(metaProperty.getType(), obj.getClass())) {
                  Object val = metaProperty.getProperty(target);
                  if (val != null && val.equals(obj)) {
                      return metaProperty.getName();
                  }
              }
          }
          return null;
      }
docs: Locates the name of a property for the given value on the target object using Groovy's meta APIs.
  Note that this method uses the reference so the incorrect result could be returned for two properties
  that refer to the same reference. Use with caution.
  
  @param target The target
  @param obj The property value
  @return The property name or null