[Jiemamy-notify:1497] commit [2720] 不要インターフェイスの削除。

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2009年 2月 23日 (月) 20:51:02 JST


Revision: 2720
          http://svn.sourceforge.jp/view?root=jiemamy&view=rev&rev=2720
Author:   daisuke_m
Date:     2009-02-23 20:51:02 +0900 (Mon, 23 Feb 2009)

Log Message:
-----------
不要インターフェイスの削除。

Modified Paths:
--------------
    artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/AbstractDialect.java
    artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/generic/GenericDialect.java
    artemis/trunk/jiemamy-dialect-postgresql/src/main/java/org/jiemamy/dialect/postgresql/PostgresqlDialect.java
    zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/dialect/Dialect.java

Added Paths:
-----------
    artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/dialect/generic/GenericDialectTest.java

Removed Paths:
-------------
    artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/DefaultQuoter.java
    artemis/trunk/jiemamy-dialect-postgresql/src/main/java/org/jiemamy/dialect/postgresql/PostgresqlQuoter.java
    zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/dialect/Quoter.java


-------------- next part --------------
Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/AbstractDialect.java
===================================================================
--- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/AbstractDialect.java	2009-02-23 11:36:04 UTC (rev 2719)
+++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/AbstractDialect.java	2009-02-23 11:51:02 UTC (rev 2720)
@@ -58,9 +58,6 @@
 	/** {@link DataTypeResolver} */
 	private DataTypeResolver dataTypeResolver = new DefaultDataTypeResolver();
 	
-	/** {@link Quoter} */
-	private Quoter quoter = new DefaultQuoter();
-	
 	/** {@link ConnectionAdvisor} */
 	private ConnectionAdvisor advisor = new DefaultConnectionAdvisor();
 	
@@ -96,10 +93,6 @@
 		return dataTypeResolver;
 	}
 	
-	public Quoter getQuoter() {
-		return quoter;
-	}
-	
 	public Validator getValidator() {
 		return new AllValidator();
 	}
@@ -132,15 +125,6 @@
 	}
 	
 	/**
-	 * {@link Quoter}を設定する。
-	 * 
-	 * @param quoter {@link Quoter}
-	 */
-	protected void setQuoter(Quoter quoter) {
-		this.quoter = quoter;
-	}
-	
-	/**
 	 * {@link DatabaseMetaData}から得られた結果を読み込み、{@link TableModel}を生成する。
 	 * 
 	 * @param factory 

Deleted: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/DefaultQuoter.java
===================================================================
--- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/DefaultQuoter.java	2009-02-23 11:36:04 UTC (rev 2719)
+++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/DefaultQuoter.java	2009-02-23 11:51:02 UTC (rev 2720)
@@ -1,40 +0,0 @@
-/*
- * Copyright 2007-2009 Jiemamy Project and the Others.
- * Created on 2008/09/10
- *
- * This file is part of Jiemamy.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
- * either express or implied. See the License for the specific language
- * governing permissions and limitations under the License.
- */
-package org.jiemamy.dialect;
-
-import org.apache.commons.lang.Validate;
-
-/**
- * {@link Quoter}のデフォルト実装。
- * 
- * @author daisuke
- */
-public class DefaultQuoter implements Quoter {
-	
-	public String quote(String input, QuoteKind kind) {
-		Validate.notNull(input);
-		if (kind == QuoteKind.DATA) {
-			return "'" + input + "'";
-		} else if (kind == QuoteKind.IDENTIFIER) {
-			return "`" + input + "`";
-		}
-		return input;
-	}
-	
-}

Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/generic/GenericDialect.java
===================================================================
--- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/generic/GenericDialect.java	2009-02-23 11:36:04 UTC (rev 2719)
+++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/generic/GenericDialect.java	2009-02-23 11:51:02 UTC (rev 2720)
@@ -30,10 +30,8 @@
 import org.jiemamy.dialect.DataTypeResolver;
 import org.jiemamy.dialect.DefaultConnectionAdvisor;
 import org.jiemamy.dialect.DefaultDataTypeResolver;
-import org.jiemamy.dialect.DefaultQuoter;
 import org.jiemamy.dialect.Dialect;
 import org.jiemamy.dialect.EmitConfig;
-import org.jiemamy.dialect.Quoter;
 import org.jiemamy.model.RootModel;
 import org.jiemamy.model.datatype.DataTypeCategory;
 import org.jiemamy.model.datatype.adapter.PrecisionedDataTypeAdapter;
@@ -50,8 +48,6 @@
  */
 public class GenericDialect implements Dialect {
 	
-	private Quoter quoter = new DefaultQuoter();
-	
 	private DataTypeResolver dataTypeResolver = new DefaultDataTypeResolver();
 	
 	private ConnectionAdvisor advisor = new DefaultConnectionAdvisor();
@@ -105,11 +101,6 @@
 		return dataTypeResolver;
 	}
 	
-	public Quoter getQuoter() {
-		assert quoter != null;
-		return quoter;
-	}
-	
 	public Validator getValidator() {
 		return new AllValidator();
 	}
@@ -118,4 +109,9 @@
 		throw new UnsupportedOperationException();
 	}
 	
+	@Override
+	public String toString() {
+		return this.getClass().getName();
+	}
+	
 }

Added: artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/dialect/generic/GenericDialectTest.java
===================================================================
--- artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/dialect/generic/GenericDialectTest.java	                        (rev 0)
+++ artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/dialect/generic/GenericDialectTest.java	2009-02-23 11:51:02 UTC (rev 2720)
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2007-2009 Jiemamy Project and the Others.
+ * Created on 2009/02/23
+ *
+ * This file is part of Jiemamy.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
+ */
+package org.jiemamy.dialect.generic;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * {@link GenericDialect}のテストクラス。
+ * 
+ * @author daisuke
+ */
+public class GenericDialectTest {
+	
+	private GenericDialect dialect;
+	
+
+	/**
+	 * setup
+	 * 
+	 * @throws java.lang.Exception
+	 */
+	@Before
+	public void setUp() throws Exception {
+		dialect = new GenericDialect();
+	}
+	
+	/**
+	 * teardown
+	 * 
+	 * @throws java.lang.Exception
+	 */
+	@After
+	public void tearDown() throws Exception {
+		dialect = null;
+	}
+	
+	/**
+	 * toStringがFQCNを返す。
+	 * 
+	 * @throws Exception
+	 */
+	@Test
+	public void test01_toStringがFQCNを返す() throws Exception {
+		assertThat(dialect.toString(), is("org.jiemamy.dialect.generic.GenericDialect"));
+	}
+	
+}


Property changes on: artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/dialect/generic/GenericDialectTest.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

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-23 11:36:04 UTC (rev 2719)
+++ artemis/trunk/jiemamy-dialect-postgresql/src/main/java/org/jiemamy/dialect/postgresql/PostgresqlDialect.java	2009-02-23 11:51:02 UTC (rev 2720)
@@ -63,8 +63,6 @@
 		list.add(new BuiltinDataTypeMoldImpl(DataTypeCategory.INTERVAL));
 		allDataTypes = UnmodifiableList.decorate(list);
 		// FIXME 適当
-		
-		setQuoter(new PostgresqlQuoter());
 	}
 	
 	public List<BuiltinDataTypeMold> getAllDataTypes() {

Deleted: artemis/trunk/jiemamy-dialect-postgresql/src/main/java/org/jiemamy/dialect/postgresql/PostgresqlQuoter.java
===================================================================
--- artemis/trunk/jiemamy-dialect-postgresql/src/main/java/org/jiemamy/dialect/postgresql/PostgresqlQuoter.java	2009-02-23 11:36:04 UTC (rev 2719)
+++ artemis/trunk/jiemamy-dialect-postgresql/src/main/java/org/jiemamy/dialect/postgresql/PostgresqlQuoter.java	2009-02-23 11:51:02 UTC (rev 2720)
@@ -1,38 +0,0 @@
-/*
- * Copyright 2007-2009 Jiemamy Project and the Others.
- * Created on 2008/09/10
- *
- * This file is part of Jiemamy.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
- * either express or implied. See the License for the specific language
- * governing permissions and limitations under the License.
- */
-package org.jiemamy.dialect.postgresql;
-
-import org.jiemamy.dialect.Quoter;
-
-/**
- * PostgreSQL用 {@link Quoter}実装。
- * 
- * @author daisuke
- */
-class PostgresqlQuoter implements Quoter {
-	
-	public String quote(String input, QuoteKind kind) {
-		if (kind == QuoteKind.DATA) {
-			return "'" + input + "'";
-		} else if (kind == QuoteKind.IDENTIFIER) {
-			return "`" + input + "`";
-		}
-		return input;
-	}
-}

Modified: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/dialect/Dialect.java
===================================================================
--- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/dialect/Dialect.java	2009-02-23 11:36:04 UTC (rev 2719)
+++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/dialect/Dialect.java	2009-02-23 11:51:02 UTC (rev 2720)
@@ -95,15 +95,6 @@
 	DataTypeResolver getDataTypeResolver();
 	
 	/**
-	 * このSQL方言用の{@link Quoter}を取得する。
-	 * 
-	 * <p>{@code null}を返してはならない。</p>
-	 * 
-	 * @return {@link Quoter}
-	 */
-	Quoter getQuoter();
-	
-	/**
 	 * モデルのバリデータを取得する。
 	 * 
 	 * @return モデルのバリデータ

Deleted: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/dialect/Quoter.java
===================================================================
--- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/dialect/Quoter.java	2009-02-23 11:36:04 UTC (rev 2719)
+++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/dialect/Quoter.java	2009-02-23 11:51:02 UTC (rev 2720)
@@ -1,55 +0,0 @@
-/*
- * Copyright 2007-2009 Jiemamy Project and the Others.
- * Created on 2008/09/09
- *
- * This file is part of Jiemamy.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
- * either express or implied. See the License for the specific language
- * governing permissions and limitations under the License.
- */
-package org.jiemamy.dialect;
-
-/**
- * SQL文中の引用符処理を行うインターフェイス。
- * 
- * @author daisuke
- */
-public interface Quoter {
-	
-	/**
-	 * 引用符で囲む。
-	 * 
-	 * <p>input -> 'input' など。</p>
-	 * 
-	 * <p>kindがnullの場合、何もせず、inputをそのまま返す。</p>
-	 * 
-	 * @param input 入力文字列
-	 * @param kind 引用の種類
-	 * @return 囲んだ結果
-	 * @throws IllegalArgumentException 引数に{@code null}を与えた場合
-	 */
-	String quote(String input, QuoteKind kind);
-	
-
-	/**
-	 * 引用の種類。
-	 * 
-	 * @author daisuke
-	 */
-	public static enum QuoteKind {
-		/** 識別子 */
-		IDENTIFIER,
-
-		/** データ */
-		DATA
-	}
-}



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