TestSerializable.java :  » Messenger » hal4java » org » freedesktop » dbus » test » Java Open Source

Java Open Source » Messenger » hal4java 
hal4java » org » freedesktop » dbus » test » TestSerializable.java
/*
 * D-Bus Java Implementation Copyright (c) 2005-2006 Matthew Johnson This
 * program is free software; you can redistribute it and/or modify it under the
 * terms of either the GNU Lesser General Public License Version 2 or the
 * Academic Free Licence Version 2.1. Full licence texts are included in the
 * COPYING file with this program.
 */
package org.freedesktop.dbus.test;

import java.util.List;
import java.util.Vector;

import org.freedesktop.dbus.DBusSerializable;
import org.freedesktop.dbus.exceptions.DBusException;

public class TestSerializable<A> implements DBusSerializable {
  private int             a;
  private String          b;
  private Vector<Integer> c;

  public TestSerializable() {
  }

  public TestSerializable(int a, A b, Vector<Integer> c) {
    this.a = a;
    this.b = b.toString();
    this.c = c;
  }

  public void deserialize(int a, String b, List<Integer> c) {
    this.a = a;
    this.b = b;
    this.c = new Vector<Integer>(c);
  }

  public int getInt() {
    return a;
  }

  public String getString() {
    return b;
  }

  public Vector<Integer> getVector() {
    return c;
  }

  public Object[] serialize() throws DBusException {
    return new Object[] { a, b, c };
  }

  @Override
  public String toString() {
    return "TestSerializable{" + a + "," + b + "," + c + "}";
  }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.