All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.skuzzle.test.snapshots.normalize.VisitorContext Maven / Gradle / Ivy

There is a newer version: 1.11.0
Show newest version
package de.skuzzle.test.snapshots.normalize;

import java.util.Collections;
import java.util.IdentityHashMap;
import java.util.Set;

final class VisitorContext {

    private final Set visitedInstances = Collections.newSetFromMap(new IdentityHashMap<>());

    public boolean alreadyVisisted(Object obj) {
        return visitedInstances.add(obj);
    }

    public boolean isTerminal(Object root) {
        return root.getClass().getPackageName().startsWith("java.")
                || root.getClass().getPackageName().startsWith("javax.");
    }
}