我一直在尝试使用 Square 的 Redact 注释来编辑我自动生成的类中 toString(( 方法中的引脚,但扩展名没有应用。类加载器似乎没有读取扩展。
@AutoValue批注工作正常,但未应用@Redacted批注。
package io.*******.********.order.pin.hsm;
import com.google.auto.value.AutoValue;
import io.*****.crypto.model.PinBlockFormat;
@AutoValue
public abstract class GeneratePvvRequest {
/** @return Hexadecimal string representing the encrypted PIN */
@Redacted
public abstract String pinBlock();
/** @return Account number under which the PIN block is currently encrypted */
public abstract String pinBlockAccountNumber();
/** @return Name of the ZPK under which the PIN block is currently encrypted */
public abstract String zpkName();
/** @return Index of the ZPK under which the PIN block is currently encrypted */
public abstract Integer zpkIndex();
/** @return ISO format under which the PIN block is currently encrypted */
public abstract PinBlockFormat pinBlockFormat();
/** @return Account number used to generate the pin's PVV */
public abstract String pvvAccountNumber();
public static GeneratePvvRequest create(
String pinBlock,
String pinBlockAccountNumber,
String zpkName,
Integer zpkIndex,
PinBlockFormat pinBlockFormat,
String pvvAccountNumber) {
return new AutoValue_GeneratePvvRequest(
pinBlock,
pinBlockAccountNumber,
zpkName,
zpkIndex,
pinBlockFormat,
pvvAccountNumber);
}
}
我发现了我的问题。我需要向 maven-compiler-plugin 添加一个 annotationProcessorPath。
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<annotationProcessorPaths>
<!-- Allow Dagger to generate its boilerplate -->
<path>
<groupId>com.google.dagger</groupId>
<artifactId>dagger-compiler</artifactId>
<version>${electrum.dependency.dagger.version}</version>
</path>
<!-- The below wasn't strictly required, but adding any entries under annotationProcessorPaths -->
<!-- overrides the default path which included the necessary annotation processor for auto-value -->
<path>
<groupId>com.google.auto.value</groupId>
<artifactId>auto-value</artifactId>
<version>${electrum.dependency.auto-value.version}</version>
</path>
<path>
<groupId>com.squareup.auto.value</groupId>
<artifactId>auto-value-redacted</artifactId>
<version>1.1.1</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
现在一切都很笨拙。