From c2f7b6575156a7c3e049e17248acb6b580ba899f Mon Sep 17 00:00:00 2001 From: Andy Clement Date: Tue, 12 Aug 2008 16:36:40 +0000 Subject: [PATCH] First drop of SPEL --- .../spel/testresources/Company.java | 16 +++++ .../expression/spel/testresources/Fruit.java | 26 ++++++++ .../spel/testresources/Inventor.java | 61 +++++++++++++++++++ .../expression/spel/testresources/Person.java | 28 +++++++++ .../spel/testresources/PlaceOfBirth.java | 24 ++++++++ 5 files changed, 155 insertions(+) create mode 100644 org.springframework.expression/src/test/java/org/springframework/expression/spel/testresources/Company.java create mode 100644 org.springframework.expression/src/test/java/org/springframework/expression/spel/testresources/Fruit.java create mode 100644 org.springframework.expression/src/test/java/org/springframework/expression/spel/testresources/Inventor.java create mode 100644 org.springframework.expression/src/test/java/org/springframework/expression/spel/testresources/Person.java create mode 100644 org.springframework.expression/src/test/java/org/springframework/expression/spel/testresources/PlaceOfBirth.java diff --git a/org.springframework.expression/src/test/java/org/springframework/expression/spel/testresources/Company.java b/org.springframework.expression/src/test/java/org/springframework/expression/spel/testresources/Company.java new file mode 100644 index 00000000000..fe30c027ced --- /dev/null +++ b/org.springframework.expression/src/test/java/org/springframework/expression/spel/testresources/Company.java @@ -0,0 +1,16 @@ +/** + * + */ +package org.springframework.expression.spel.testresources; + +public class Company { + String address; + + public Company(String string) { + this.address = string; + } + + public String getAddress() { + return address; + } +} \ No newline at end of file diff --git a/org.springframework.expression/src/test/java/org/springframework/expression/spel/testresources/Fruit.java b/org.springframework.expression/src/test/java/org/springframework/expression/spel/testresources/Fruit.java new file mode 100644 index 00000000000..1daf7d13161 --- /dev/null +++ b/org.springframework.expression/src/test/java/org/springframework/expression/spel/testresources/Fruit.java @@ -0,0 +1,26 @@ +/** + * + */ +package org.springframework.expression.spel.testresources; + +import java.awt.Color; + +public class Fruit { + public String name; // accessible as property field + public Color color; // accessible as property through getter/setter + public String colorName; // accessible as property through getter/setter + + public Fruit(String name, Color color, String colorName) { + this.name = name; + this.color = color; + this.colorName = colorName; + } + + public Color getColor() { + return color; + } + + public String toString() { + return "A" + (colorName.startsWith("o") ? "n " : " ") + colorName + " " + name; + } +} \ No newline at end of file diff --git a/org.springframework.expression/src/test/java/org/springframework/expression/spel/testresources/Inventor.java b/org.springframework.expression/src/test/java/org/springframework/expression/spel/testresources/Inventor.java new file mode 100644 index 00000000000..4cdd8dcba70 --- /dev/null +++ b/org.springframework.expression/src/test/java/org/springframework/expression/spel/testresources/Inventor.java @@ -0,0 +1,61 @@ +package org.springframework.expression.spel.testresources; + +import java.util.Date; + +@SuppressWarnings("unused") +public class Inventor { + private String name; + private PlaceOfBirth placeOfBirth; + Date birthdate; + private int sinNumber; + private String nationality; + private String[] inventions; + public String randomField; + + public Inventor(String name, Date birthdate, String nationality) { + this.name = name; + this.birthdate = birthdate; + this.nationality = nationality; + } + + public void setPlaceOfBirth(PlaceOfBirth placeOfBirth2) { + this.placeOfBirth = placeOfBirth2; + } + + public void setInventions(String[] inventions) { + this.inventions = inventions; + } + + public PlaceOfBirth getPlaceOfBirth() { + return placeOfBirth; + } + + public String getName() { + return name; + } + + public String echo(Object o) { + return o.toString(); + } + + public String sayHelloTo(String person) { + return "hello " + person; + } + + public String joinThreeStrings(String a, String b, String c) { + return a + b + c; + } + + public int aVarargsMethod(String...strings ) { + if (strings==null) return 0; + return strings.length; + } + public int aVarargsMethod2(int i, String...strings ) { + if (strings==null) return i; + return strings.length+i; + } + + public Inventor(String...strings ) { + + } +} diff --git a/org.springframework.expression/src/test/java/org/springframework/expression/spel/testresources/Person.java b/org.springframework.expression/src/test/java/org/springframework/expression/spel/testresources/Person.java new file mode 100644 index 00000000000..2826f47a965 --- /dev/null +++ b/org.springframework.expression/src/test/java/org/springframework/expression/spel/testresources/Person.java @@ -0,0 +1,28 @@ +package org.springframework.expression.spel.testresources; + + +public class Person { + private String privateName; + Company company; + + public Person(String name) { + this.privateName = name; + } + + public Person(String name, Company company) { + this.privateName = name; + this.company = company; + } + + public String getName() { + return privateName; + } + + public void setName(String n) { + this.privateName = n; + } + + public Company getCompany() { + return company; + } +} \ No newline at end of file diff --git a/org.springframework.expression/src/test/java/org/springframework/expression/spel/testresources/PlaceOfBirth.java b/org.springframework.expression/src/test/java/org/springframework/expression/spel/testresources/PlaceOfBirth.java new file mode 100644 index 00000000000..270ba8774b5 --- /dev/null +++ b/org.springframework.expression/src/test/java/org/springframework/expression/spel/testresources/PlaceOfBirth.java @@ -0,0 +1,24 @@ +package org.springframework.expression.spel.testresources; + +public class PlaceOfBirth { + private String city; + + @Override + public String toString() {return "PlaceOfBirth("+city+")";} + + public String getCity() { + return city; + } + public void setCity(String s) { + this.city = s; + } + + public PlaceOfBirth(String string) { + this.city=string; + } + + public int doubleIt(int i) { + return i*2; + } + +} \ No newline at end of file