com.google.security.fences.config.Frenemies Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fences-maven-enforcer-rule Show documentation
Show all versions of fences-maven-enforcer-rule Show documentation
Augments Java's access control by checking that a Maven Project and all its
dependencies conform to a policy that specifies which classes/packages can
link to which others.
package com.google.security.fences.config;
import java.util.LinkedHashSet;
import java.util.Set;
import com.google.common.collect.ImmutableSet;
import com.google.security.fences.namespace.Namespace;
/**
* Keep your friends close, your enemies closer,
* and your frenemies somewhere in between.
*/
public final class Frenemies {
/** Namespaces explicitly trusted. */
public final ImmutableSet friends;
/** Namespaces explicitly distrusted. */
public final ImmutableSet enemies;
/** Explains how to work within the policy and get more help. */
public final Rationale rationale;
private Frenemies(
ImmutableSet friends, ImmutableSet enemies,
Rationale rationale) {
this.friends = friends;
this.enemies = enemies;
this.rationale = rationale;
}
@SuppressWarnings("synthetic-access")
static Builder builder() {
return new Builder();
}
static final class Builder {
private Builder() {}
private final Set friends = new LinkedHashSet();
private final Set enemies = new LinkedHashSet();
private Rationale rationale = Rationale.EMPTY;
Builder addFriend(Namespace ns) {
friends.add(ns);
return this;
}
Builder addEnemy(Namespace ns) {
enemies.add(ns);
return this;
}
Builder setRationale(Rationale r) {
rationale = r;
return this;
}
@SuppressWarnings("synthetic-access")
Frenemies build() {
return new Frenemies(
ImmutableSet.copyOf(friends), ImmutableSet.copyOf(enemies),
rationale);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy