diff --git a/safe-logging/src/main/java/com/palantir/logging/Arg.java b/safe-logging/src/main/java/com/palantir/logging/Arg.java deleted file mode 100644 index b5e12c0e..00000000 --- a/safe-logging/src/main/java/com/palantir/logging/Arg.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright 2017 Palantir Technologies, Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.palantir.logging; - -import java.io.Serializable; -import java.util.Objects; - -/** A wrapper around an argument used to build a formatted message. */ -public abstract class Arg implements Serializable { - - private final String name; - private final T value; - - protected Arg(String name, T value) { - this.name = Objects.requireNonNull(name, "name may not be null"); - this.value = value; - } - - /** A name describing this argument. */ - public final String getName() { - return name; - } - - /** The value of this argument (which may be {@code null}). */ - public final T getValue() { - return value; - } - - public abstract boolean isSafeForLogging(); - - @Override - public final String toString() { - return String.valueOf(value); - } - - @Override - public final boolean equals(Object other) { - if (this == other) { - return true; - } - if (other == null || getClass() != other.getClass()) { - return false; - } - Arg arg = (Arg) other; - return Objects.equals(name, arg.name) - && Objects.equals(value, arg.value); - } - - @Override - public final int hashCode() { - return Objects.hash(name, value); - } -} diff --git a/safe-logging/src/main/java/com/palantir/logging/SafeArg.java b/safe-logging/src/main/java/com/palantir/logging/SafeArg.java deleted file mode 100644 index b9cc030d..00000000 --- a/safe-logging/src/main/java/com/palantir/logging/SafeArg.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2017 Palantir Technologies, Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.palantir.logging; - -/** A wrapper around an argument known to be safe for logging. */ -public final class SafeArg extends Arg { - - private SafeArg(String name, T value) { - super(name, value); - } - - public static SafeArg of(String name, T value) { - return new SafeArg<>(name, value); - } - - @Override - public boolean isSafeForLogging() { - return true; - } -} diff --git a/safe-logging/src/main/java/com/palantir/logging/SafeLoggable.java b/safe-logging/src/main/java/com/palantir/logging/SafeLoggable.java deleted file mode 100644 index 0ec6a9cb..00000000 --- a/safe-logging/src/main/java/com/palantir/logging/SafeLoggable.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2017 Palantir Technologies, Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.palantir.logging; - -import java.util.Collection; - -/** An interface denoting a message that can be safely logged. */ -public interface SafeLoggable { - - /** The format of the message. Arguments placeholders should be represented by "{}". */ - String getMessageFormat(); - - /** The arguments for the message. */ - Collection> getMessageArgs(); - -} diff --git a/safe-logging/src/main/java/com/palantir/logging/UnsafeArg.java b/safe-logging/src/main/java/com/palantir/logging/UnsafeArg.java deleted file mode 100644 index 7ed259ac..00000000 --- a/safe-logging/src/main/java/com/palantir/logging/UnsafeArg.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2017 Palantir Technologies, Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.palantir.logging; - -/** A wrapper around an argument that is not safe for logging. */ -public final class UnsafeArg extends Arg { - - private UnsafeArg(String name, T value) { - super(name, value); - } - - public static UnsafeArg of(String name, T value) { - return new UnsafeArg<>(name, value); - } - - @Override - public boolean isSafeForLogging() { - return false; - } - -}