[Jiemamy-notify:1464] commit [2690] refactor

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2009年 2月 19日 (木) 22:34:12 JST


Revision: 2690
          http://svn.sourceforge.jp/view?root=jiemamy&view=rev&rev=2690
Author:   daisuke_m
Date:     2009-02-19 22:34:12 +0900 (Thu, 19 Feb 2009)

Log Message:
-----------
refactor

Modified Paths:
--------------
    artemis/trunk/jiemamy-dialect-mysql/src/main/java/org/jiemamy/dialect/mysql/MySqlDialect.java
    artemis/trunk/jiemamy-dialect-mysql/src/main/java/org/jiemamy/dialect/mysql/MySqlReservedWords.java
    artemis/trunk/jiemamy-dialect-postgresql/src/main/java/org/jiemamy/dialect/postgresql/PostgresqlDialect.java
    artemis/trunk/jiemamy-dialect-postgresql/src/main/java/org/jiemamy/dialect/postgresql/PostgresqlReservedWords.java
    artemis/trunk/jiemamy-dialect-sql99/src/main/java/org/jiemamy/dialect/sql99/Sql99Dialect.java
    artemis/trunk/jiemamy-dialect-sql99/src/main/java/org/jiemamy/dialect/sql99/Sql99ReservedWords.java


-------------- next part --------------
Modified: artemis/trunk/jiemamy-dialect-mysql/src/main/java/org/jiemamy/dialect/mysql/MySqlDialect.java
===================================================================
--- artemis/trunk/jiemamy-dialect-mysql/src/main/java/org/jiemamy/dialect/mysql/MySqlDialect.java	2009-02-19 11:16:10 UTC (rev 2689)
+++ artemis/trunk/jiemamy-dialect-mysql/src/main/java/org/jiemamy/dialect/mysql/MySqlDialect.java	2009-02-19 13:34:12 UTC (rev 2690)
@@ -38,9 +38,13 @@
  */
 public class MySqlDialect extends AbstractDialect {
 	
-	private static final List<BuiltinDataTypeMold> allDataTypes;
+	private final List<BuiltinDataTypeMold> allDataTypes;
 	
-	static {
+
+	/**
+	 * インスタンスを生成する。
+	 */
+	public MySqlDialect() {
 		List<BuiltinDataTypeMold> list = CollectionsUtil.newArrayList();
 		list.add(new BuiltinDataTypeMoldImpl(DataTypeCategory.CHARACTER, SizedDataTypeAdapter.class));
 		list.add(new BuiltinDataTypeMoldImpl(DataTypeCategory.VARCHAR, SizedDataTypeAdapter.class));
@@ -64,14 +68,7 @@
 		// FIXME 適当
 	}
 	
-
 	/**
-	 * インスタンスを生成する。
-	 */
-	public MySqlDialect() {
-	}
-	
-	/**
 	 * {@inheritDoc}
 	 */
 	public List<BuiltinDataTypeMold> getAllDataTypes() {

Modified: artemis/trunk/jiemamy-dialect-mysql/src/main/java/org/jiemamy/dialect/mysql/MySqlReservedWords.java
===================================================================
--- artemis/trunk/jiemamy-dialect-mysql/src/main/java/org/jiemamy/dialect/mysql/MySqlReservedWords.java	2009-02-19 11:16:10 UTC (rev 2689)
+++ artemis/trunk/jiemamy-dialect-mysql/src/main/java/org/jiemamy/dialect/mysql/MySqlReservedWords.java	2009-02-19 13:34:12 UTC (rev 2690)
@@ -18,7 +18,8 @@
  */
 package org.jiemamy.dialect.mysql;
 
-import org.apache.commons.lang.ArrayUtils;
+import java.util.Arrays;
+import java.util.List;
 
 import org.jiemamy.dialect.validator.ReservedWordsProvider;
 
@@ -28,246 +29,41 @@
  */
 public class MySqlReservedWords implements ReservedWordsProvider {
 	
-	private static final String[] RESERVED_WORDS = {
-		"ACCESSIBLE",
-		"ADD",
-		"ALL",
-		"ALTER",
-		"ANALYZE",
-		"AND",
-		"AS",
-		"ASC",
-		"ASENSITIVE",
-		"BEFORE",
-		"BETWEEN",
-		"BIGINT",
-		"BINARY",
-		"BLOB",
-		"BOTH",
-		"BY",
-		"CALL",
-		"CASCADE",
-		"CASE",
-		"CHANGE",
-		"CHAR",
-		"CHARACTER",
-		"CHECK",
-		"COLLATE",
-		"COLUMN",
-		"CONDITION",
-		"CONSTRAINT",
-		"CONTINUE",
-		"CONVERT",
-		"CREATE",
-		"CROSS",
-		"CURRENT_DATE",
-		"CURRENT_TIME",
-		"CURRENT_TIMESTAMP",
-		"CURRENT_USER",
-		"CURSOR",
-		"DATABASE",
-		"DATABASES",
-		"DAY_HOUR",
-		"DAY_MICROSECOND",
-		"DAY_MINUTE",
-		"DAY_SECOND",
-		"DEC",
-		"DECIMAL",
-		"DECLARE",
-		"DEFAULT",
-		"DELAYED",
-		"DELETE",
-		"DESC",
-		"DESCRIBE",
-		"DETERMINISTIC",
-		"DISTINCT",
-		"DISTINCTROW",
-		"DIV",
-		"DOUBLE",
-		"DROP",
-		"DUAL",
-		"EACH",
-		"ELSE",
-		"ELSEIF",
-		"ENCLOSED",
-		"ESCAPED",
-		"EXISTS",
-		"EXIT",
-		"EXPLAIN",
-		"FALSE",
-		"FETCH",
-		"FLOAT",
-		"FLOAT4",
-		"FLOAT8",
-		"FOR",
-		"FORCE",
-		"FOREIGN",
-		"FROM",
-		"FULLTEXT",
-		"GRANT",
-		"GROUP",
-		"HAVING",
-		"HIGH_PRIORITY",
-		"HOUR_MICROSECOND",
-		"HOUR_MINUTE",
-		"HOUR_SECOND",
-		"IF",
-		"IGNORE",
-		"IN",
-		"INDEX",
-		"INFILE",
-		"INNER",
-		"INOUT",
-		"INSENSITIVE",
-		"INSERT",
-		"INT",
-		"INT1",
-		"INT2",
-		"INT3",
-		"INT4",
-		"INT8",
-		"INTEGER",
-		"INTERVAL",
-		"INTO",
-		"IS",
-		"ITERATE",
-		"JOIN",
-		"KEY",
-		"KEYS",
-		"KILL",
-		"LEADING",
-		"LEAVE",
-		"LEFT",
-		"LIKE",
-		"LIMIT",
-		"LINEAR",
-		"LINES",
-		"LOAD",
-		"LOCALTIME",
-		"LOCALTIMESTAMP",
-		"LOCK",
-		"LONG",
-		"LONGBLOB",
-		"LONGTEXT",
-		"LOOP",
-		"LOW_PRIORITY",
-		"MASTER_SSL_VERIFY_SERVER_CERT",
-		"MATCH",
-		"MEDIUMBLOB",
-		"MEDIUMINT",
-		"MEDIUMTEXT",
-		"MIDDLEINT",
-		"MINUTE_MICROSECOND",
-		"MINUTE_SECOND",
-		"MOD",
-		"MODIFIES",
-		"NATURAL",
-		"NOT",
-		"NO_WRITE_TO_BINLOG",
-		"NULL",
-		"NUMERIC",
-		"ON",
-		"OPTIMIZE",
-		"OPTION",
-		"OPTIONALLY",
-		"OR",
-		"ORDER",
-		"OUT",
-		"OUTER",
-		"OUTFILE",
-		"PRECISION",
-		"PRIMARY",
-		"PROCEDURE",
-		"PURGE",
-		"RANGE",
-		"READ",
-		"READS",
-		"READ_ONLY",
-		"READ_WRITE",
-		"REAL",
-		"REFERENCES",
-		"REGEXP",
-		"RELEASE",
-		"RENAME",
-		"REPEAT",
-		"REPLACE",
-		"REQUIRE",
-		"RESTRICT",
-		"RETURN",
-		"REVOKE",
-		"RIGHT",
-		"RLIKE",
-		"SCHEMA",
-		"SCHEMAS",
-		"SECOND_MICROSECOND",
-		"SELECT",
-		"SENSITIVE",
-		"SEPARATOR",
-		"SET",
-		"SHOW",
-		"SMALLINT",
-		"SPATIAL",
-		"SPECIFIC",
-		"SQL",
-		"SQLEXCEPTION",
-		"SQLSTATE",
-		"SQLWARNING",
-		"SQL_BIG_RESULT",
-		"SQL_CALC_FOUND_ROWS",
-		"SQL_SMALL_RESULT",
-		"SSL",
-		"STARTING",
-		"STRAIGHT_JOIN",
-		"TABLE",
-		"TERMINATED",
-		"THEN",
-		"TINYBLOB",
-		"TINYINT",
-		"TINYTEXT",
-		"TO",
-		"TRAILING",
-		"TRIGGER",
-		"TRUE",
-		"UNDO",
-		"UNION",
-		"UNIQUE",
-		"UNLOCK",
-		"UNSIGNED",
-		"UPDATE",
-		"USAGE",
-		"USE",
-		"USING",
-		"UTC_DATE",
-		"UTC_TIME",
-		"UTC_TIMESTAMP",
-		"VALUES",
-		"VARBINARY",
-		"VARCHAR",
-		"VARCHARACTER",
-		"VARYING",
-		"WHEN",
-		"WHERE",
-		"WHILE",
-		"WITH",
-		"WRITE",
-		"X509",
-		"XOR",
-		"YEAR_MONTH",
-		"ZEROFILL",
-		"ACCESSIBLE",
-		"LINEAR",
-		"MASTER_SSL_VERIFY_SERVER_CERT",
-		"RANGE",
-		"READ_ONLY",
-		"READ_WRITE"
-	};
+	private static final List<String> RESERVED_WORDS =
+			Arrays.asList("ACCESSIBLE", "ADD", "ALL", "ALTER", "ANALYZE", "AND", "AS", "ASC", "ASENSITIVE", "BEFORE",
+					"BETWEEN", "BIGINT", "BINARY", "BLOB", "BOTH", "BY", "CALL", "CASCADE", "CASE", "CHANGE", "CHAR",
+					"CHARACTER", "CHECK", "COLLATE", "COLUMN", "CONDITION", "CONSTRAINT", "CONTINUE", "CONVERT",
+					"CREATE", "CROSS", "CURRENT_DATE", "CURRENT_TIME", "CURRENT_TIMESTAMP", "CURRENT_USER", "CURSOR",
+					"DATABASE", "DATABASES", "DAY_HOUR", "DAY_MICROSECOND", "DAY_MINUTE", "DAY_SECOND", "DEC",
+					"DECIMAL", "DECLARE", "DEFAULT", "DELAYED", "DELETE", "DESC", "DESCRIBE", "DETERMINISTIC",
+					"DISTINCT", "DISTINCTROW", "DIV", "DOUBLE", "DROP", "DUAL", "EACH", "ELSE", "ELSEIF", "ENCLOSED",
+					"ESCAPED", "EXISTS", "EXIT", "EXPLAIN", "FALSE", "FETCH", "FLOAT", "FLOAT4", "FLOAT8", "FOR",
+					"FORCE", "FOREIGN", "FROM", "FULLTEXT", "GRANT", "GROUP", "HAVING", "HIGH_PRIORITY",
+					"HOUR_MICROSECOND", "HOUR_MINUTE", "HOUR_SECOND", "IF", "IGNORE", "IN", "INDEX", "INFILE", "INNER",
+					"INOUT", "INSENSITIVE", "INSERT", "INT", "INT1", "INT2", "INT3", "INT4", "INT8", "INTEGER",
+					"INTERVAL", "INTO", "IS", "ITERATE", "JOIN", "KEY", "KEYS", "KILL", "LEADING", "LEAVE", "LEFT",
+					"LIKE", "LIMIT", "LINEAR", "LINES", "LOAD", "LOCALTIME", "LOCALTIMESTAMP", "LOCK", "LONG",
+					"LONGBLOB", "LONGTEXT", "LOOP", "LOW_PRIORITY", "MASTER_SSL_VERIFY_SERVER_CERT", "MATCH",
+					"MEDIUMBLOB", "MEDIUMINT", "MEDIUMTEXT", "MIDDLEINT", "MINUTE_MICROSECOND", "MINUTE_SECOND", "MOD",
+					"MODIFIES", "NATURAL", "NOT", "NO_WRITE_TO_BINLOG", "NULL", "NUMERIC", "ON", "OPTIMIZE", "OPTION",
+					"OPTIONALLY", "OR", "ORDER", "OUT", "OUTER", "OUTFILE", "PRECISION", "PRIMARY", "PROCEDURE",
+					"PURGE", "RANGE", "READ", "READS", "READ_ONLY", "READ_WRITE", "REAL", "REFERENCES", "REGEXP",
+					"RELEASE", "RENAME", "REPEAT", "REPLACE", "REQUIRE", "RESTRICT", "RETURN", "REVOKE", "RIGHT",
+					"RLIKE", "SCHEMA", "SCHEMAS", "SECOND_MICROSECOND", "SELECT", "SENSITIVE", "SEPARATOR", "SET",
+					"SHOW", "SMALLINT", "SPATIAL", "SPECIFIC", "SQL", "SQLEXCEPTION", "SQLSTATE", "SQLWARNING",
+					"SQL_BIG_RESULT", "SQL_CALC_FOUND_ROWS", "SQL_SMALL_RESULT", "SSL", "STARTING", "STRAIGHT_JOIN",
+					"TABLE", "TERMINATED", "THEN", "TINYBLOB", "TINYINT", "TINYTEXT", "TO", "TRAILING", "TRIGGER",
+					"TRUE", "UNDO", "UNION", "UNIQUE", "UNLOCK", "UNSIGNED", "UPDATE", "USAGE", "USE", "USING",
+					"UTC_DATE", "UTC_TIME", "UTC_TIMESTAMP", "VALUES", "VARBINARY", "VARCHAR", "VARCHARACTER",
+					"VARYING", "WHEN", "WHERE", "WHILE", "WITH", "WRITE", "X509", "XOR", "YEAR_MONTH", "ZEROFILL",
+					"ACCESSIBLE", "LINEAR", "MASTER_SSL_VERIFY_SERVER_CERT", "RANGE", "READ_ONLY", "READ_WRITE");
 	
 
 	/**
 	 * {@inheritDoc}
 	 */
 	public boolean isReserved(String name) {
-		return ArrayUtils.contains(RESERVED_WORDS, name);
+		return RESERVED_WORDS.contains(name);
 	}
 	
 }

Modified: artemis/trunk/jiemamy-dialect-postgresql/src/main/java/org/jiemamy/dialect/postgresql/PostgresqlDialect.java
===================================================================
--- artemis/trunk/jiemamy-dialect-postgresql/src/main/java/org/jiemamy/dialect/postgresql/PostgresqlDialect.java	2009-02-19 11:16:10 UTC (rev 2689)
+++ artemis/trunk/jiemamy-dialect-postgresql/src/main/java/org/jiemamy/dialect/postgresql/PostgresqlDialect.java	2009-02-19 13:34:12 UTC (rev 2690)
@@ -34,9 +34,13 @@
  */
 public class PostgresqlDialect extends AbstractDialect {
 	
-	private static final List<BuiltinDataTypeMold> allDataTypes;
+	private final List<BuiltinDataTypeMold> allDataTypes;
 	
-	static {
+
+	/**
+	 * インスタンスを生成する。
+	 */
+	public PostgresqlDialect() {
 		List<BuiltinDataTypeMold> list = CollectionsUtil.newArrayList();
 		list.add(new BuiltinDataTypeMoldImpl(DataTypeCategory.CHARACTER, SizedDataTypeAdapter.class));
 		list.add(new BuiltinDataTypeMoldImpl(DataTypeCategory.VARCHAR, SizedDataTypeAdapter.class));
@@ -58,13 +62,7 @@
 		list.add(new BuiltinDataTypeMoldImpl(DataTypeCategory.INTERVAL));
 		allDataTypes = UnmodifiableList.decorate(list);
 		// FIXME 適当
-	}
-	
-
-	/**
-	 * インスタンスを生成する。
-	 */
-	public PostgresqlDialect() {
+		
 		setQuoter(new PostgresqlQuoter());
 	}
 	

Modified: artemis/trunk/jiemamy-dialect-postgresql/src/main/java/org/jiemamy/dialect/postgresql/PostgresqlReservedWords.java
===================================================================
--- artemis/trunk/jiemamy-dialect-postgresql/src/main/java/org/jiemamy/dialect/postgresql/PostgresqlReservedWords.java	2009-02-19 11:16:10 UTC (rev 2689)
+++ artemis/trunk/jiemamy-dialect-postgresql/src/main/java/org/jiemamy/dialect/postgresql/PostgresqlReservedWords.java	2009-02-19 13:34:12 UTC (rev 2690)
@@ -18,7 +18,8 @@
  */
 package org.jiemamy.dialect.postgresql;
 
-import org.apache.commons.lang.ArrayUtils;
+import java.util.Arrays;
+import java.util.List;
 
 import org.jiemamy.dialect.validator.ReservedWordsProvider;
 
@@ -28,111 +29,25 @@
  */
 public class PostgresqlReservedWords implements ReservedWordsProvider {
 	
-	private static final String[] RESERVED_WORDS = {
-		"ALL",
-		"ANALYSE",
-		"ALL",
-		"ANALYSE",
-		"ANALYZE",
-		"AND",
-		"ANY",
-		"ARRAY",
-		"AS",
-		"ASC",
-		"ASYMMETRIC",
-		"BOTH",
-		"CASE",
-		"CAST",
-		"CHECK",
-		"COLLATE",
-		"COLUMN",
-		"CONSTRAINT",
-		"CREATE",
-		"CURRENT_DATE",
-		"CURRENT_ROLE",
-		"CURRENT_TIME",
-		"CURRENT_TIMESTAMP",
-		"CURRENT_USER",
-		"DEFAULT",
-		"DEFERRABLE",
-		"DESC",
-		"DISTINCT",
-		"DO",
-		"ELSE",
-		"END",
-		"EXCEPT",
-		"FOR",
-		"FOREIGN",
-		"FROM",
-		"GRANT",
-		"GROUP",
-		"HAVING",
-		"IN",
-		"INITIALLY",
-		"INTERSECT",
-		"INTO",
-		"LEADING",
-		"LIMIT",
-		"LOCALTIME",
-		"LOCALTIMESTAMP",
-		"NEW",
-		"NOT",
-		"NULL",
-		"OFF",
-		"OFFSET",
-		"OLD",
-		"ON",
-		"ONLY",
-		"OR",
-		"ORDER",
-		"PLACING",
-		"PRIMARY",
-		"REFERENCES",
-		"RETURNING",
-		"SELECT",
-		"SESSION_USER",
-		"SOME",
-		"SYMMETRIC",
-		"TABLE",
-		"THEN",
-		"TO",
-		"TRAILING",
-		"UNION",
-		"UNIQUE",
-		"USER",
-		"USING",
-		"WHEN",
-		"WHERE",
-		"FALSE",
-		"TRUE",
-		"AUTHORIZATION",
-		"BETWEEN",
-		"BINARY",
-		"CROSS",
-		"FREEZE",
-		"FULL",
-		"ILIKE",
-		"INNER",
-		"IS",
-		"ISNULL",
-		"JOIN",
-		"LEFT",
-		"LIKE",
-		"NATURAL",
-		"NOTNULL",
-		"OUTER",
-		"OVERLAPS",
-		"RIGHT",
-		"SIMILAR",
-		"VERBOSE"
-	};
+	private static final List<String> RESERVED_WORDS =
+			Arrays.asList("ALL", "ANALYSE", "ALL", "ANALYSE", "ANALYZE", "AND", "ANY", "ARRAY", "AS", "ASC",
+					"ASYMMETRIC", "BOTH", "CASE", "CAST", "CHECK", "COLLATE", "COLUMN", "CONSTRAINT", "CREATE",
+					"CURRENT_DATE", "CURRENT_ROLE", "CURRENT_TIME", "CURRENT_TIMESTAMP", "CURRENT_USER", "DEFAULT",
+					"DEFERRABLE", "DESC", "DISTINCT", "DO", "ELSE", "END", "EXCEPT", "FOR", "FOREIGN", "FROM", "GRANT",
+					"GROUP", "HAVING", "IN", "INITIALLY", "INTERSECT", "INTO", "LEADING", "LIMIT", "LOCALTIME",
+					"LOCALTIMESTAMP", "NEW", "NOT", "NULL", "OFF", "OFFSET", "OLD", "ON", "ONLY", "OR", "ORDER",
+					"PLACING", "PRIMARY", "REFERENCES", "RETURNING", "SELECT", "SESSION_USER", "SOME", "SYMMETRIC",
+					"TABLE", "THEN", "TO", "TRAILING", "UNION", "UNIQUE", "USER", "USING", "WHEN", "WHERE", "FALSE",
+					"TRUE", "AUTHORIZATION", "BETWEEN", "BINARY", "CROSS", "FREEZE", "FULL", "ILIKE", "INNER", "IS",
+					"ISNULL", "JOIN", "LEFT", "LIKE", "NATURAL", "NOTNULL", "OUTER", "OVERLAPS", "RIGHT", "SIMILAR",
+					"VERBOSE");
 	
 
 	/**
 	 * {@inheritDoc}
 	 */
 	public boolean isReserved(String name) {
-		return ArrayUtils.contains(RESERVED_WORDS, name);
+		return RESERVED_WORDS.contains(name);
 	}
 	
 }

Modified: artemis/trunk/jiemamy-dialect-sql99/src/main/java/org/jiemamy/dialect/sql99/Sql99Dialect.java
===================================================================
--- artemis/trunk/jiemamy-dialect-sql99/src/main/java/org/jiemamy/dialect/sql99/Sql99Dialect.java	2009-02-19 11:16:10 UTC (rev 2689)
+++ artemis/trunk/jiemamy-dialect-sql99/src/main/java/org/jiemamy/dialect/sql99/Sql99Dialect.java	2009-02-19 13:34:12 UTC (rev 2690)
@@ -38,9 +38,13 @@
  */
 public class Sql99Dialect extends AbstractDialect {
 	
-	private static final List<BuiltinDataTypeMold> allDataTypes;
+	private final List<BuiltinDataTypeMold> allDataTypes;
 	
-	static {
+
+	/**
+	 * インスタンスを生成する。
+	 */
+	public Sql99Dialect() {
 		List<BuiltinDataTypeMold> list = CollectionsUtil.newArrayList();
 		list.add(new BuiltinDataTypeMoldImpl(DataTypeCategory.CHARACTER, SizedDataTypeAdapter.class));
 		list.add(new BuiltinDataTypeMoldImpl(DataTypeCategory.VARCHAR, SizedDataTypeAdapter.class));
@@ -64,14 +68,7 @@
 		// FIXME 適当
 	}
 	
-
 	/**
-	 * インスタンスを生成する。
-	 */
-	public Sql99Dialect() {
-	}
-	
-	/**
 	 * {@inheritDoc}
 	 */
 	public List<BuiltinDataTypeMold> getAllDataTypes() {

Modified: artemis/trunk/jiemamy-dialect-sql99/src/main/java/org/jiemamy/dialect/sql99/Sql99ReservedWords.java
===================================================================
--- artemis/trunk/jiemamy-dialect-sql99/src/main/java/org/jiemamy/dialect/sql99/Sql99ReservedWords.java	2009-02-19 11:16:10 UTC (rev 2689)
+++ artemis/trunk/jiemamy-dialect-sql99/src/main/java/org/jiemamy/dialect/sql99/Sql99ReservedWords.java	2009-02-19 13:34:12 UTC (rev 2690)
@@ -18,7 +18,8 @@
  */
 package org.jiemamy.dialect.sql99;
 
-import org.apache.commons.lang.ArrayUtils;
+import java.util.Arrays;
+import java.util.List;
 
 import org.jiemamy.dialect.validator.ReservedWordsProvider;
 
@@ -28,17 +29,14 @@
  */
 public class Sql99ReservedWords implements ReservedWordsProvider {
 	
-	private static final String[] RESERVED_WORDS = {
-		"FOO",
-		"BAR"
-	};
+	private static final List<String> RESERVED_WORDS = Arrays.asList("FOO", "BAR");
 	
 
 	/**
 	 * {@inheritDoc}
 	 */
 	public boolean isReserved(String name) {
-		return ArrayUtils.contains(RESERVED_WORDS, name);
+		return RESERVED_WORDS.contains(name);
 	}
 	
 }



Jiemamy-notify メーリングリストの案内
Back to archive index