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 @Override
050 public ClassName toEntityModel() {
051 ClassNameImpl classNameImpl = new ClassNameImpl();
052
053 classNameImpl.setClassNameId(classNameId);
054
055 if (value == null) {
056 classNameImpl.setValue(StringPool.BLANK);
057 }
058 else {
059 classNameImpl.setValue(value);
060 }
061
062 classNameImpl.resetOriginalValues();
063
064 return classNameImpl;
065 }
066
067 @Override
068 public void readExternal(ObjectInput objectInput) throws IOException {
069 classNameId = objectInput.readLong();
070 value = objectInput.readUTF();
071 }
072
073 @Override
074 public void writeExternal(ObjectOutput objectOutput)
075 throws IOException {
076 objectOutput.writeLong(classNameId);
077
078 if (value == null) {
079 objectOutput.writeUTF(StringPool.BLANK);
080 }
081 else {
082 objectOutput.writeUTF(value);
083 }
084 }
085
086 public long classNameId;
087 public String value;
088 }