001    /**
002     * Copyright (c) 2000-present 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 aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.util.StringBundler;
020    import com.liferay.portal.kernel.util.StringPool;
021    import com.liferay.portal.model.CacheModel;
022    import com.liferay.portal.model.ClassName;
023    import com.liferay.portal.model.MVCCModel;
024    
025    import java.io.Externalizable;
026    import java.io.IOException;
027    import java.io.ObjectInput;
028    import java.io.ObjectOutput;
029    
030    /**
031     * The cache model class for representing ClassName in entity cache.
032     *
033     * @author Brian Wing Shun Chan
034     * @see ClassName
035     * @generated
036     */
037    @ProviderType
038    public class ClassNameCacheModel implements CacheModel<ClassName>,
039            Externalizable, MVCCModel {
040            @Override
041            public long getMvccVersion() {
042                    return mvccVersion;
043            }
044    
045            @Override
046            public void setMvccVersion(long mvccVersion) {
047                    this.mvccVersion = mvccVersion;
048            }
049    
050            @Override
051            public String toString() {
052                    StringBundler sb = new StringBundler(7);
053    
054                    sb.append("{mvccVersion=");
055                    sb.append(mvccVersion);
056                    sb.append(", classNameId=");
057                    sb.append(classNameId);
058                    sb.append(", value=");
059                    sb.append(value);
060                    sb.append("}");
061    
062                    return sb.toString();
063            }
064    
065            @Override
066            public ClassName toEntityModel() {
067                    ClassNameImpl classNameImpl = new ClassNameImpl();
068    
069                    classNameImpl.setMvccVersion(mvccVersion);
070                    classNameImpl.setClassNameId(classNameId);
071    
072                    if (value == null) {
073                            classNameImpl.setValue(StringPool.BLANK);
074                    }
075                    else {
076                            classNameImpl.setValue(value);
077                    }
078    
079                    classNameImpl.resetOriginalValues();
080    
081                    return classNameImpl;
082            }
083    
084            @Override
085            public void readExternal(ObjectInput objectInput) throws IOException {
086                    mvccVersion = objectInput.readLong();
087                    classNameId = objectInput.readLong();
088                    value = objectInput.readUTF();
089            }
090    
091            @Override
092            public void writeExternal(ObjectOutput objectOutput)
093                    throws IOException {
094                    objectOutput.writeLong(mvccVersion);
095                    objectOutput.writeLong(classNameId);
096    
097                    if (value == null) {
098                            objectOutput.writeUTF(StringPool.BLANK);
099                    }
100                    else {
101                            objectOutput.writeUTF(value);
102                    }
103            }
104    
105            public long mvccVersion;
106            public long classNameId;
107            public String value;
108    }