added example project
authorAnthony Bargnesi <abargnesi@gmail.com>
Thu, 22 Sep 2016 17:41:11 +0000 (13:41 -0400)
committerAnthony Bargnesi <abargnesi@gmail.com>
Thu, 22 Sep 2016 17:41:11 +0000 (13:41 -0400)
.gitignore
example/pom.xml [new file with mode: 0644]
example/src/main/java/com/myproject/Behavior.java [new file with mode: 0644]
example/src/main/java/com/myproject/NumberTranslator.java [new file with mode: 0644]

index 000f0ea..a47ec35 100755 (executable)
@@ -4,3 +4,4 @@
 /target/
 /.idea/
 dependency-reduced-pom.xml
+/example/target
diff --git a/example/pom.xml b/example/pom.xml
new file mode 100644 (file)
index 0000000..e3d0312
--- /dev/null
@@ -0,0 +1,24 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>com.myproject</groupId>
+    <artifactId>myproject</artifactId>
+    <version>0.0</version>
+    <packaging>jar</packaging>
+    <name>MyProject</name>
+    <description>MyProject</description>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <version>2.3.2</version>
+                <configuration>
+                    <source>1.8</source>
+                    <target>1.8</target>
+                    <encoding>UTF-8</encoding>
+                </configuration>
+            </plugin>
+               </plugins>
+       </build>
+</project>
diff --git a/example/src/main/java/com/myproject/Behavior.java b/example/src/main/java/com/myproject/Behavior.java
new file mode 100644 (file)
index 0000000..d35ce27
--- /dev/null
@@ -0,0 +1,10 @@
+package com.myproject;
+
+public interface Behavior {
+
+    String translate(Object obj);
+
+    default String serialize(Object obj) {
+        return obj.toString();
+    }
+}
diff --git a/example/src/main/java/com/myproject/NumberTranslator.java b/example/src/main/java/com/myproject/NumberTranslator.java
new file mode 100644 (file)
index 0000000..b0cb6c4
--- /dev/null
@@ -0,0 +1,8 @@
+package com.myproject;
+
+public class NumberTranslator implements Behavior {
+
+    public String translate(Object obj) {
+        return serialize(obj);
+    }
+}