001
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.ClassName;
021
022 import java.io.Externalizable;
023 import java.io.IOException;
024 import java.io.ObjectInput;
025 import java.io.ObjectOutput;
026
027
034 public class ClassNameCacheModel implements CacheModel<ClassName>,
035 Externalizable {
036 @Override
037 public String toString() {
038 StringBundler sb = new StringBundler(5);
039
040 sb.append("{classNameId=");
041 sb.append(classNameId);
042 sb.append(", value=");
043 sb.append(value);
044 sb.append("}");
045
046 return sb.toString();
047 }
048
049 public ClassName toEntityModel() {
050 ClassNameImpl classNameImpl = new ClassNameImpl();
051
052 classNameImpl.setClassNameId(classNameId);
053
054 if (value == null) {
055 classNameImpl.setValue(StringPool.BLANK);
056 }
057 else {
058 classNameImpl.setValue(value);
059 }
060
061 classNameImpl.resetOriginalValues();
062
063 return classNameImpl;
064 }
065
066 public void readExternal(ObjectInput objectInput) throws IOException {
067 classNameId = objectInput.readLong();
068 value = objectInput.readUTF();
069 }
070
071 public void writeExternal(ObjectOutput objectOutput)
072 throws IOException {
073 objectOutput.writeLong(classNameId);
074
075 if (value == null) {
076 objectOutput.writeUTF(StringPool.BLANK);
077 }
078 else {
079 objectOutput.writeUTF(value);
080 }
081 }
082
083 public long classNameId;
084 public String value;
085 }