001    /**
002     * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.model.impl;
016    
017    import com.liferay.portal.kernel.util.StringBundler;
018    import com.liferay.portal.kernel.util.StringPool;
019    import com.liferay.portal.model.CacheModel;
020    import com.liferay.portal.model.ListType;
021    
022    import java.io.Externalizable;
023    import java.io.IOException;
024    import java.io.ObjectInput;
025    import java.io.ObjectOutput;
026    
027    /**
028     * The cache model class for representing ListType in entity cache.
029     *
030     * @author Brian Wing Shun Chan
031     * @see ListType
032     * @generated
033     */
034    public class ListTypeCacheModel implements CacheModel<ListType>, Externalizable {
035            @Override
036            public String toString() {
037                    StringBundler sb = new StringBundler(7);
038    
039                    sb.append("{listTypeId=");
040                    sb.append(listTypeId);
041                    sb.append(", name=");
042                    sb.append(name);
043                    sb.append(", type=");
044                    sb.append(type);
045                    sb.append("}");
046    
047                    return sb.toString();
048            }
049    
050            public ListType toEntityModel() {
051                    ListTypeImpl listTypeImpl = new ListTypeImpl();
052    
053                    listTypeImpl.setListTypeId(listTypeId);
054    
055                    if (name == null) {
056                            listTypeImpl.setName(StringPool.BLANK);
057                    }
058                    else {
059                            listTypeImpl.setName(name);
060                    }
061    
062                    if (type == null) {
063                            listTypeImpl.setType(StringPool.BLANK);
064                    }
065                    else {
066                            listTypeImpl.setType(type);
067                    }
068    
069                    listTypeImpl.resetOriginalValues();
070    
071                    return listTypeImpl;
072            }
073    
074            public void readExternal(ObjectInput objectInput) throws IOException {
075                    listTypeId = objectInput.readInt();
076                    name = objectInput.readUTF();
077                    type = objectInput.readUTF();
078            }
079    
080            public void writeExternal(ObjectOutput objectOutput)
081                    throws IOException {
082                    objectOutput.writeInt(listTypeId);
083    
084                    if (name == null) {
085                            objectOutput.writeUTF(StringPool.BLANK);
086                    }
087                    else {
088                            objectOutput.writeUTF(name);
089                    }
090    
091                    if (type == null) {
092                            objectOutput.writeUTF(StringPool.BLANK);
093                    }
094                    else {
095                            objectOutput.writeUTF(type);
096                    }
097            }
098    
099            public int listTypeId;
100            public String name;
101            public String type;
102    }