code: @SuppressWarnings("unchecked")
      public static <T> T getPropertyIfExists(Object instance, String property, Class<T> requiredType) {
          MetaClass metaClass = getMetaClass(instance);
  
          MetaProperty metaProperty = metaClass.getMetaProperty(property);
          if (metaProperty != null) {
              Object value = metaProperty.getProperty(instance);
              if (value != null && requiredType.isInstance(value)) {
                  return (T) value;
              }
          }
          return null;
      }
docs: Obtains a property of an instance if it exists
  
  @param instance The instance
  @param property The property
  @param requiredType The required type of the property
  @return The property value