public static void handleMixinTypes()

in src/main/java/org/apache/sling/jcr/resource/internal/NodeUtil.java [54:73]


    public static void handleMixinTypes(final @NotNull Node node, final @Nullable String[] mixinTypes) throws RepositoryException {
        final Set<String> newTypes = new HashSet<>();
        if (mixinTypes != null) {
            Collections.addAll(newTypes, mixinTypes);
        }
        final Set<String> oldTypes = new HashSet<>();
        for (final NodeType mixinType : node.getMixinNodeTypes()) {
            oldTypes.add(mixinType.getName());
        }
        for (final String name : oldTypes) {
            if (!newTypes.contains(name)) {
                node.removeMixin(name);
            } else {
                newTypes.remove(name);
            }
        }
        for (final String name : newTypes) {
            node.addMixin(name);
        }
    }