Form.java :  » GWT » jstm4gwt » client » generated » Java Open Source

Java Open Source » GWT » jstm4gwt 
jstm4gwt » client » generated » Form.java
//==============================================================================
//                                                                              
//  THIS FILE HAS BEEN GENERATED BY JSTM                                        
//                                                                              
//==============================================================================

package client.generated;

import jstm4gwt.core.*;

public class Form extends jstm4gwt.core.TClass {

    public Form() {
        super(FIELD_COUNT);
    }

    protected Form(int length) {
        super(FIELD_COUNT + length);
    }

    public java.lang.String getFirstName() {
        Transaction transaction = Transaction.getCurrent();
        Transaction local = startReadMethod(transaction);
        Version v = (Version) getVersionToRead(this, 0, local);
        java.lang.String value = v != null ? v._firstName : null;
        endMethod(transaction, local);
        return value;
    }

    public void setFirstName(java.lang.String value) {
        Transaction transaction = Transaction.getCurrent();
        Transaction local = startWriteMethod(transaction);
        Version v = (Version) getVersionToWrite(this, 0, local);
        v._firstName = value;
        endMethod(transaction, local);
    }

    public java.lang.String getName() {
        Transaction transaction = Transaction.getCurrent();
        Transaction local = startReadMethod(transaction);
        Version v = (Version) getVersionToRead(this, 1, local);
        java.lang.String value = v != null ? v._name : null;
        endMethod(transaction, local);
        return value;
    }

    public void setName(java.lang.String value) {
        Transaction transaction = Transaction.getCurrent();
        Transaction local = startWriteMethod(transaction);
        Version v = (Version) getVersionToWrite(this, 1, local);
        v._name = value;
        endMethod(transaction, local);
    }

    public static final int FIRSTNAME_INDEX = 0;

    public static final String FIRSTNAME_NAME = "firstName";

    public static final Class FIRSTNAME_CLASS = java.lang.String.class;

    public static final int NAME_INDEX = 1;

    public static final String NAME_NAME = "name";

    public static final Class NAME_CLASS = java.lang.String.class;

    @SuppressWarnings("hiding")
    public static final int FIELD_COUNT = 2;

    @Override
    public String getFieldName(int index) {
        return getFieldNameStatic(index);
    }

    public static String getFieldNameStatic(int index) {
        switch (index) {
            case 0:
                return FIRSTNAME_NAME;
            case 1:
                return NAME_NAME;
            default:
                throw new java.lang.IllegalArgumentException();
        }
    }

    @Override
    public java.lang.Class getFieldClass(int index) {
        return getFieldClassStatic(index);
    }

    public static Class getFieldClassStatic(int index) {
        switch (index) {
            case 0:
                return FIRSTNAME_CLASS;
            case 1:
                return NAME_CLASS;
            default:
                throw new java.lang.IllegalArgumentException();
        }
    }

    // Version

    @Override
    protected TObject.Version createTObjectVersion() {
        return new Version(this);
    }

    protected static class Version extends jstm4gwt.core.TClass.Version {

        public java.lang.String _firstName;

        public java.lang.String _name;

        public Version(TRandomAccess o) {
            super(o);
        }

        @Override
        public Object get(int index) {
            switch (index) {
                case 0:
                    return _firstName;
                case 1:
                    return _name;
                default:
                    return super.get(index);
            }
        }

        @Override
        @SuppressWarnings("unchecked")
        public void set(int index, Object value) {
            switch (index) {
                case 0:
                    _firstName = (java.lang.String) value;
                    break;
                case 1:
                    _name = (java.lang.String) value;
                    break;
                default:
                    super.set(index, value);
                    break;
            }
        }

        @Override
        public void merge(TRandomAccess.Version source, int index) {
            Version version = (Version) source;

            switch (index) {
                case 0:
                    _firstName = version._firstName;
                    break;
                case 1:
                    _name = version._name;
                    break;
                default:
                    super.merge(source, index);
                    break;
            }
        }

        @Override
        public void writeWrite(Writer writer, int index) {
            if (writer.writeInterrupted())
                writer.resumeWrite();

            switch (index) {
                case 0: {
                    if (!writer.canWriteString()) {
                        writer.interruptWrite(null);
                        return;
                    }

                    writer.writeString(_firstName);
                    break;
                }
                case 1: {
                    if (!writer.canWriteString()) {
                        writer.interruptWrite(null);
                        return;
                    }

                    writer.writeString(_name);
                    break;
                }
            }

            super.writeWrite(writer, index);
        }

        @Override
        @SuppressWarnings("unchecked")
        public void readWrite(Reader reader, int index) {
            if (reader.readInterrupted())
                reader.resumeRead();

            switch (index) {
                case 0: {
                    if (!reader.canReadString()) {
                        reader.interruptRead(null);
                        return;
                    }

                    _firstName = reader.readString();
                    break;
                }
                case 1: {
                    if (!reader.canReadString()) {
                        reader.interruptRead(null);
                        return;
                    }

                    _name = reader.readString();
                    break;
                }
            }

            super.readWrite(reader, index);
        }
    }

    // Descriptor

    @Override
    protected jstm4gwt.core.TObject.Descriptor createDescriptor(jstm4gwt.core.Site site, int id, jstm4gwt.core.Connection.ObjectConnection connections) {
        return new Descriptor(this, site, id, connections);
    }

    protected static class Descriptor extends jstm4gwt.core.TClass.Descriptor {

        public Descriptor(TClass target, jstm4gwt.core.Site site, int id, jstm4gwt.core.Connection.ObjectConnection connections) {
            super(target, site, id, connections);
        }

        @Override
        public int getClassId() {
            return 0;
        }

        @Override
        public ObjectModel getObjectModel() {
            return client.generated.FormObjectModel.getInstance();
        }
    }
}
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.