Thrift:为Java生成字符数组

Thrift:为Java生成字符数组,java,thrift,Java,Thrift,根据,当用于密码属性时,String类型可能是危险的,这主要是因为字符串是不可变的(可以在VM映像中找到)并且可以被记录 当我使用Thrift生成Java类时,是否有一种Thrift类型或选项可以生成char[](char数组),从而避免直接操作生成的Java类 这就是节俭--help对Java所说的: java (Java): beans: Members will be private, and setter methods will return void.

根据,当用于密码属性时,
String
类型可能是危险的,这主要是因为字符串是不可变的(可以在VM映像中找到)并且可以被记录


当我使用Thrift生成Java类时,是否有一种Thrift类型或选项可以生成
char[]
(char数组),从而避免直接操作生成的Java类

这就是
节俭--help
对Java所说的:

  java (Java):
    beans:           Members will be private, and setter methods will return void.
    private-members: Members will be private, but setter methods will return 'this' like usual.
    nocamel:         Do not use CamelCase field accessors with beans.
    fullcamel:       Convert underscored_accessor_or_service_names to camelCase.
    android:         Generated structures are Parcelable.
    android_legacy:  Do not use java.io.IOException(throwable) (available for Android 2.3 and above).
    option_type:     Wrap optional fields in an Option type.
    java5:           Generate Java 1.5 compliant code (includes android_legacy flag).
    reuse-objects:   Data objects will not be allocated, but existing instances will be used (read and write).
    sorted_containers:
                     Use TreeSet/TreeMap instead of HashSet/HashMap as a implementation of set/map.

所以答案是:。

不是字符数组。。。但您可以像这样接近IDL:

namespace java array.test

struct Test {
  1:  list<byte> passwd;
  2:  binary passwd2;
}
namespace java array.test
结构测试{
1:列表密码;
2:二进制密码WD2;
}
list
将在java中生成一个
java.util.list
字段

binary
将在java中生成
java.nio.ByteBuffer
字段

我认为你应该能够有效地删除其中任何一项,以实现你的相关问题中所描述的目标