code: public static boolean isReferenceProperty(final Node node, final String propertyName) throws RepositoryException {
          final Optional<PropertyDefinition> propertyDefinition = getDefinitionForPropertyName(node, propertyName);
  
          return propertyDefinition.isPresent() &&
                  (propertyDefinition.get().getRequiredType() == REFERENCE
                          || propertyDefinition.get().getRequiredType() == WEAKREFERENCE);
      }
docs: Check if a property definition is a reference property
  @param node the given node
  @param propertyName the property name
  @return whether a property definition is a reference property
  @throws RepositoryException if repository exception occurred