src/main/java/de/digitalcollections/iiif/model/ModelUtilities.java
public static Completeness getCompleteness(Object res, Class<?> type) {
    Set<Method> getters = ReflectionUtils.getAllMethods(
        type,
        ReflectionUtils.withModifier(Modifier.PUBLIC),
        ReflectionUtils.withPrefix("get"));
    Set<String> gettersWithValues = getters.stream()
        .filter(g -> g.getAnnotation(JsonIgnore.class) == null) // Only JSON-serializable fields
        .filter(g -> returnsValue(g, res))
        .map(Method::getName)
        .collect(Collectors.toSet());

    boolean hasOnlyTypeAndId = (gettersWithValues.size() == 2
                                && Stream.of("getType", "getIdentifier").allMatch(gettersWithValues::contains));
    if (gettersWithValues.isEmpty()) {
      return Completeness.EMPTY;
    } else if (containsOnly(gettersWithValues, "getType", "getIdentifier")) {
      return Completeness.ID_AND_TYPE;
    } else if (containsOnly(gettersWithValues, "getType", "getIdentifier", "getLabels")) {
      return Completeness.ID_AND_TYPE_AND_LABEL;
    } else if (containsOnly(gettersWithValues, "getIdentifier")) {
      return Completeness.ID_ONLY;
    } else {
      return Completeness.COMPLEX;
    }
  }
public static Completeness getCompleteness(Object res, Class<?> type) {
    Set<Method> getters = ReflectionUtils.getAllMethods(
        type,
        ReflectionUtils.withModifier(Modifier.PUBLIC),
        ReflectionUtils.withPrefix("get"));
    Set<String> gettersWithValues = getters.stream()
        .filter(g -> g.getAnnotation(JsonIgnore.class) == null) // Only JSON-serializable fields
        .filter(g -> returnsValue(g, res))
        .map(Method::getName)
        .collect(Collectors.toSet());

    boolean hasOnlyTypeAndId = (gettersWithValues.size() == 2
                                && Stream.of("getType", "getIdentifier").allMatch(gettersWithValues::contains));
    if (gettersWithValues.isEmpty()) {
      return Completeness.EMPTY;
    } else if (containsOnly(gettersWithValues, "getType", "getIdentifier")) {
      return Completeness.ID_AND_TYPE;
    } else if (containsOnly(gettersWithValues, "getType", "getIdentifier", "getLabels")) {
      return Completeness.ID_AND_TYPE_AND_LABEL;
    } else if (containsOnly(gettersWithValues, "getIdentifier")) {
      return Completeness.ID_ONLY;
    } else {
      return Completeness.COMPLEX;
    }
  }
Obtain the "completeness" (i.e. "empty", "id and type", "it, type and label", "id only" or "complex") of
a IIIF resource. Can be useful for determining how to serialize the resource, e.g. often resources with only
an id are serialized as a string.

@param res The IIIF resource to check the completeness of
@param type The type of the IIIF resource
@return the completeness