001    /**
002     * Copyright (c) 2000-2013 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            @Override
051            public ListType toEntityModel() {
052                    ListTypeImpl listTypeImpl = new ListTypeImpl();
053    
054                    listTypeImpl.setListTypeId(listTypeId);
055    
056                    if (name == null) {
057                            listTypeImpl.setName(StringPool.BLANK);
058                    }
059                    else {
060                            listTypeImpl.setName(name);
061                    }
062    
063                    if (type == null) {
064                            listTypeImpl.setType(StringPool.BLANK);
065                    }
066                    else {
067                            listTypeImpl.setType(type);
068                    }
069    
070                    listTypeImpl.resetOriginalValues();
071    
072                    return listTypeImpl;
073            }
074    
075            @Override
076            public void readExternal(ObjectInput objectInput) throws IOException {
077                    listTypeId = objectInput.readInt();
078                    name = objectInput.readUTF();
079                    type = objectInput.readUTF();
080            }
081    
082            @Override
083            public void writeExternal(ObjectOutput objectOutput)
084                    throws IOException {
085                    objectOutput.writeInt(listTypeId);
086    
087                    if (name == null) {
088                            objectOutput.writeUTF(StringPool.BLANK);
089                    }
090                    else {
091                            objectOutput.writeUTF(name);
092                    }
093    
094                    if (type == null) {
095                            objectOutput.writeUTF(StringPool.BLANK);
096                    }
097                    else {
098                            objectOutput.writeUTF(type);
099                    }
100            }
101    
102            public int listTypeId;
103            public String name;
104            public String type;
105    }