cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ntimof...@apache.org
Subject [1/2] cayenne git commit: Align class name with other value types.
Date Tue, 03 Oct 2017 11:18:30 GMT
Repository: cayenne
Updated Branches:
  refs/heads/master 90327afa5 -> b0e217187


Align class name with other value types.


Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/53ece1e5
Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/53ece1e5
Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/53ece1e5

Branch: refs/heads/master
Commit: 53ece1e5ad56b00d58b954c6f8f43b245b99c7fb
Parents: 90327af
Author: Nikita Timofeev <stariy95@gmail.com>
Authored: Tue Oct 3 14:17:03 2017 +0300
Committer: Nikita Timofeev <stariy95@gmail.com>
Committed: Tue Oct 3 14:17:03 2017 +0300

----------------------------------------------------------------------
 .../cayenne/access/types/CharacterType.java     | 60 --------------------
 .../access/types/CharacterValueType.java        | 60 ++++++++++++++++++++
 .../configuration/server/ServerModule.java      |  4 +-
 3 files changed, 62 insertions(+), 62 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/53ece1e5/cayenne-server/src/main/java/org/apache/cayenne/access/types/CharacterType.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/access/types/CharacterType.java
b/cayenne-server/src/main/java/org/apache/cayenne/access/types/CharacterType.java
deleted file mode 100644
index adc360e..0000000
--- a/cayenne-server/src/main/java/org/apache/cayenne/access/types/CharacterType.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*****************************************************************
- *   Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.apache.cayenne.access.types;
-
-/**
- * This is char and Character type mapped to zero or one char String.
- * @since 4.1
- */
-public class CharacterType implements ValueObjectType<Character, String> {
-    @Override
-    public Class<String> getTargetType() {
-        return String.class;
-    }
-
-    @Override
-    public Class<Character> getValueType() {
-        return Character.class;
-    }
-
-    @Override
-    public Character toJavaObject(String value) {
-        if(value == null) {
-            return null;
-        }
-        if(value.isEmpty()) {
-            return 0;
-        }
-        if(value.length() > 1) {
-            throw new IllegalArgumentException("Only one char String can be used, " + value
+ " used");
-        }
-        return value.charAt(0);
-    }
-
-    @Override
-    public String fromJavaObject(Character object) {
-        return String.valueOf(object);
-    }
-
-    @Override
-    public String toCacheKey(Character object) {
-        return String.valueOf(object);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cayenne/blob/53ece1e5/cayenne-server/src/main/java/org/apache/cayenne/access/types/CharacterValueType.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/access/types/CharacterValueType.java
b/cayenne-server/src/main/java/org/apache/cayenne/access/types/CharacterValueType.java
new file mode 100644
index 0000000..8abae41
--- /dev/null
+++ b/cayenne-server/src/main/java/org/apache/cayenne/access/types/CharacterValueType.java
@@ -0,0 +1,60 @@
+/*****************************************************************
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.apache.cayenne.access.types;
+
+/**
+ * This is char and Character type mapped to zero or one char String.
+ * @since 4.1
+ */
+public class CharacterValueType implements ValueObjectType<Character, String> {
+    @Override
+    public Class<String> getTargetType() {
+        return String.class;
+    }
+
+    @Override
+    public Class<Character> getValueType() {
+        return Character.class;
+    }
+
+    @Override
+    public Character toJavaObject(String value) {
+        if(value == null) {
+            return null;
+        }
+        if(value.isEmpty()) {
+            return 0;
+        }
+        if(value.length() > 1) {
+            throw new IllegalArgumentException("Only one char String can be used, " + value
+ " used");
+        }
+        return value.charAt(0);
+    }
+
+    @Override
+    public String fromJavaObject(Character object) {
+        return String.valueOf(object);
+    }
+
+    @Override
+    public String toCacheKey(Character object) {
+        return String.valueOf(object);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cayenne/blob/53ece1e5/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/ServerModule.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/ServerModule.java
b/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/ServerModule.java
index cf934a6..9dd4001 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/ServerModule.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/ServerModule.java
@@ -40,7 +40,7 @@ import org.apache.cayenne.access.types.BooleanType;
 import org.apache.cayenne.access.types.ByteArrayType;
 import org.apache.cayenne.access.types.ByteType;
 import org.apache.cayenne.access.types.CalendarType;
-import org.apache.cayenne.access.types.CharacterType;
+import org.apache.cayenne.access.types.CharacterValueType;
 import org.apache.cayenne.access.types.CharType;
 import org.apache.cayenne.access.types.DateType;
 import org.apache.cayenne.access.types.DefaultValueObjectTypeRegistry;
@@ -344,7 +344,7 @@ public class ServerModule implements Module {
                 .add(LocalDateValueType.class)
                 .add(LocalTimeValueType.class)
                 .add(LocalDateTimeValueType.class)
-                .add(CharacterType.class);
+                .add(CharacterValueType.class);
 
         binder.bind(ValueObjectTypeRegistry.class).to(DefaultValueObjectTypeRegistry.class);
 


Mime
View raw message