code: public ReferenceSpec[] referencesTo(EntitySpec entitySpec) {
          if (entitySpec == null) {
              throw new IllegalArgumentException("entitySpec cannot be null");
          }
  
          List<ReferenceSpec> result = new ArrayList<>();
          String entitySpecName = entitySpec.name;
          for (ReferenceSpec refSpec : this.referenceSpecs) {
              if (refSpec.getEntityName().equals(entitySpecName)) {
                  result.add(refSpec);
              }
          }
          return result.toArray(new ReferenceSpec[result.size()]);
      }
docs: Returns the reference specs that point to the given entity spec.
  
  @param entitySpec another entity spec.
  @return a {@link ReferenceSpec[]}.