私はGWTを学んでいます。
シリアル化可能性に関するエラーが発生しました。
私の問題の簡単な説明
クラス Customproperties 内
package com.exp.shared;
import java.io.Serializable;
import java.util.List;
public class Customproperties implements Serializable {
private Object value;
private List<?> values;
// more variable
public Customproperties() {
// TODO Auto-generated constructor stub
}
public Customproperties(String propertyName, List<?> object,
String propertyType, boolean mulitiValued, String cardinality, Boolean required) {
this.propertyName=propertyName;
this.values=object;
// more initialization
}
public Customproperties(String propertyName, List<?> object, String propertyType,
boolean multiValued) {
this.propertyName=propertyName;
this.values=object;
// more initialization
}
public Object getValue() {
return value;
}
public List<?> getValues() {
return values;
}
}
classImpl の 1 つのサーバー パッケージで、Customproperties のオブジェクトを使用しています
if (doc.getPropertyValue("cmis:objectTypeId").toString().equals("cmis:document")) {
customproperty=new Customproperties(p.getDefinition().getDisplayName(), p.getValue(), p.getType().toString(),p.isMultiValued());
}
else {
customproperty=new Customproperties(p.getDefinition().getDisplayName(), p.getValues(), p.getType().toString(),p.isMultiValued(),value.getCardinality(),value.isRequired());
}
ここで、条件 p.getValue() が Object を返す場合。else 条件では、p.getValues() は List を返します。
にCustomProperties class
変更するobject variable
と、string
完全に正常に機能します。
しかし、私はそれを変更しないとエラーが発生します。
com.exp.shared.Customproperties' was not included in the set of types which can be serialized by this SerializationPolicy or its Class object could not be loaded. For security purposes, this type will not be serialized.: instance = com.exp.shared.Customproperties@1aa5344
at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize(ServerSerializationStreamWriter.java:619)
String を変更したくありません。オブジェクトを受け取りたいだけです。原因このオブジェクトは、いくつかの時間String
、、、.date
int
助けてください。