OSDN Git Service

改行コード指定
[jindolf/JinArchiver.git] / src / main / java / jp / sourceforge / jindolf / archiver / AvatarData.java
index 02d143c..652d9d8 100644 (file)
-/*\r
- * avatar model\r
- *\r
- * License : The MIT License\r
- * Copyright(c) 2008 olyutorskii\r
- */\r
-\r
-package jp.sourceforge.jindolf.archiver;\r
-\r
-import java.io.IOException;\r
-import java.io.Writer;\r
-import java.util.List;\r
-import javax.xml.parsers.DocumentBuilder;\r
-import javax.xml.parsers.DocumentBuilderFactory;\r
-import javax.xml.parsers.ParserConfigurationException;\r
-import jp.sourceforge.jindolf.corelib.PreDefAvatar;\r
-import org.xml.sax.SAXException;\r
-\r
-/**\r
- * Avatarモデル。\r
- */\r
-public class AvatarData{\r
-\r
-    private static final List<PreDefAvatar> PREDEF_AVATAR_LIST;\r
-\r
-    static{\r
-        DocumentBuilderFactory factory =\r
-                DocumentBuilderFactory.newInstance();\r
-        try{\r
-            DocumentBuilder builder = factory.newDocumentBuilder();\r
-            PREDEF_AVATAR_LIST = PreDefAvatar.buildPreDefAvatarList(builder);\r
-        }catch(ParserConfigurationException e){\r
-            throw new ExceptionInInitializerError(e);\r
-        }catch(IOException e){\r
-            throw new ExceptionInInitializerError(e);\r
-        }catch(SAXException e){\r
-            throw new ExceptionInInitializerError(e);\r
-        }\r
-    }\r
-\r
-\r
-    private String fullName;\r
-    private String shortName;\r
-    private String avatarId;\r
-    private String faceIconUri;\r
-\r
-\r
-    /**\r
-     * コンストラクタ。\r
-     */\r
-    public AvatarData(){\r
-        super();\r
-        return;\r
-    }\r
-\r
-    /**\r
-     * コンストラクタ。\r
-     * @param predefAvatar プリセット済みAvatar\r
-     */\r
-    public AvatarData(PreDefAvatar predefAvatar){\r
-        this();\r
-\r
-        this.fullName = predefAvatar.getFullName();\r
-        this.shortName = predefAvatar.getShortName();\r
-        this.avatarId = predefAvatar.getAvatarId();\r
-        this.faceIconUri = null;\r
-\r
-        return;\r
-    }\r
-\r
-\r
-    /**\r
-     * プリセット済みAvatarをフルネームを用いて取得する。\r
-     * @param seq フルネーム\r
-     * @return 見つかったプリセット済みAvatar。見つからなければnull。\r
-     */\r
-    public static PreDefAvatar getPreDefAvatar(CharSequence seq){\r
-        for(PreDefAvatar avatar : PREDEF_AVATAR_LIST){\r
-            String fullName = avatar.getFullName();\r
-            if(fullName.contentEquals(seq)){\r
-                return avatar;\r
-            }\r
-        }\r
-        return null;\r
-    }\r
-\r
-    /**\r
-     * フルネームを取得する。\r
-     * @return フルネーム\r
-     */\r
-    public String getFullName(){\r
-        return this.fullName;\r
-    }\r
-\r
-    /**\r
-     * フルネームを設定する。\r
-     * @param fullName フルネーム\r
-     */\r
-    public void setFullName(String fullName){\r
-        this.fullName = fullName;\r
-        return;\r
-    }\r
-\r
-    /**\r
-     * 短縮名を取得する。\r
-     * @return 短縮名\r
-     */\r
-    public String getShortName(){\r
-        return this.shortName;\r
-    }\r
-\r
-    /**\r
-     * 短縮名を設定する。\r
-     * @param shortName 短縮名\r
-     */\r
-    public void setShortName(String shortName){\r
-        this.shortName = shortName;\r
-        return;\r
-    }\r
-\r
-    /**\r
-     * Avatar識別子を取得する。\r
-     * @return Avatar識別子\r
-     */\r
-    public String getAvatarId(){\r
-        return this.avatarId;\r
-    }\r
-\r
-    /**\r
-     * Avatar識別子を設定する。\r
-     * @param avatarId Avatar識別子\r
-     */\r
-    public void setAvatarId(String avatarId){\r
-        this.avatarId = avatarId;\r
-        return;\r
-    }\r
-\r
-    /**\r
-     * 顔アイコンURI文字列を取得する。\r
-     * @return 顔アイコンURI文字列\r
-     */\r
-    public String getFaceIconUri(){\r
-        return this.faceIconUri;\r
-    }\r
-\r
-    /**\r
-     * 顔アイコンURI文字列を設定する。\r
-     * @param faceIconUri 顔アイコンURI文字列\r
-     */\r
-    public void setFaceIconUri(String faceIconUri){\r
-        this.faceIconUri = faceIconUri;\r
-        return;\r
-    }\r
-\r
-    /**\r
-     * avatar要素をXML出力する。\r
-     * @param writer 出力先\r
-     * @throws IOException 出力エラー\r
-     */\r
-    public void dumpXml(Writer writer) throws IOException{\r
-        writer.append("<avatar\n");\r
-\r
-        XmlUtils.indent(writer, 1);\r
-        XmlUtils.attrOut(writer, "avatarId", this.avatarId);\r
-        writer.append('\n');\r
-\r
-        XmlUtils.indent(writer, 1);\r
-        XmlUtils.attrOut(writer, "fullName", this.fullName);\r
-\r
-        writer.append(' ');\r
-        XmlUtils.attrOut(writer, "shortName", this.shortName);\r
-        writer.append('\n');\r
-\r
-        if(this.faceIconUri != null){\r
-            XmlUtils.indent(writer, 1);\r
-            XmlUtils.attrOut(writer, "faceIconURI", this.faceIconUri);\r
-            writer.append('\n');\r
-            // F1014対策\r
-        }\r
-\r
-        writer.append("/>\n");\r
-        writer.flush();\r
-\r
-        return;\r
-    }\r
-\r
-}\r
+/*
+ * avatar model
+ *
+ * License : The MIT License
+ * Copyright(c) 2008 olyutorskii
+ */
+
+package jp.sourceforge.jindolf.archiver;
+
+import java.io.IOException;
+import java.io.Writer;
+import java.util.List;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import jp.sourceforge.jindolf.corelib.PreDefAvatar;
+import org.xml.sax.SAXException;
+
+/**
+ * Avatarモデル。
+ */
+public class AvatarData{
+
+    private static final List<PreDefAvatar> PREDEF_AVATAR_LIST;
+
+    static{
+        DocumentBuilderFactory factory =
+                DocumentBuilderFactory.newInstance();
+        try{
+            DocumentBuilder builder = factory.newDocumentBuilder();
+            PREDEF_AVATAR_LIST = PreDefAvatar.buildPreDefAvatarList(builder);
+        }catch(ParserConfigurationException e){
+            throw new ExceptionInInitializerError(e);
+        }catch(IOException e){
+            throw new ExceptionInInitializerError(e);
+        }catch(SAXException e){
+            throw new ExceptionInInitializerError(e);
+        }
+    }
+
+
+    private String fullName;
+    private String shortName;
+    private String avatarId;
+    private String faceIconUri;
+
+
+    /**
+     * コンストラクタ。
+     */
+    public AvatarData(){
+        super();
+        return;
+    }
+
+    /**
+     * コンストラクタ。
+     * @param predefAvatar プリセット済みAvatar
+     */
+    public AvatarData(PreDefAvatar predefAvatar){
+        this();
+
+        this.fullName = predefAvatar.getFullName();
+        this.shortName = predefAvatar.getShortName();
+        this.avatarId = predefAvatar.getAvatarId();
+        this.faceIconUri = null;
+
+        return;
+    }
+
+
+    /**
+     * プリセット済みAvatarをフルネームを用いて取得する。
+     * @param seq フルネーム
+     * @return 見つかったプリセット済みAvatar。見つからなければnull。
+     */
+    public static PreDefAvatar getPreDefAvatar(CharSequence seq){
+        for(PreDefAvatar avatar : PREDEF_AVATAR_LIST){
+            String fullName = avatar.getFullName();
+            if(fullName.contentEquals(seq)){
+                return avatar;
+            }
+        }
+        return null;
+    }
+
+    /**
+     * フルネームを取得する。
+     * @return フルネーム
+     */
+    public String getFullName(){
+        return this.fullName;
+    }
+
+    /**
+     * フルネームを設定する。
+     * @param fullName フルネーム
+     */
+    public void setFullName(String fullName){
+        this.fullName = fullName;
+        return;
+    }
+
+    /**
+     * 短縮名を取得する。
+     * @return 短縮名
+     */
+    public String getShortName(){
+        return this.shortName;
+    }
+
+    /**
+     * 短縮名を設定する。
+     * @param shortName 短縮名
+     */
+    public void setShortName(String shortName){
+        this.shortName = shortName;
+        return;
+    }
+
+    /**
+     * Avatar識別子を取得する。
+     * @return Avatar識別子
+     */
+    public String getAvatarId(){
+        return this.avatarId;
+    }
+
+    /**
+     * Avatar識別子を設定する。
+     * @param avatarId Avatar識別子
+     */
+    public void setAvatarId(String avatarId){
+        this.avatarId = avatarId;
+        return;
+    }
+
+    /**
+     * 顔アイコンURI文字列を取得する。
+     * @return 顔アイコンURI文字列
+     */
+    public String getFaceIconUri(){
+        return this.faceIconUri;
+    }
+
+    /**
+     * 顔アイコンURI文字列を設定する。
+     * @param faceIconUri 顔アイコンURI文字列
+     */
+    public void setFaceIconUri(String faceIconUri){
+        this.faceIconUri = faceIconUri;
+        return;
+    }
+
+    /**
+     * avatar要素をXML出力する。
+     * @param writer 出力先
+     * @throws IOException 出力エラー
+     */
+    public void dumpXml(Writer writer) throws IOException{
+        writer.append("<avatar\n");
+
+        XmlUtils.indent(writer, 1);
+        XmlUtils.attrOut(writer, "avatarId", this.avatarId);
+        writer.append('\n');
+
+        XmlUtils.indent(writer, 1);
+        XmlUtils.attrOut(writer, "fullName", this.fullName);
+
+        writer.append(' ');
+        XmlUtils.attrOut(writer, "shortName", this.shortName);
+        writer.append('\n');
+
+        if(this.faceIconUri != null){
+            XmlUtils.indent(writer, 1);
+            XmlUtils.attrOut(writer, "faceIconURI", this.faceIconUri);
+            writer.append('\n');
+            // F1014対策
+        }
+
+        writer.append("/>\n");
+        writer.flush();
+
+        return;
+    }
+
+}