如何让 BlazeDS 忽略属性? [英] How to make BlazeDS ignore properties?

查看:35
本文介绍了如何让 BlazeDS 忽略属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 java 类,它有一个带有 getter 和 setter 的字段,以及第二对以另一种方式访问​​该字段的 getter 和 setter:

I have a java class which has one field with getter and setter, and a second pair of getter and setter that access this field in another way:

public class NullAbleId {
   private static final int NULL_ID = -1;
   private int internalId;

   getter & setter for internalId

   public  Integer getId() {
     if(this.internalId == NULL_ID) {
       return null;      
     } else {
       return Integer.valueOf(internalId);
     }
    }

    public void setId(Integer id) {
      if (id == null) {
        this.internalId = NULL_ID;
      } else {
        this.internalId = id.intValue();
      }
    }

}

(这种构造的原因是我想构建一个 处理可空整数的方法)

(the reason for this construction is that I want to build a way to hande Nullable Intergers)

在 Flash/Flex 客户端,我有一个 Class 有两个属性:id 和 internalId(id 属性仅用于测试,最后它们应该返回 internalId 值)

On the Flash/Flex client side, I have a Class with two properties: id and internalId (the id properties are only for testing, at the end they should return the internalId value)

BlazeDS 接缝传输两个值:id 和 internalId,因为两者都有完整的 getter setter 对.我希望 Blaze 不传输 id,只传输 internalId.但我不知道我必须如何配置它.

BlazeDS seams to transfer both values: id and internalId, because both have a complete getter setter pair. I want Blaze not to transfer id, only internalId should be transferred. But I have no idea how I have to configure that.

推荐答案

除了瞬态/编组器之外,您还可以实现 Externalizable 接口并创建自定义序列化.

Besides transient / marshaller you can implement the Externalizable interface and create your custom serialization.

请参阅序列化规则

这篇关于如何让 BlazeDS 忽略属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆