You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juneau.apache.org by ja...@apache.org on 2017/03/28 02:34:06 UTC
[2/2] incubator-juneau git commit: More proxy interface testing.
More proxy interface testing.
Project: http://git-wip-us.apache.org/repos/asf/incubator-juneau/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-juneau/commit/4f26c881
Tree: http://git-wip-us.apache.org/repos/asf/incubator-juneau/tree/4f26c881
Diff: http://git-wip-us.apache.org/repos/asf/incubator-juneau/diff/4f26c881
Branch: refs/heads/master
Commit: 4f26c881464571bda58107dad243b0e450150fbe
Parents: b1a30b0
Author: JamesBognar <ja...@apache.org>
Authored: Mon Mar 27 22:33:59 2017 -0400
Committer: JamesBognar <ja...@apache.org>
Committed: Mon Mar 27 22:33:59 2017 -0400
----------------------------------------------------------------------
.../apache/juneau/jena/RdfCommonContext.java | 21 +-
.../java/org/apache/juneau/BeanConfigTest.java | 5 +-
.../org/apache/juneau/PropertyStoreTest.java | 18 +-
.../juneau/a/rttests/RoundTripBeanMapsTest.java | 9 +-
.../juneau/a/rttests/RoundTripClassesTest.java | 8 +-
.../juneau/a/rttests/RoundTripEnumTest.java | 19 +-
.../a/rttests/RoundTripPrimitivesBeansTest.java | 45 ++--
.../a/rttests/RoundTripToObjectMapsTest.java | 6 +-
.../a/rttests/RoundTripTransformBeansTest.java | 37 ++--
.../java/org/apache/juneau/html/CommonTest.java | 17 +-
.../org/apache/juneau/ini/ConfigFileTest.java | 8 +-
.../java/org/apache/juneau/jena/CommonTest.java | 11 +-
.../java/org/apache/juneau/json/CommonTest.java | 17 +-
.../testbeans/PrimitiveAtomicObjectsBean.java | 12 +-
.../juneau/testbeans/PrimitiveObjectsBean.java | 48 ++---
.../ByteArrayBase64SwapComboTest.java | 83 ++++----
.../juneau/urlencoding/Common_UonTest.java | 17 +-
.../urlencoding/Common_UrlEncodingTest.java | 17 +-
.../org/apache/juneau/urlencoding/DTOs.java | 43 ++--
.../org/apache/juneau/utils/PojoQueryTest.java | 68 +++---
.../java/org/apache/juneau/xml/CommonTest.java | 17 +-
.../org/apache/juneau/xml/XmlCollapsedTest.java | 25 +--
.../java/org/apache/juneau/xml/XmlTest.java | 8 +-
.../java/org/apache/juneau/BeanContext.java | 108 +++++-----
.../java/org/apache/juneau/PropertyStore.java | 2 +-
.../org/apache/juneau/dto/swagger/Swagger.java | 19 +-
.../java/org/apache/juneau/utils/AList.java | 34 +++
.../main/java/org/apache/juneau/utils/AMap.java | 36 ++++
.../main/java/org/apache/juneau/utils/ASet.java | 34 +++
.../java/org/apache/juneau/rest/test/DTO2s.java | 43 ++--
.../apache/juneau/rest/test/InterfaceProxy.java | 34 ++-
.../rest/test/InterfaceProxyResource.java | 168 ++++++++++++++-
.../java/org/apache/juneau/rest/test/DTOs.java | 42 ++--
.../juneau/rest/test/InterfaceProxyTest.java | 205 +++++++++++++++++--
.../org/apache/juneau/rest/RestContext.java | 2 +-
.../java/org/apache/juneau/rest/RestUtils.java | 78 +++----
36 files changed, 887 insertions(+), 477 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/4f26c881/juneau-core-rdf/src/main/java/org/apache/juneau/jena/RdfCommonContext.java
----------------------------------------------------------------------
diff --git a/juneau-core-rdf/src/main/java/org/apache/juneau/jena/RdfCommonContext.java b/juneau-core-rdf/src/main/java/org/apache/juneau/jena/RdfCommonContext.java
index c806198..1745f7f 100644
--- a/juneau-core-rdf/src/main/java/org/apache/juneau/jena/RdfCommonContext.java
+++ b/juneau-core-rdf/src/main/java/org/apache/juneau/jena/RdfCommonContext.java
@@ -15,28 +15,27 @@ package org.apache.juneau.jena;
import java.util.*;
import org.apache.juneau.jena.annotation.*;
+import org.apache.juneau.utils.*;
import org.apache.juneau.xml.*;
import org.apache.juneau.xml.annotation.*;
/**
* Configurable properties common to both the {@link RdfSerializer} and {@link RdfParser} classes.
*/
-@SuppressWarnings("serial")
public interface RdfCommonContext {
/**
* Maps RDF writer names to property prefixes that apply to them.
*/
- final static Map<String,String> LANG_PROP_MAP = new HashMap<String,String>() {{
- put("RDF/XML","rdfXml.");
- put("RDF/XML-ABBREV","rdfXml.");
- put("N3","n3.");
- put("N3-PP","n3.");
- put("N3-PLAIN","n3.");
- put("N3-TRIPLES","n3.");
- put("TURTLE","n3.");
- put("N-TRIPLE","ntriple.");
- }};
+ final static Map<String,String> LANG_PROP_MAP = new AMap<String,String>()
+ .append("RDF/XML","rdfXml.")
+ .append("RDF/XML-ABBREV","rdfXml.")
+ .append("N3","n3.")
+ .append("N3-PP","n3.")
+ .append("N3-PLAIN","n3.")
+ .append("N3-TRIPLES","n3.")
+ .append("TURTLE","n3.")
+ .append("N-TRIPLE","ntriple.");
/**
* <b>Configuration property:</b> RDF language.
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/4f26c881/juneau-core-test/src/test/java/org/apache/juneau/BeanConfigTest.java
----------------------------------------------------------------------
diff --git a/juneau-core-test/src/test/java/org/apache/juneau/BeanConfigTest.java b/juneau-core-test/src/test/java/org/apache/juneau/BeanConfigTest.java
index b55b98e..6ec7335 100755
--- a/juneau-core-test/src/test/java/org/apache/juneau/BeanConfigTest.java
+++ b/juneau-core-test/src/test/java/org/apache/juneau/BeanConfigTest.java
@@ -22,9 +22,10 @@ import org.apache.juneau.annotation.*;
import org.apache.juneau.json.*;
import org.apache.juneau.parser.*;
import org.apache.juneau.transform.*;
+import org.apache.juneau.utils.*;
import org.junit.*;
-@SuppressWarnings({"unchecked","rawtypes","serial","javadoc"})
+@SuppressWarnings({"unchecked","rawtypes","javadoc"})
public class BeanConfigTest {
//====================================================================================================
@@ -369,7 +370,7 @@ public class BeanConfigTest {
assertEquals(new Integer(1), session.convertToType(o, LinkedList.class).get(0));
// HashMap to TreeMap
- o = new HashMap<Integer, String>() {{ put(1, "foo"); }};
+ o = new AMap<Integer,String>().append(1, "foo");
assertEquals("foo", session.convertToType(o, TreeMap.class).firstEntry().getValue());
// String to TreeMap
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/4f26c881/juneau-core-test/src/test/java/org/apache/juneau/PropertyStoreTest.java
----------------------------------------------------------------------
diff --git a/juneau-core-test/src/test/java/org/apache/juneau/PropertyStoreTest.java b/juneau-core-test/src/test/java/org/apache/juneau/PropertyStoreTest.java
index 9bc6398..de00d7c 100644
--- a/juneau-core-test/src/test/java/org/apache/juneau/PropertyStoreTest.java
+++ b/juneau-core-test/src/test/java/org/apache/juneau/PropertyStoreTest.java
@@ -17,6 +17,7 @@ import static org.junit.Assert.*;
import java.util.*;
+import org.apache.juneau.utils.*;
import org.apache.juneau.xml.*;
import org.junit.*;
@@ -163,13 +164,12 @@ public class PropertyStoreTest {
//====================================================================================================
// testMapProperties()
//====================================================================================================
- @SuppressWarnings("serial")
@Test
public void testMapProperties() {
PropertyStore f = PropertyStore.create();
String key = "A.f1.map";
- f.setProperty(key, new HashMap<String,String>(){{put("1","1");put("3","3");put("2","2");}});
+ f.setProperty(key, new AMap<String,String>().append("1","1").append("3","3").append("2","2"));
assertObjectEquals("{'1':1,'2':2,'3':3}", f.getMap(key, Integer.class, Integer.class, null));
f.setProperty(key, "{'1':1,'2':2,'3':3}");
@@ -182,7 +182,6 @@ public class PropertyStoreTest {
//====================================================================================================
// Hash code and comparison
//====================================================================================================
- @SuppressWarnings({ "serial" })
@Test
public void testHashCodes() throws Exception {
PropertyStore f1 = PropertyStore.create();
@@ -190,10 +189,10 @@ public class PropertyStoreTest {
f1.setProperty("A.b", true);
f1.setProperty("A.c", String.class);
f1.setProperty("A.d.set", new Object[]{1, true, String.class});
- f1.setProperty("A.e.map", new HashMap<Object,Object>(){{put(true,true);put(1,1);put(String.class,String.class);}});
+ f1.setProperty("A.e.map", new AMap<Object,Object>().append(true,true).append(1,1).append(String.class,String.class));
PropertyStore f2 = PropertyStore.create();
- f2.setProperty("A.e.map", new HashMap<Object,Object>(){{put("1","1");put("true","true");put("java.lang.String","java.lang.String");}});
+ f2.setProperty("A.e.map", new AMap<Object,Object>().append("1","1").append("true","true").append("java.lang.String","java.lang.String"));
f2.setProperty("A.d.set", new Object[]{"true","1","java.lang.String"});
f2.setProperty("A.c", "java.lang.String");
f2.setProperty("A.b", "true");
@@ -240,7 +239,6 @@ public class PropertyStoreTest {
// Conversions on simple properties
//====================================================================================================
@Test
- @SuppressWarnings({ "serial" })
public void testConversionsOnSimpleProperties() throws Exception {
String pName = "A.a";
@@ -447,7 +445,7 @@ public class PropertyStoreTest {
//--------------------------------------------------------------------------------
// Map<Namespace,Namespace>
//--------------------------------------------------------------------------------
- new ConversionTest(pName, new LinkedHashMap<Namespace,Namespace>(){{put(n,n);}})
+ new ConversionTest(pName, new AMap<Namespace,Namespace>().append(n,n))
.testMap(Namespace.class, Namespace.class, "{'{name:\\'foo\\',uri:\\'bar\\'}':{name:'foo',uri:'bar'}}")
.testMap(String.class, String.class, "{'{name:\\'foo\\',uri:\\'bar\\'}':'{name:\\'foo\\',uri:\\'bar\\'}'}");
}
@@ -456,7 +454,6 @@ public class PropertyStoreTest {
// Conversions on set properties
//====================================================================================================
@Test
- @SuppressWarnings({ "serial" })
public void testConversionsOnSetProperties() throws Exception {
String pName = "A.a.set";
@@ -663,7 +660,7 @@ public class PropertyStoreTest {
//--------------------------------------------------------------------------------
// Map<Namespace,Namespace>
//--------------------------------------------------------------------------------
- new ConversionTest(pName, new LinkedHashMap<Namespace,Namespace>(){{put(n,n);}})
+ new ConversionTest(pName, new AMap<Namespace,Namespace>().append(n,n))
.testMap(Namespace.class, Namespace.class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'java.util.LinkedHashMap<org.apache.juneau.xml.Namespace,org.apache.juneau.xml.Namespace>'. Value=[{'{name:\\'foo\\',uri:\\'bar\\'}':{name:'foo',uri:'bar'}}].")
.testMap(String.class, String.class, "Could not retrieve property store property 'A.a.set'. Invalid data conversion from type 'java.util.concurrent.ConcurrentSkipListSet' to type 'java.util.LinkedHashMap<java.lang.String,java.lang.String>'. Value=[{'{name:\\'foo\\',uri:\\'bar\\'}':{name:'foo',uri:'bar'}}].");
}
@@ -673,7 +670,6 @@ public class PropertyStoreTest {
// Conversions on map properties
//====================================================================================================
@Test
- @SuppressWarnings({ "serial" })
public void testConversionsOnMapProperties() throws Exception {
String pName = "A.a.map";
@@ -787,7 +783,7 @@ public class PropertyStoreTest {
//--------------------------------------------------------------------------------
// Map<Namespace,Namespace>
//--------------------------------------------------------------------------------
- new ConversionTest(pName, new LinkedHashMap<Namespace,Namespace>(){{put(n,n);}})
+ new ConversionTest(pName, new AMap<Namespace,Namespace>().append(n,n))
.testMap(Namespace.class, Namespace.class, "{'{name:\\'foo\\',uri:\\'bar\\'}':{name:'foo',uri:'bar'}}")
.testMap(String.class, String.class, "{'{name:\\'foo\\',uri:\\'bar\\'}':'{name:\\'foo\\',uri:\\'bar\\'}'}");
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/4f26c881/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripBeanMapsTest.java
----------------------------------------------------------------------
diff --git a/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripBeanMapsTest.java b/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripBeanMapsTest.java
index a13df15..82c046f 100755
--- a/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripBeanMapsTest.java
+++ b/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripBeanMapsTest.java
@@ -27,6 +27,7 @@ import org.apache.juneau.parser.*;
import org.apache.juneau.serializer.*;
import org.apache.juneau.transform.*;
import org.apache.juneau.transforms.*;
+import org.apache.juneau.utils.*;
import org.junit.*;
/**
@@ -92,9 +93,7 @@ public class RoundTripBeanMapsTest extends RoundTripTest {
//====================================================================================================
@Test
public void testImplListClasses() throws Exception {
- List<IBean> l = new LinkedList<IBean>() {{
- add(new CBean());
- }};
+ List<IBean> l = new AList<IBean>().append(new CBean());
l.get(0).setF1("bar");
l = roundTrip(l, List.class, IBean.class);
@@ -120,9 +119,7 @@ public class RoundTripBeanMapsTest extends RoundTripTest {
//====================================================================================================
@Test
public void testImplMap() throws Exception {
- Map<String,IBean> l = new LinkedHashMap<String,IBean>() {{
- put("foo", new CBean());
- }};
+ Map<String,IBean> l = new AMap<String,IBean>().append("foo", new CBean());
l.get("foo").setF1("bar");
l = roundTrip(l, Map.class, String.class, IBean.class);
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/4f26c881/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripClassesTest.java
----------------------------------------------------------------------
diff --git a/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripClassesTest.java b/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripClassesTest.java
index 4dcba43..e303899 100644
--- a/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripClassesTest.java
+++ b/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripClassesTest.java
@@ -15,10 +15,9 @@ package org.apache.juneau.a.rttests;
import static org.apache.juneau.TestUtils.*;
import static org.junit.Assert.*;
-import java.util.*;
-
import org.apache.juneau.parser.*;
import org.apache.juneau.serializer.*;
+import org.apache.juneau.utils.*;
import org.junit.*;
/**
@@ -32,7 +31,6 @@ public class RoundTripClassesTest extends RoundTripTest {
super(label, s, p, flags);
}
- @SuppressWarnings("serial")
@Test
public void classObjects() throws Exception {
Object o = String.class;
@@ -43,11 +41,11 @@ public class RoundTripClassesTest extends RoundTripTest {
o = roundTrip(o);
assertObjectEquals("['java.lang.String']", o);
- o = new LinkedList<Class<?>>(){{add(String.class);add(Integer.class);}};
+ o = new AList<Class<?>>().append(String.class).append(Integer.class);
o = roundTrip(o);
assertObjectEquals("['java.lang.String','java.lang.Integer']", o);
- o = new LinkedHashMap<Class<?>,Class<?>>(){{put(String.class,String.class);}};
+ o = new AMap<Class<?>,Class<?>>().append(String.class,String.class);
o = roundTrip(o);
assertObjectEquals("{'java.lang.String':'java.lang.String'}", o);
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/4f26c881/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripEnumTest.java
----------------------------------------------------------------------
diff --git a/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripEnumTest.java b/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripEnumTest.java
index ae98392..77a2ec0 100755
--- a/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripEnumTest.java
+++ b/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripEnumTest.java
@@ -20,13 +20,14 @@ import java.util.*;
import org.apache.juneau.json.*;
import org.apache.juneau.parser.*;
import org.apache.juneau.serializer.*;
+import org.apache.juneau.utils.*;
import org.junit.*;
/**
* Tests designed to serialize and parse objects to make sure we end up
* with the same objects for all serializers and parsers.
*/
-@SuppressWarnings({"serial","javadoc"})
+@SuppressWarnings({"javadoc"})
public class RoundTripEnumTest extends RoundTripTest {
public RoundTripEnumTest(String label, SerializerBuilder s, ParserBuilder p, int flags) throws Exception {
@@ -193,10 +194,10 @@ public class RoundTripEnumTest extends RoundTripTest {
f2 = AEnum.BAR;
f3 = new AEnum[]{AEnum.FOO,null};
f4 = new AEnum[][]{{AEnum.FOO,null},null};
- f5 = new ArrayList<AEnum>(){{add(AEnum.FOO);}};
- f6 = new ArrayList<AEnum>(){{add(AEnum.FOO);}};
- f7 = new HashSet<AEnum>(){{add(AEnum.FOO);}};
- f8 = new HashSet<AEnum>(){{add(AEnum.FOO);}};
+ f5 = new AList<AEnum>().append(AEnum.FOO);
+ f6 = new AList<AEnum>().append(AEnum.FOO);
+ f7 = new ASet<AEnum>().append(AEnum.FOO);
+ f8 = new ASet<AEnum>().append(AEnum.FOO);
return this;
}
@@ -235,10 +236,10 @@ public class RoundTripEnumTest extends RoundTripTest {
f2 = BEnum.BAR;
f3 = new BEnum[]{BEnum.FOO,null};
f4 = new BEnum[][]{{BEnum.FOO,null},null};
- f5 = new ArrayList<BEnum>(){{add(BEnum.FOO);}};
- f6 = new ArrayList<BEnum>(){{add(BEnum.FOO);}};
- f7 = new HashSet<BEnum>(){{add(BEnum.FOO);}};
- f8 = new HashSet<BEnum>(){{add(BEnum.FOO);}};
+ f5 = new AList<BEnum>().append(BEnum.FOO);
+ f6 = new AList<BEnum>().append(BEnum.FOO);
+ f7 = new ASet<BEnum>().append(BEnum.FOO);
+ f8 = new ASet<BEnum>().append(BEnum.FOO);
return this;
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/4f26c881/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripPrimitivesBeansTest.java
----------------------------------------------------------------------
diff --git a/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripPrimitivesBeansTest.java b/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripPrimitivesBeansTest.java
index 54e0374..85a87b2 100755
--- a/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripPrimitivesBeansTest.java
+++ b/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripPrimitivesBeansTest.java
@@ -18,13 +18,14 @@ import java.util.*;
import org.apache.juneau.parser.*;
import org.apache.juneau.serializer.*;
+import org.apache.juneau.utils.*;
import org.junit.*;
/**
* Tests designed to serialize and parse objects to make sure we end up
* with the same objects for all serializers and parsers.
*/
-@SuppressWarnings({"serial","javadoc"})
+@SuppressWarnings({"javadoc"})
public class RoundTripPrimitivesBeansTest extends RoundTripTest {
public RoundTripPrimitivesBeansTest(String label, SerializerBuilder s, ParserBuilder p, int flags) throws Exception {
@@ -208,30 +209,14 @@ public class RoundTripPrimitivesBeansTest extends RoundTripTest {
paDouble = new double[][]{{1},{2},null};
// Regular lists of primitives
- plBoolean = new ArrayList<boolean[]>() {{
- add(new boolean[]{true}); add(null);
- }};
- plByte = new ArrayList<byte[]>() {{
- add(new byte[]{1}); add(null);
- }};
- plChar = new ArrayList<char[]>() {{
- add(new char[]{'a'}); add(null);
- }};
- plShort = new ArrayList<short[]>() {{
- add(new short[]{1}); add(null);
- }};
- plInt = new ArrayList<int[]>() {{
- add(new int[]{1}); add(null);
- }};
- plLong = new ArrayList<long[]>() {{
- add(new long[]{1}); add(null);
- }};
- plFloat = new ArrayList<float[]>() {{
- add(new float[]{1}); add(null);
- }};
- plDouble = new ArrayList<double[]>() {{
- add(new double[]{1}); add(null);
- }};
+ plBoolean = new AList<boolean[]>().append(new boolean[]{true}).append(null);
+ plByte = new AList<byte[]>().append(new byte[]{1}).append(null);
+ plChar = new AList<char[]>().append(new char[]{'a'}).append(null);
+ plShort = new AList<short[]>().append(new short[]{1}).append(null);
+ plInt = new AList<int[]>().append(new int[]{1}).append(null);
+ plLong = new AList<long[]>().append(new long[]{1}).append(null);
+ plFloat = new AList<float[]>().append(new float[]{1}).append(null);
+ plDouble = new AList<double[]>().append(new double[]{1}).append(null);
// Anonymous list of primitives
palBoolean = new ArrayList<boolean[]>();
@@ -267,11 +252,11 @@ public class RoundTripPrimitivesBeansTest extends RoundTripTest {
//====================================================================================================
@Test
public void testPrimitivesBeanList() throws Exception {
- List<PrimitivesBean> t = new ArrayList<PrimitivesBean>() {{
- add(new PrimitivesBean().init());
- add(null);
- add(new PrimitivesBean().init());
- }};
+ List<PrimitivesBean> t = new AList<PrimitivesBean>()
+ .append(new PrimitivesBean().init())
+ .append(null)
+ .append(new PrimitivesBean().init())
+ ;
if (p == null)
return;
t = roundTrip(t, List.class, PrimitivesBean.class);
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/4f26c881/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripToObjectMapsTest.java
----------------------------------------------------------------------
diff --git a/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripToObjectMapsTest.java b/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripToObjectMapsTest.java
index a5cf645..c74f65f 100755
--- a/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripToObjectMapsTest.java
+++ b/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripToObjectMapsTest.java
@@ -19,6 +19,7 @@ import java.util.*;
import org.apache.juneau.*;
import org.apache.juneau.parser.*;
import org.apache.juneau.serializer.*;
+import org.apache.juneau.utils.*;
import org.junit.*;
/**
@@ -35,7 +36,6 @@ public class RoundTripToObjectMapsTest extends RoundTripTest {
//====================================================================================================
// Class with X(ObjectMap) constructor and toObjectMap() method.
//====================================================================================================
- @SuppressWarnings({"serial"})
@Test
public void test() throws Exception {
A a = new A(new ObjectMap("{f1:'a',f2:2}"));
@@ -49,13 +49,13 @@ public class RoundTripToObjectMapsTest extends RoundTripTest {
assertEquals("a", aa[0].f1);
assertEquals(2, aa[0].f2);
- List<A> a2 = new ArrayList<A>(){{add(new A(new ObjectMap("{f1:'a',f2:2}")));}};
+ List<A> a2 = new AList<A>().append(new A(new ObjectMap("{f1:'a',f2:2}")));
a2 = roundTrip(a2, List.class, A.class);
assertEquals(1, a2.size());
assertEquals("a", a2.get(0).f1);
assertEquals(2, a2.get(0).f2);
- Map<String,A> a3 = new LinkedHashMap<String,A>(){{put("a", new A(new ObjectMap("{f1:'a',f2:2}")));}};
+ Map<String,A> a3 = new AMap<String,A>().append("a", new A(new ObjectMap("{f1:'a',f2:2}")));
a3 = roundTrip(a3, Map.class, String.class, A.class);
assertEquals(1, a3.size());
assertEquals("a", a3.get("a").f1);
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/4f26c881/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripTransformBeansTest.java
----------------------------------------------------------------------
diff --git a/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripTransformBeansTest.java b/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripTransformBeansTest.java
index a3af81d..7ea011c 100755
--- a/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripTransformBeansTest.java
+++ b/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripTransformBeansTest.java
@@ -26,6 +26,7 @@ import org.apache.juneau.parser.*;
import org.apache.juneau.serializer.*;
import org.apache.juneau.transform.*;
import org.apache.juneau.transforms.*;
+import org.apache.juneau.utils.*;
import org.junit.*;
/**
@@ -115,16 +116,16 @@ public class RoundTripTransformBeansTest extends RoundTripTest {
fByte = new byte[]{0,1,2,3};
fnByte = null;
faByte = new byte[][]{{0,1},{2,3},{4,5}};
- flByte = new ArrayList<byte[]>() {{
- add(new byte[]{1,2,3});
- add(new byte[]{4,5,6});
- add(null);
- }};
- fmByte = new LinkedHashMap<String,byte[]>() {{
- put("foo", new byte[]{1,2,3});
- put("bar", new byte[]{4,5,6});
- put("baz", null);
- }};
+ flByte = new AList<byte[]>()
+ .append(new byte[]{1,2,3})
+ .append(new byte[]{4,5,6})
+ .append(null)
+ ;
+ fmByte = new AMap<String,byte[]>()
+ .append("foo", new byte[]{1,2,3})
+ .append("bar", new byte[]{4,5,6})
+ .append("baz", null)
+ ;
fCalendar = new GregorianCalendar() {{
set(2001, 01, 02, 03, 04, 05);
@@ -144,14 +145,14 @@ public class RoundTripTransformBeansTest extends RoundTripTest {
faDate = new Date[]{
new Date(1000), new Date(2000), new Date(3000)
};
- flDate = new ArrayList<Date>() {{
- add(new Date(4000));
- add(null);
- }};
- fmDate = new LinkedHashMap<String,Date>() {{
- put("foo", new Date(5000));
- put("bar", null);
- }};
+ flDate = new AList<Date>()
+ .append(new Date(4000))
+ .append(null)
+ ;
+ fmDate = new AMap<String,Date>()
+ .append("foo", new Date(5000))
+ .append("bar", null)
+ ;
return this;
}
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/4f26c881/juneau-core-test/src/test/java/org/apache/juneau/html/CommonTest.java
----------------------------------------------------------------------
diff --git a/juneau-core-test/src/test/java/org/apache/juneau/html/CommonTest.java b/juneau-core-test/src/test/java/org/apache/juneau/html/CommonTest.java
index 0f1e267..ab82065 100755
--- a/juneau-core-test/src/test/java/org/apache/juneau/html/CommonTest.java
+++ b/juneau-core-test/src/test/java/org/apache/juneau/html/CommonTest.java
@@ -24,6 +24,7 @@ import org.apache.juneau.*;
import org.apache.juneau.annotation.*;
import org.apache.juneau.serializer.*;
import org.apache.juneau.testbeans.*;
+import org.apache.juneau.utils.*;
import org.junit.*;
@SuppressWarnings({"serial","javadoc"})
@@ -123,8 +124,8 @@ public class CommonTest {
public static C create() {
C t = new C();
- t.f1 = new LinkedList<A>();
- t.f2 = new LinkedList<A>(){{add(null);add(A.create());}};
+ t.f1 = new AList<A>();
+ t.f2 = new AList<A>().append(null).append(A.create());
return t;
}
}
@@ -273,17 +274,11 @@ public class CommonTest {
public static class E1 {
@BeanProperty(properties="f1") public E2 x1 = new E2();
- @BeanProperty(properties="f1") public Map<String,Integer> x2 = new LinkedHashMap<String,Integer>() {{
- put("f1",3); put("f2",4);
- }};
+ @BeanProperty(properties="f1") public Map<String,Integer> x2 = new AMap<String,Integer>().append("f1",3).append("f2",4);
@BeanProperty(properties="f1") public E2[] x3 = {new E2()};
- @BeanProperty(properties="f1") public List<E2> x4 = new LinkedList<E2>() {{
- add(new E2());
- }};
+ @BeanProperty(properties="f1") public List<E2> x4 = new AList<E2>().append(new E2());
@BeanProperty(properties="f1") public ObjectMap[] x5 = {new ObjectMap().append("f1",5).append("f2",6)};
- @BeanProperty(properties="f1") public List<ObjectMap> x6 = new LinkedList<ObjectMap>() {{
- add(new ObjectMap().append("f1",7).append("f2",8));
- }};
+ @BeanProperty(properties="f1") public List<ObjectMap> x6 = new AList<ObjectMap>().append(new ObjectMap().append("f1",7).append("f2",8));
}
public static class E2 {
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/4f26c881/juneau-core-test/src/test/java/org/apache/juneau/ini/ConfigFileTest.java
----------------------------------------------------------------------
diff --git a/juneau-core-test/src/test/java/org/apache/juneau/ini/ConfigFileTest.java b/juneau-core-test/src/test/java/org/apache/juneau/ini/ConfigFileTest.java
index 8c423ef..6e813a2 100755
--- a/juneau-core-test/src/test/java/org/apache/juneau/ini/ConfigFileTest.java
+++ b/juneau-core-test/src/test/java/org/apache/juneau/ini/ConfigFileTest.java
@@ -26,6 +26,7 @@ import org.apache.juneau.internal.*;
import org.apache.juneau.json.*;
import org.apache.juneau.parser.*;
import org.apache.juneau.svl.*;
+import org.apache.juneau.utils.*;
import org.junit.*;
@SuppressWarnings("javadoc")
@@ -596,7 +597,6 @@ public class ConfigFileTest {
//====================================================================================================
// testListeners
//====================================================================================================
- @SuppressWarnings("serial")
@Test
public void testListeners() throws Exception {
ConfigFile[] cff = {
@@ -695,7 +695,7 @@ public class ConfigFileTest {
// setSection(name,contents)
changes.clear();
count[0] = 0;
- cf.setSection("E", new LinkedHashMap<String,String>(){{put("e1", "1");put("e2", "2");}});
+ cf.setSection("E", new AMap<String,String>().append("e1", "1").append("e2", "2"));
assertObjectEquals("['E/e1=1','E/e2=2']", changes);
assertEquals(1, count[0]);
cf.removeSection("E");
@@ -841,8 +841,8 @@ public class ConfigFileTest {
cf.addLines(null, "a1=1", "a2=1").addLines("B", "b1=1", "b2=1");
changes.clear();
count[0] = 0;
- cf.get("default").putAll(new HashMap<String,String>(){{put("a1","1");put("a2","2");put("a3","2");}});
- cf.get("B").putAll(new HashMap<String,String>(){{put("b1","1");put("b2","2");put("b3","2");}});
+ cf.get("default").putAll(new AMap<String,String>().append("a1","1").append("a2","2").append("a3","2"));
+ cf.get("B").putAll(new AMap<String,String>().append("b1","1").append("b2","2").append("b3","2"));
assertObjectEquals("['a2=2','a3=2','B/b2=2','B/b3=2']", changes);
assertEquals(2, count[0]);
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/4f26c881/juneau-core-test/src/test/java/org/apache/juneau/jena/CommonTest.java
----------------------------------------------------------------------
diff --git a/juneau-core-test/src/test/java/org/apache/juneau/jena/CommonTest.java b/juneau-core-test/src/test/java/org/apache/juneau/jena/CommonTest.java
index 538a2d6..7bde736 100755
--- a/juneau-core-test/src/test/java/org/apache/juneau/jena/CommonTest.java
+++ b/juneau-core-test/src/test/java/org/apache/juneau/jena/CommonTest.java
@@ -25,6 +25,7 @@ import org.apache.juneau.annotation.*;
import org.apache.juneau.internal.*;
import org.apache.juneau.jena.annotation.*;
import org.apache.juneau.testbeans.*;
+import org.apache.juneau.utils.*;
import org.junit.*;
@SuppressWarnings({"serial","javadoc"})
@@ -138,8 +139,8 @@ public class CommonTest {
public static C create() {
C t = new C();
- t.f1 = new LinkedList<A>();
- t.f2 = new LinkedList<A>(){{add(null);add(A.create());}};
+ t.f1 = new AList<A>();
+ t.f2 = new AList<A>().append(null).append(A.create());
return t;
}
}
@@ -205,11 +206,11 @@ public class CommonTest {
public static E1 create() {
E1 t = new E1();
t.x1 = new E2();
- t.x2 = new LinkedHashMap<String,Integer>() {{ put("f1",1); put("f2",2); }};
+ t.x2 = new AMap<String,Integer>().append("f1",1).append("f2",2);
t.x3 = new E2[] {new E2()};
- t.x4 = new LinkedList<E2>() {{ add(new E2()); }};
+ t.x4 = new AList<E2>().append(new E2());
t.x5 = new ObjectMap[] {new ObjectMap().append("f1","1").append("f2","2")};
- t.x6 = new LinkedList<ObjectMap>() {{ add(new ObjectMap().append("f1","1").append("f2","2")); }};
+ t.x6 = new AList<ObjectMap>().append(new ObjectMap().append("f1","1").append("f2","2"));
return t;
}
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/4f26c881/juneau-core-test/src/test/java/org/apache/juneau/json/CommonTest.java
----------------------------------------------------------------------
diff --git a/juneau-core-test/src/test/java/org/apache/juneau/json/CommonTest.java b/juneau-core-test/src/test/java/org/apache/juneau/json/CommonTest.java
index 316f96e..ac09b1f 100755
--- a/juneau-core-test/src/test/java/org/apache/juneau/json/CommonTest.java
+++ b/juneau-core-test/src/test/java/org/apache/juneau/json/CommonTest.java
@@ -22,6 +22,7 @@ import java.util.*;
import org.apache.juneau.*;
import org.apache.juneau.annotation.*;
import org.apache.juneau.testbeans.*;
+import org.apache.juneau.utils.*;
import org.junit.*;
@SuppressWarnings({"serial","javadoc"})
@@ -121,8 +122,8 @@ public class CommonTest {
public static C create() {
C t = new C();
- t.f1 = new LinkedList<A>();
- t.f2 = new LinkedList<A>(){{add(null);add(A.create());}};
+ t.f1 = new AList<A>();
+ t.f2 = new AList<A>().append(null).append(A.create());
return t;
}
}
@@ -178,17 +179,11 @@ public class CommonTest {
public static class E1 {
@BeanProperty(properties="f1") public E2 x1 = new E2();
- @BeanProperty(properties="f1") public Map<String,Integer> x2 = new LinkedHashMap<String,Integer>() {{
- put("f1",1); put("f2",2);
- }};
+ @BeanProperty(properties="f1") public Map<String,Integer> x2 = new AMap<String,Integer>().append("f1",1).append("f2",2);
@BeanProperty(properties="f1") public E2[] x3 = {new E2()};
- @BeanProperty(properties="f1") public List<E2> x4 = new LinkedList<E2>() {{
- add(new E2());
- }};
+ @BeanProperty(properties="f1") public List<E2> x4 = new AList<E2>().append(new E2());
@BeanProperty(properties="f1") public ObjectMap[] x5 = {new ObjectMap().append("f1",1).append("f2",2)};
- @BeanProperty(properties="f1") public List<ObjectMap> x6 = new LinkedList<ObjectMap>() {{
- add(new ObjectMap().append("f1",1).append("f2",2));
- }};
+ @BeanProperty(properties="f1") public List<ObjectMap> x6 = new AList<ObjectMap>().append(new ObjectMap().append("f1",1).append("f2",2));
}
public static class E2 {
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/4f26c881/juneau-core-test/src/test/java/org/apache/juneau/testbeans/PrimitiveAtomicObjectsBean.java
----------------------------------------------------------------------
diff --git a/juneau-core-test/src/test/java/org/apache/juneau/testbeans/PrimitiveAtomicObjectsBean.java b/juneau-core-test/src/test/java/org/apache/juneau/testbeans/PrimitiveAtomicObjectsBean.java
index 31fc045..324a44f 100755
--- a/juneau-core-test/src/test/java/org/apache/juneau/testbeans/PrimitiveAtomicObjectsBean.java
+++ b/juneau-core-test/src/test/java/org/apache/juneau/testbeans/PrimitiveAtomicObjectsBean.java
@@ -15,11 +15,13 @@ package org.apache.juneau.testbeans;
import java.util.*;
import java.util.concurrent.atomic.*;
+import org.apache.juneau.utils.*;
+
/**
* Test bean fields of type AtomicInteger and AtomicLong.
* Note that Jena parsers cannot handle these types, so we only test non-Jena parsers.
*/
-@SuppressWarnings({"serial","javadoc"})
+@SuppressWarnings({"javadoc"})
public class PrimitiveAtomicObjectsBean {
// primitive objects
@@ -56,12 +58,8 @@ public class PrimitiveAtomicObjectsBean {
poaAtomicLong = new AtomicLong[][]{{new AtomicLong(1)}, {new AtomicLong(2)}, null};
// Anonymous list of primitives
- poalAtomicInteger = new ArrayList<AtomicInteger[]>() {{
- add(new AtomicInteger[]{new AtomicInteger(1)}); add(null);
- }};
- poalAtomicLong = new ArrayList<AtomicLong[]>() {{
- add(new AtomicLong[]{new AtomicLong(1)}); add(null);
- }};
+ poalAtomicInteger = new AList<AtomicInteger[]>().append(new AtomicInteger[]{new AtomicInteger(1)}).append(null);
+ poalAtomicLong = new AList<AtomicLong[]>().append(new AtomicLong[]{new AtomicLong(1)}).append(null);
// Regular list of primitives
polAtomicInteger = new ArrayList<AtomicInteger[]>();
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/4f26c881/juneau-core-test/src/test/java/org/apache/juneau/testbeans/PrimitiveObjectsBean.java
----------------------------------------------------------------------
diff --git a/juneau-core-test/src/test/java/org/apache/juneau/testbeans/PrimitiveObjectsBean.java b/juneau-core-test/src/test/java/org/apache/juneau/testbeans/PrimitiveObjectsBean.java
index e3c221e..9eacaa6 100755
--- a/juneau-core-test/src/test/java/org/apache/juneau/testbeans/PrimitiveObjectsBean.java
+++ b/juneau-core-test/src/test/java/org/apache/juneau/testbeans/PrimitiveObjectsBean.java
@@ -15,7 +15,9 @@ package org.apache.juneau.testbeans;
import java.math.*;
import java.util.*;
-@SuppressWarnings({"serial","javadoc"})
+import org.apache.juneau.utils.*;
+
+@SuppressWarnings({"javadoc"})
public class PrimitiveObjectsBean {
// primitive objects
@@ -124,39 +126,17 @@ public class PrimitiveObjectsBean {
poaBigDecimal = new BigDecimal[][]{{new BigDecimal("1")}, {new BigDecimal("2")}, null};
// Anonymous list of primitives
- poalBoolean = new ArrayList<Boolean[]>() {{
- add(new Boolean[]{Boolean.TRUE}); add(null);
- }};
- poalByte = new ArrayList<Byte[]>() {{
- add(new Byte[]{1}); add(null);
- }};
- poalChar = new ArrayList<Character[]>() {{
- add(new Character[]{'a'}); add(null);
- }};
- poalShort = new ArrayList<Short[]>() {{
- add(new Short[]{1}); add(null);
- }};
- poalInt = new ArrayList<Integer[]>() {{
- add(new Integer[]{1}); add(null);
- }};
- poalLong = new ArrayList<Long[]>() {{
- add(new Long[]{1l}); add(null);
- }};
- poalFloat = new ArrayList<Float[]>() {{
- add(new Float[]{1f}); add(null);
- }};
- poalDouble = new ArrayList<Double[]>() {{
- add(new Double[]{1d}); add(null);
- }};
- poalNumber = new ArrayList<Number[]>() {{
- add(new Integer[]{1}); add(null);
- }};
- poalBigInteger = new ArrayList<BigInteger[]>() {{
- add(new BigInteger[]{new BigInteger("1")}); add(null);
- }};
- poalBigDecimal = new ArrayList<BigDecimal[]>() {{
- add(new BigDecimal[]{new BigDecimal("1")}); add(null);
- }};
+ poalBoolean = new AList<Boolean[]>().append(new Boolean[]{Boolean.TRUE}).append(null);
+ poalByte = new AList<Byte[]>().append(new Byte[]{1}).append(null);
+ poalChar = new AList<Character[]>().append(new Character[]{'a'}).append(null);
+ poalShort = new AList<Short[]>().append(new Short[]{1}).append(null);
+ poalInt = new AList<Integer[]>().append(new Integer[]{1}).append(null);
+ poalLong = new AList<Long[]>().append(new Long[]{1l}).append(null);
+ poalFloat = new AList<Float[]>().append(new Float[]{1f}).append(null);
+ poalDouble = new AList<Double[]>().append(new Double[]{1d}).append(null);
+ poalNumber = new AList<Number[]>().append(new Integer[]{1}).append(null);
+ poalBigInteger = new AList<BigInteger[]>().append(new BigInteger[]{new BigInteger("1")}).append(null);
+ poalBigDecimal = new AList<BigDecimal[]>().append(new BigDecimal[]{new BigDecimal("1")}).append(null);
// Regular list of primitives
polBoolean = new ArrayList<Boolean[]>();
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/4f26c881/juneau-core-test/src/test/java/org/apache/juneau/transforms/ByteArrayBase64SwapComboTest.java
----------------------------------------------------------------------
diff --git a/juneau-core-test/src/test/java/org/apache/juneau/transforms/ByteArrayBase64SwapComboTest.java b/juneau-core-test/src/test/java/org/apache/juneau/transforms/ByteArrayBase64SwapComboTest.java
index 08934de..5c61b3c 100644
--- a/juneau-core-test/src/test/java/org/apache/juneau/transforms/ByteArrayBase64SwapComboTest.java
+++ b/juneau-core-test/src/test/java/org/apache/juneau/transforms/ByteArrayBase64SwapComboTest.java
@@ -17,6 +17,7 @@ import java.util.*;
import org.apache.juneau.*;
import org.apache.juneau.parser.*;
import org.apache.juneau.serializer.*;
+import org.apache.juneau.utils.*;
import org.junit.runner.*;
import org.junit.runners.*;
@@ -24,7 +25,7 @@ import org.junit.runners.*;
* Exhaustive serialization tests for the CalendarSwap class.
*/
@RunWith(Parameterized.class)
-@SuppressWarnings({"javadoc","serial"})
+@SuppressWarnings({"javadoc"})
public class ByteArrayBase64SwapComboTest extends ComboTest {
@Parameterized.Parameters
@@ -82,11 +83,11 @@ public class ByteArrayBase64SwapComboTest extends ComboTest {
},
{ /* 2 */
"ListOfByteArrays",
- new ArrayList<byte[]>(){{
- add(new byte[]{1,2,3});
- add(new byte[]{4,5,6});
- add(null);
- }},
+ new AList<byte[]>()
+ .append(new byte[]{1,2,3})
+ .append(new byte[]{4,5,6})
+ .append(null)
+ ,
/* Json */ "['AQID','BAUG',null]",
/* JsonT */ "['AQID','BAUG',null]",
/* JsonR */ "[\n\t'AQID',\n\t'BAUG',\n\tnull\n]",
@@ -111,12 +112,12 @@ public class ByteArrayBase64SwapComboTest extends ComboTest {
},
{ /* 3 */
"MapOfByteArrays",
- new LinkedHashMap<String,byte[]>() {{
- put("foo", new byte[]{1,2,3});
- put("bar", null);
- put(null, new byte[]{4,5,6});
- put("null", new byte[]{7,8,9});
- }},
+ new AMap<String,byte[]>()
+ .append("foo", new byte[]{1,2,3})
+ .append("bar", null)
+ .append(null, new byte[]{4,5,6})
+ .append("null", new byte[]{7,8,9})
+ ,
/* Json */ "{foo:'AQID',bar:null,null:'BAUG','null':'BwgJ'}",
/* JsonT */ "{foo:'AQID',bar:null,null:'BAUG','null':'BwgJ'}",
/* JsonR */ "{\n\tfoo: 'AQID',\n\tbar: null,\n\tnull: 'BAUG',\n\t'null': 'BwgJ'\n}",
@@ -378,11 +379,11 @@ public class ByteArrayBase64SwapComboTest extends ComboTest {
public static class BeanWithByteArrayListField {
public List<byte[]> f;
public BeanWithByteArrayListField init() {
- f = new ArrayList<byte[]>() {{
- add(new byte[]{1,2,3});
- add(new byte[]{4,5,6});
- add(null);
- }};
+ f = new AList<byte[]>()
+ .append(new byte[]{1,2,3})
+ .append(new byte[]{4,5,6})
+ .append(null)
+ ;
return this;
}
}
@@ -390,11 +391,11 @@ public class ByteArrayBase64SwapComboTest extends ComboTest {
public static class BeanWithByteArrayMapField {
public Map<String,byte[]> f;
public BeanWithByteArrayMapField init() {
- f = new LinkedHashMap<String,byte[]>() {{
- put("foo", new byte[]{1,2,3});
- put("bar", null);
- put(null, new byte[]{4,5,6});
- }};
+ f = new AMap<String,byte[]>()
+ .append("foo", new byte[]{1,2,3})
+ .append("bar", null)
+ .append(null, new byte[]{4,5,6})
+ ;
return this;
}
}
@@ -402,10 +403,10 @@ public class ByteArrayBase64SwapComboTest extends ComboTest {
public static class BeanWithByteArrayBeanListField {
public List<B> f;
public BeanWithByteArrayBeanListField init() {
- f = new ArrayList<B>() {{
- add(new B().init());
- add(null);
- }};
+ f = new AList<B>()
+ .append(new B().init())
+ .append(null)
+ ;
return this;
}
}
@@ -413,11 +414,11 @@ public class ByteArrayBase64SwapComboTest extends ComboTest {
public static class BeanWithByteArrayBeanMapField {
public Map<String,B> f;
public BeanWithByteArrayBeanMapField init() {
- f = new LinkedHashMap<String,B>() {{
- put("foo", new B().init());
- put("bar", null);
- put(null, new B().init());
- }};
+ f = new AMap<String,B>()
+ .append("foo", new B().init())
+ .append("bar", null)
+ .append(null, new B().init())
+ ;
return this;
}
}
@@ -433,16 +434,16 @@ public class ByteArrayBase64SwapComboTest extends ComboTest {
f1 = new byte[]{1,2,3};
f2 = new byte[][]{{1,2,3},{4,5,6},null};
f3 = null;
- f4 = new ArrayList<byte[]>() {{
- add(new byte[]{1,2,3});
- add(new byte[]{4,5,6});
- add(null);
- }};
- f5 = new LinkedHashMap<String,byte[]>() {{
- put("foo", new byte[]{1,2,3});
- put("bar", null);
- put(null, new byte[]{4,5,6});
- }};
+ f4 = new AList<byte[]>()
+ .append(new byte[]{1,2,3})
+ .append(new byte[]{4,5,6})
+ .append(null)
+ ;
+ f5 = new AMap<String,byte[]>()
+ .append("foo", new byte[]{1,2,3})
+ .append("bar", null)
+ .append(null, new byte[]{4,5,6})
+ ;
return this;
}
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/4f26c881/juneau-core-test/src/test/java/org/apache/juneau/urlencoding/Common_UonTest.java
----------------------------------------------------------------------
diff --git a/juneau-core-test/src/test/java/org/apache/juneau/urlencoding/Common_UonTest.java b/juneau-core-test/src/test/java/org/apache/juneau/urlencoding/Common_UonTest.java
index 187e120..5cc1775 100755
--- a/juneau-core-test/src/test/java/org/apache/juneau/urlencoding/Common_UonTest.java
+++ b/juneau-core-test/src/test/java/org/apache/juneau/urlencoding/Common_UonTest.java
@@ -23,6 +23,7 @@ import org.apache.juneau.*;
import org.apache.juneau.annotation.*;
import org.apache.juneau.testbeans.*;
import org.apache.juneau.uon.*;
+import org.apache.juneau.utils.*;
import org.junit.*;
@SuppressWarnings({"serial","javadoc"})
@@ -121,8 +122,8 @@ public class Common_UonTest {
public static C create() {
C t = new C();
- t.f1 = new LinkedList<A>();
- t.f2 = new LinkedList<A>(){{add(null);add(A.create());}};
+ t.f1 = new AList<A>();
+ t.f2 = new AList<A>().append(null).append(A.create());
return t;
}
}
@@ -172,17 +173,11 @@ public class Common_UonTest {
public static class E1 {
@BeanProperty(properties="f1") public E2 x1 = new E2();
- @BeanProperty(properties="f1") public Map<String,Integer> x2 = new LinkedHashMap<String,Integer>() {{
- put("f1",1); put("f2",2);
- }};
+ @BeanProperty(properties="f1") public Map<String,Integer> x2 = new AMap<String,Integer>().append("f1",1).append("f2",2);
@BeanProperty(properties="f1") public E2[] x3 = {new E2()};
- @BeanProperty(properties="f1") public List<E2> x4 = new LinkedList<E2>() {{
- add(new E2());
- }};
+ @BeanProperty(properties="f1") public List<E2> x4 = new AList<E2>().append(new E2());
@BeanProperty(properties="f1") public ObjectMap[] x5 = {new ObjectMap().append("f1",1).append("f2",2)};
- @BeanProperty(properties="f1") public List<ObjectMap> x6 = new LinkedList<ObjectMap>() {{
- add(new ObjectMap().append("f1",1).append("f2",2));
- }};
+ @BeanProperty(properties="f1") public List<ObjectMap> x6 = new AList<ObjectMap>().append(new ObjectMap().append("f1",1).append("f2",2));
}
public static class E2 {
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/4f26c881/juneau-core-test/src/test/java/org/apache/juneau/urlencoding/Common_UrlEncodingTest.java
----------------------------------------------------------------------
diff --git a/juneau-core-test/src/test/java/org/apache/juneau/urlencoding/Common_UrlEncodingTest.java b/juneau-core-test/src/test/java/org/apache/juneau/urlencoding/Common_UrlEncodingTest.java
index e0b6012..806eaf0 100755
--- a/juneau-core-test/src/test/java/org/apache/juneau/urlencoding/Common_UrlEncodingTest.java
+++ b/juneau-core-test/src/test/java/org/apache/juneau/urlencoding/Common_UrlEncodingTest.java
@@ -22,6 +22,7 @@ import java.util.*;
import org.apache.juneau.*;
import org.apache.juneau.annotation.*;
import org.apache.juneau.testbeans.*;
+import org.apache.juneau.utils.*;
import org.junit.*;
@SuppressWarnings({"serial","javadoc"})
@@ -119,8 +120,8 @@ public class Common_UrlEncodingTest {
public static C create() {
C t = new C();
- t.f1 = new LinkedList<A>();
- t.f2 = new LinkedList<A>(){{add(null);add(A.create());}};
+ t.f1 = new AList<A>();
+ t.f2 = new AList<A>().append(null).append(A.create());
return t;
}
}
@@ -170,17 +171,11 @@ public class Common_UrlEncodingTest {
public static class E1 {
@BeanProperty(properties="f1") public E2 x1 = new E2();
- @BeanProperty(properties="f1") public Map<String,Integer> x2 = new LinkedHashMap<String,Integer>() {{
- put("f1",1); put("f2",2);
- }};
+ @BeanProperty(properties="f1") public Map<String,Integer> x2 = new AMap<String,Integer>().append("f1",1).append("f2",2);
@BeanProperty(properties="f1") public E2[] x3 = {new E2()};
- @BeanProperty(properties="f1") public List<E2> x4 = new LinkedList<E2>() {{
- add(new E2());
- }};
+ @BeanProperty(properties="f1") public List<E2> x4 = new AList<E2>().append(new E2());
@BeanProperty(properties="f1") public ObjectMap[] x5 = {new ObjectMap().append("f1",1).append("f2",2)};
- @BeanProperty(properties="f1") public List<ObjectMap> x6 = new LinkedList<ObjectMap>() {{
- add(new ObjectMap().append("f1",1).append("f2",2));
- }};
+ @BeanProperty(properties="f1") public List<ObjectMap> x6 = new AList<ObjectMap>().append(new ObjectMap().append("f1",1).append("f2",2));
}
public static class E2 {
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/4f26c881/juneau-core-test/src/test/java/org/apache/juneau/urlencoding/DTOs.java
----------------------------------------------------------------------
diff --git a/juneau-core-test/src/test/java/org/apache/juneau/urlencoding/DTOs.java b/juneau-core-test/src/test/java/org/apache/juneau/urlencoding/DTOs.java
index 6e3728f..52cd76b 100755
--- a/juneau-core-test/src/test/java/org/apache/juneau/urlencoding/DTOs.java
+++ b/juneau-core-test/src/test/java/org/apache/juneau/urlencoding/DTOs.java
@@ -16,6 +16,7 @@ import java.util.*;
import org.apache.juneau.annotation.*;
import org.apache.juneau.urlencoding.annotation.*;
+import org.apache.juneau.utils.*;
@SuppressWarnings("javadoc")
public class DTOs {
@@ -36,7 +37,6 @@ public class DTOs {
}
- @SuppressWarnings("serial")
@Bean(sort=true)
public static class B {
public String[] f01;
@@ -86,25 +86,25 @@ public class DTOs {
static B create() {
B t = new B();
t.f01 = new String[]{"a","b"};
- t.f02 = new ArrayList<String>(){{add("c");add("d");}};
+ t.f02 = new AList<String>().append("c").append("d");
t.f03 = new int[]{1,2};
- t.f04 = new ArrayList<Integer>(){{add(3);add(4);}};
+ t.f04 = new AList<Integer>().append(3).append(4);
t.f05 = new String[][]{{"e","f"},{"g","h"}};
- t.f06 = new ArrayList<String[]>(){{add(new String[]{"i","j"});add(new String[]{"k","l"});}};
+ t.f06 = new AList<String[]>().append(new String[]{"i","j"}).append(new String[]{"k","l"});
t.f07 = new A[]{A.create(),A.create()};
- t.f08 = new ArrayList<A>(){{add(A.create());add(A.create());}};
+ t.f08 = new AList<A>().append(A.create()).append(A.create());
t.f09 = new A[][]{{A.create()},{A.create()}};
- t.f10 = new ArrayList<List<A>>(){{add(Arrays.asList(A.create()));add(Arrays.asList(A.create()));}};
+ t.f10 = new AList<List<A>>().append(Arrays.asList(A.create())).append(Arrays.asList(A.create()));
t.setF11(new String[]{"a","b"});
- t.setF12(new ArrayList<String>(){{add("c");add("d");}});
+ t.setF12(new AList<String>().append("c").append("d"));
t.setF13(new int[]{1,2});
- t.setF14(new ArrayList<Integer>(){{add(3);add(4);}});
+ t.setF14(new AList<Integer>().append(3).append(4));
t.setF15(new String[][]{{"e","f"},{"g","h"}});
- t.setF16(new ArrayList<String[]>(){{add(new String[]{"i","j"});add(new String[]{"k","l"});}});
+ t.setF16(new AList<String[]>().append(new String[]{"i","j"}).append(new String[]{"k","l"}));
t.setF17(new A[]{A.create(),A.create()});
- t.setF18(new ArrayList<A>(){{add(A.create());add(A.create());}});
+ t.setF18(new AList<A>().append(A.create()).append(A.create()));
t.setF19(new A[][]{{A.create()},{A.create()}});
- t.setF20(new ArrayList<List<A>>(){{add(Arrays.asList(A.create()));add(Arrays.asList(A.create()));}});
+ t.setF20(new AList<List<A>>().append(Arrays.asList(A.create())).append(Arrays.asList(A.create())));
return t;
}
}
@@ -112,29 +112,28 @@ public class DTOs {
@UrlEncoding(expandedParams=true)
@Bean(sort=true)
public static class C extends B {
- @SuppressWarnings("serial")
static C create() {
C t = new C();
t.f01 = new String[]{"a","b"};
- t.f02 = new ArrayList<String>(){{add("c");add("d");}};
+ t.f02 = new AList<String>().append("c").append("d");
t.f03 = new int[]{1,2};
- t.f04 = new ArrayList<Integer>(){{add(3);add(4);}};
+ t.f04 = new AList<Integer>().append(3).append(4);
t.f05 = new String[][]{{"e","f"},{"g","h"}};
- t.f06 = new ArrayList<String[]>(){{add(new String[]{"i","j"});add(new String[]{"k","l"});}};
+ t.f06 = new AList<String[]>().append(new String[]{"i","j"}).append(new String[]{"k","l"});
t.f07 = new A[]{A.create(),A.create()};
- t.f08 = new ArrayList<A>(){{add(A.create());add(A.create());}};
+ t.f08 = new AList<A>().append(A.create()).append(A.create());
t.f09 = new A[][]{{A.create()},{A.create()}};
- t.f10 = new ArrayList<List<A>>(){{add(Arrays.asList(A.create()));add(Arrays.asList(A.create()));}};
+ t.f10 = new AList<List<A>>().append(Arrays.asList(A.create())).append(Arrays.asList(A.create()));
t.setF11(new String[]{"a","b"});
- t.setF12(new ArrayList<String>(){{add("c");add("d");}});
+ t.setF12(new AList<String>().append("c").append("d"));
t.setF13(new int[]{1,2});
- t.setF14(new ArrayList<Integer>(){{add(3);add(4);}});
+ t.setF14(new AList<Integer>().append(3).append(4));
t.setF15(new String[][]{{"e","f"},{"g","h"}});
- t.setF16(new ArrayList<String[]>(){{add(new String[]{"i","j"});add(new String[]{"k","l"});}});
+ t.setF16(new AList<String[]>().append(new String[]{"i","j"}).append(new String[]{"k","l"}));
t.setF17(new A[]{A.create(),A.create()});
- t.setF18(new ArrayList<A>(){{add(A.create());add(A.create());}});
+ t.setF18(new AList<A>().append(A.create()).append(A.create()));
t.setF19(new A[][]{{A.create()},{A.create()}});
- t.setF20(new ArrayList<List<A>>(){{add(Arrays.asList(A.create()));add(Arrays.asList(A.create()));}});
+ t.setF20(new AList<List<A>>().append(Arrays.asList(A.create())).append(Arrays.asList(A.create())));
return t;
}
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/4f26c881/juneau-core-test/src/test/java/org/apache/juneau/utils/PojoQueryTest.java
----------------------------------------------------------------------
diff --git a/juneau-core-test/src/test/java/org/apache/juneau/utils/PojoQueryTest.java b/juneau-core-test/src/test/java/org/apache/juneau/utils/PojoQueryTest.java
index c73d51a..157c45e 100755
--- a/juneau-core-test/src/test/java/org/apache/juneau/utils/PojoQueryTest.java
+++ b/juneau-core-test/src/test/java/org/apache/juneau/utils/PojoQueryTest.java
@@ -23,7 +23,7 @@ import org.apache.juneau.serializer.*;
import org.apache.juneau.transforms.*;
import org.junit.*;
-@SuppressWarnings({"serial","rawtypes","javadoc"})
+@SuppressWarnings({"rawtypes","javadoc"})
public class PojoQueryTest {
//====================================================================================================
@@ -40,11 +40,11 @@ public class PojoQueryTest {
BeanSession session = BeanContext.DEFAULT.createSession();
List results;
- List<A> in = new LinkedList<A>() {{
- add(new A("foo"));
- add(new A("bar"));
- add(new A("baz"));
- }};
+ List<A> in = new AList<A>()
+ .append(new A("foo"))
+ .append(new A("bar"))
+ .append(new A("baz"))
+ ;
PojoQuery filter = new PojoQuery(in, session);
@@ -279,11 +279,11 @@ public class PojoQueryTest {
BeanSession session = BeanContext.DEFAULT.createSession();
List results;
- List<C> in = new LinkedList<C>() {{
- add(new C(1));
- add(new C(2));
- add(new C(3));
- }};
+ List<C> in = new AList<C>()
+ .append(new C(1))
+ .append(new C(2))
+ .append(new C(3))
+ ;
PojoQuery filter = new PojoQuery(in, session);
@@ -336,11 +336,11 @@ public class PojoQueryTest {
BeanSession session = BeanContext.DEFAULT.createSession();
List results;
- List<D1> in = new LinkedList<D1>() {{
- add(new D1("foo"));
- add(new D1("bar"));
- add(new D1("baz"));
- }};
+ List<D1> in = new AList<D1>()
+ .append(new D1("foo"))
+ .append(new D1("bar"))
+ .append(new D1("baz"))
+ ;
PojoQuery filter = new PojoQuery(in, session);
@@ -394,11 +394,11 @@ public class PojoQueryTest {
BeanSession session = BeanContext.DEFAULT.createSession();
List results;
- List<E> in = new LinkedList<E>() {{
- add(new E("foo", 1, true));
- add(new E("bar", 2, false));
- add(new E("baz", 3, true));
- }};
+ List<E> in = new AList<E>()
+ .append(new E("foo", 1, true))
+ .append(new E("bar", 2, false))
+ .append(new E("baz", 3, true))
+ ;
PojoQuery filter = new PojoQuery(in, session);
@@ -447,11 +447,11 @@ public class PojoQueryTest {
BeanSession session = BeanContext.DEFAULT.createSession();
List results;
- List<F1> in = new LinkedList<F1>() {{
- add(new F1("foo"));
- add(new F1("bar"));
- add(new F1("baz"));
- }};
+ List<F1> in = new AList<F1>()
+ .append(new F1("foo"))
+ .append(new F1("bar"))
+ .append(new F1("baz"))
+ ;
PojoQuery filter = new PojoQuery(in, session);
@@ -478,10 +478,10 @@ public class PojoQueryTest {
F1(final String f1) {
this.f1 = f1;
this.f2 = new F2("f2_"+f1);
- this.f3 = new LinkedList<F2>() {{
- add(new F2("f31_"+f1));
- add(new F2("f32_"+f1));
- }};
+ this.f3 = new AList<F2>()
+ .append(new F2("f31_"+f1))
+ .append(new F2("f32_"+f1))
+ ;
}
}
@@ -572,10 +572,10 @@ public class PojoQueryTest {
H1(final String f1) {
this.f1 = f1;
this.f2 = new H2("f2_"+f1);
- this.f3 = new LinkedList<H2>() {{
- add(new H2("f31_"+f1));
- add(new H2("f32_"+f1));
- }};
+ this.f3 = new AList<H2>()
+ .append(new H2("f31_"+f1))
+ .append(new H2("f32_"+f1))
+ ;
}
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/4f26c881/juneau-core-test/src/test/java/org/apache/juneau/xml/CommonTest.java
----------------------------------------------------------------------
diff --git a/juneau-core-test/src/test/java/org/apache/juneau/xml/CommonTest.java b/juneau-core-test/src/test/java/org/apache/juneau/xml/CommonTest.java
index 240b2e4..07ac1c6 100755
--- a/juneau-core-test/src/test/java/org/apache/juneau/xml/CommonTest.java
+++ b/juneau-core-test/src/test/java/org/apache/juneau/xml/CommonTest.java
@@ -24,6 +24,7 @@ import org.apache.juneau.*;
import org.apache.juneau.annotation.*;
import org.apache.juneau.jena.annotation.*;
import org.apache.juneau.testbeans.*;
+import org.apache.juneau.utils.*;
import org.apache.juneau.xml.annotation.*;
import org.junit.*;
@@ -124,8 +125,8 @@ public class CommonTest {
public static C create() {
C t = new C();
- t.f1 = new LinkedList<A>();
- t.f2 = new LinkedList<A>(){{add(null);add(A.create());}};
+ t.f1 = new AList<A>();
+ t.f2 = new AList<A>().append(null).append(A.create());
return t;
}
}
@@ -187,17 +188,11 @@ public class CommonTest {
public static class E1 {
@BeanProperty(properties="f1,f2") public E2 x1 = new E2();
- @BeanProperty(properties="f1,f2") public Map<String,Integer> x2 = new LinkedHashMap<String,Integer>() {{
- put("f1",1); put("f3",3);
- }};
+ @BeanProperty(properties="f1,f2") public Map<String,Integer> x2 = new AMap<String,Integer>().append("f1",1).append("f3",3);
@BeanProperty(properties="f1,f2") public E2[] x3 = {new E2()};
- @BeanProperty(properties="f1,f2") public List<E2> x4 = new LinkedList<E2>() {{
- add(new E2());
- }};
+ @BeanProperty(properties="f1,f2") public List<E2> x4 = new AList<E2>().append(new E2());
@BeanProperty(properties="f1") public ObjectMap[] x5 = {new ObjectMap().append("f1",1).append("f3",3)};
- @BeanProperty(properties="f1") public List<ObjectMap> x6 = new LinkedList<ObjectMap>() {{
- add(new ObjectMap().append("f1",1).append("f3",3));
- }};
+ @BeanProperty(properties="f1") public List<ObjectMap> x6 = new AList<ObjectMap>().append(new ObjectMap().append("f1",1).append("f3",3));
}
public static class E2 {
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/4f26c881/juneau-core-test/src/test/java/org/apache/juneau/xml/XmlCollapsedTest.java
----------------------------------------------------------------------
diff --git a/juneau-core-test/src/test/java/org/apache/juneau/xml/XmlCollapsedTest.java b/juneau-core-test/src/test/java/org/apache/juneau/xml/XmlCollapsedTest.java
index 1baf835..36b619f 100755
--- a/juneau-core-test/src/test/java/org/apache/juneau/xml/XmlCollapsedTest.java
+++ b/juneau-core-test/src/test/java/org/apache/juneau/xml/XmlCollapsedTest.java
@@ -19,6 +19,7 @@ import static org.junit.Assert.*;
import java.util.*;
import org.apache.juneau.annotation.*;
+import org.apache.juneau.utils.*;
import org.apache.juneau.xml.annotation.*;
import org.junit.*;
@@ -34,9 +35,9 @@ public class XmlCollapsedTest {
XmlParser p = XmlParser.DEFAULT;
A t = new A();
- t.f1 = new LinkedList<String>(){{add("f1a");add("f1b");}};
+ t.f1 = new AList<String>().append("f1a").append("f1b");
t.f2 = new String[]{"f2a","f2b"};
- t.f3 = new LinkedList<String>(){{add("f3a");add("f3b");}};
+ t.f3 = new AList<String>().append("f3a").append("f3b");
t.f4 = new String[]{"f4a","f4b"};
String xml = s.serialize(t);
@@ -74,9 +75,9 @@ public class XmlCollapsedTest {
XmlParser p = XmlParser.DEFAULT;
B t = new B();
- t.f1 = new LinkedList<String>(){{add("f1a");add("f1b");}};
+ t.f1 = new AList<String>().append("f1a").append("f1b");
t.f2 = new String[]{"f2a","f2b"};
- t.f3 = new LinkedList<String>(){{add("f3a");add("f3b");}};
+ t.f3 = new AList<String>().append("f3a").append("f3b");
t.f4 = new String[]{"f4a","f4b"};
String xml = s.serialize(t);
@@ -114,9 +115,9 @@ public class XmlCollapsedTest {
XmlParser p = XmlParser.DEFAULT;
C t = new C();
- t.f1 = new LinkedList<String>(){{add("f1b");}};
+ t.f1 = new AList<String>().append("f1b");
t.f2 = new String[]{"f2b"};
- t.f3 = new LinkedList<String>(){{add("f3b");}};
+ t.f3 = new AList<String>().append("f3b");
t.f4 = new String[]{"f4b"};
String xml = s.serialize(t);
@@ -139,13 +140,13 @@ public class XmlCollapsedTest {
public static class C {
@Xml(format=COLLAPSED)
- public List<String> f1 = new LinkedList<String>(){{add("f1a");}};
+ public List<String> f1 = new AList<String>().append("f1a");
@Xml(format=COLLAPSED)
public String[] f2 = {"f2a"};
@Xml(format=COLLAPSED,childName="xf3")
- public List<String> f3 = new LinkedList<String>(){{add("f3a");}};
+ public List<String> f3 = new AList<String>().append("f3a");
@Xml(format=COLLAPSED,childName="xf4")
public String[] f4 = {"f4a"};
@@ -161,9 +162,9 @@ public class XmlCollapsedTest {
XmlParser p = XmlParser.DEFAULT;
D t = new D();
- t.f1 = new LinkedList<String>(){{add("f1a");}};
+ t.f1 = new AList<String>().append("f1a");
t.f2 = new String[]{"f2a"};
- t.f3 = new LinkedList<String>(){{add("f3a");}};
+ t.f3 = new AList<String>().append("f3a");
t.f4 = new String[]{"f4a"};
String xml = s.serialize(t);
@@ -222,8 +223,8 @@ public class XmlCollapsedTest {
XmlParser p = XmlParser.DEFAULT;
E t = new E();
- t.f1 = new LinkedList<String>(){{add("f1a");}};
- t.f2 = new LinkedList<String>(){{add("f2a");}};
+ t.f1 = new AList<String>().append("f1a");
+ t.f2 = new AList<String>().append("f2a");
String xml = s.serialize(t);
assertEquals("<object><f1>f1a</f1><xf2>f2a</xf2></object>", xml);
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/4f26c881/juneau-core-test/src/test/java/org/apache/juneau/xml/XmlTest.java
----------------------------------------------------------------------
diff --git a/juneau-core-test/src/test/java/org/apache/juneau/xml/XmlTest.java b/juneau-core-test/src/test/java/org/apache/juneau/xml/XmlTest.java
index 555ca49..1926e12 100755
--- a/juneau-core-test/src/test/java/org/apache/juneau/xml/XmlTest.java
+++ b/juneau-core-test/src/test/java/org/apache/juneau/xml/XmlTest.java
@@ -23,6 +23,7 @@ import org.apache.juneau.*;
import org.apache.juneau.annotation.*;
import org.apache.juneau.jena.annotation.*;
import org.apache.juneau.json.*;
+import org.apache.juneau.utils.*;
import org.apache.juneau.xml.annotation.*;
import org.apache.juneau.xml.xml1a.*;
import org.apache.juneau.xml.xml1b.*;
@@ -293,10 +294,9 @@ public class XmlTest {
@Bean(typeName="foo")
public static class J1 {
- @BeanProperty(properties="f2") public List<J2> f1 = new LinkedList<J2>() {{
- add(new J2());
- }};}
-
+ @BeanProperty(properties="f2") public List<J2> f1 = new AList<J2>().append(new J2());
+ }
+
@Bean(typeName="bar")
public static class J2 {
public int f2 = 2;
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/4f26c881/juneau-core/src/main/java/org/apache/juneau/BeanContext.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/BeanContext.java b/juneau-core/src/main/java/org/apache/juneau/BeanContext.java
index 2a2f75a..763d76e 100644
--- a/juneau-core/src/main/java/org/apache/juneau/BeanContext.java
+++ b/juneau-core/src/main/java/org/apache/juneau/BeanContext.java
@@ -1126,56 +1126,12 @@ public class BeanContext extends Context {
if (o instanceof ClassMeta)
return (ClassMeta)o;
- Class c = null;
- if (o instanceof Class) {
- c = (Class)o;
- } else if (o instanceof ParameterizedType) {
- // A parameter (e.g. <String>.
- c = (Class<?>)((ParameterizedType)o).getRawType();
- } else if (o instanceof GenericArrayType) {
- // An array parameter (e.g. <byte[]>.
- GenericArrayType gat = (GenericArrayType)o;
- Type gatct = gat.getGenericComponentType();
- if (gatct instanceof Class) {
- Class gatctc = (Class)gatct;
- c = Array.newInstance(gatctc, 0).getClass();
- } else if (gatct instanceof ParameterizedType) {
- Class gatctc = (Class<?>)((ParameterizedType)gatct).getRawType();
- c = Array.newInstance(gatctc, 0).getClass();
- } else {
- return null;
- }
- } else if (o instanceof TypeVariable) {
- if (typeVarImpls != null) {
- TypeVariable t = (TypeVariable) o;
- String varName = t.getName();
- int varIndex = -1;
- Class gc = (Class)t.getGenericDeclaration();
- TypeVariable[] tv = gc.getTypeParameters();
- for (int i = 0; i < tv.length; i++) {
- if (tv[i].getName().equals(varName)) {
- varIndex = i;
- }
- }
- if (varIndex != -1) {
+ Class c = resolve(o, typeVarImpls);
- // If we couldn't find a type variable implementation, that means
- // the type was defined at runtime (e.g. Bean b = new Bean<Foo>();)
- // in which case the type is lost through erasure.
- // Assume java.lang.Object as the type.
- if (! typeVarImpls.containsKey(gc))
- return object();
-
- return getClassMeta(typeVarImpls.get(gc)[varIndex]);
- }
- }
- // We don't know the bounded type, so just resolve to Object.
- return object();
- } else {
- // This can happen when trying to resolve the "E getFirst()" method on LinkedList, whose type is a TypeVariable
- // These should just resolve to Object.
+ // This can happen when trying to resolve the "E getFirst()" method on LinkedList, whose type is a TypeVariable
+ // These should just resolve to Object.
+ if (c == null)
return object();
- }
ClassMeta rawType = getClassMeta(c);
@@ -1205,6 +1161,62 @@ public class BeanContext extends Context {
return rawType;
}
+ /**
+ * Convert a Type to a Class if possible.
+ * Return null if not possible.
+ */
+ final Class resolve(Type t, Map<Class<?>,Class<?>[]> typeVarImpls) {
+
+ if (t instanceof Class)
+ return (Class)t;
+
+ if (t instanceof ParameterizedType)
+ // A parameter (e.g. <String>.
+ return (Class)((ParameterizedType)t).getRawType();
+
+ if (t instanceof GenericArrayType) {
+ // An array parameter (e.g. <byte[]>).
+ Type gatct = ((GenericArrayType)t).getGenericComponentType();
+
+ if (gatct instanceof Class)
+ return Array.newInstance((Class)gatct, 0).getClass();
+
+ if (gatct instanceof ParameterizedType)
+ return Array.newInstance((Class)((ParameterizedType)gatct).getRawType(), 0).getClass();
+
+ if (gatct instanceof GenericArrayType)
+ return Array.newInstance(resolve(gatct, typeVarImpls), 0).getClass();
+
+ return null;
+
+ } else if (t instanceof TypeVariable) {
+ if (typeVarImpls != null) {
+ TypeVariable tv = (TypeVariable)t;
+ String varName = tv.getName();
+ int varIndex = -1;
+ Class gc = (Class)tv.getGenericDeclaration();
+ TypeVariable[] tvv = gc.getTypeParameters();
+ for (int i = 0; i < tvv.length; i++) {
+ if (tvv[i].getName().equals(varName)) {
+ varIndex = i;
+ }
+ }
+ if (varIndex != -1) {
+
+ // If we couldn't find a type variable implementation, that means
+ // the type was defined at runtime (e.g. Bean b = new Bean<Foo>();)
+ // in which case the type is lost through erasure.
+ // Assume java.lang.Object as the type.
+ if (! typeVarImpls.containsKey(gc))
+ return null;
+
+ return typeVarImpls.get(gc)[varIndex];
+ }
+ }
+ }
+ return null;
+ }
+
final ClassMeta[] findParameters(Type o, Class c) {
if (o == null)
o = c;
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/4f26c881/juneau-core/src/main/java/org/apache/juneau/PropertyStore.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/PropertyStore.java b/juneau-core/src/main/java/org/apache/juneau/PropertyStore.java
index 48d78eb..8d19304 100644
--- a/juneau-core/src/main/java/org/apache/juneau/PropertyStore.java
+++ b/juneau-core/src/main/java/org/apache/juneau/PropertyStore.java
@@ -146,7 +146,7 @@ import org.apache.juneau.parser.*;
* ps.putToProperty(<js>"BeanContext.implClasses.map"</js>, MyInterface.<jk>class</jk>, MyInterfaceImpl.<jk>class</jk>);
*
* <jc>// Append to map property using set().</jc>
- * Map m = <jk>new</jk> HashMap(){{put(MyInterface.<jk>class</jk>,MyInterfaceImpl.<jk>class</jk>)}};
+ * Map m = <jk>new</jk> AMap().append(MyInterface.<jk>class</jk>,MyInterfaceImpl.<jk>class</jk>);
* ps.setProperty(<js>"BeanContext.implClasses.map.put"</js>, m);
* </p>
* <p>
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/4f26c881/juneau-core/src/main/java/org/apache/juneau/dto/swagger/Swagger.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/dto/swagger/Swagger.java b/juneau-core/src/main/java/org/apache/juneau/dto/swagger/Swagger.java
index 6463b3a..c40dbff 100644
--- a/juneau-core/src/main/java/org/apache/juneau/dto/swagger/Swagger.java
+++ b/juneau-core/src/main/java/org/apache/juneau/dto/swagger/Swagger.java
@@ -16,6 +16,7 @@ import java.util.*;
import org.apache.juneau.*;
import org.apache.juneau.annotation.*;
+import org.apache.juneau.utils.*;
/**
* This is the root document object for the API specification.
@@ -865,16 +866,14 @@ public class Swagger extends SwaggerElement {
}
private static class MethodSorter implements Comparator<String> {
- @SuppressWarnings("serial")
- private final Map<String,Integer> methods = new HashMap<String,Integer>(){{
- put("get",7);
- put("put",6);
- put("post",5);
- put("delete",4);
- put("options",3);
- put("head",2);
- put("patch",1);
- }};
+ private final Map<String,Integer> methods = new AMap<String,Integer>()
+ .append("get",7)
+ .append("put",6)
+ .append("post",5)
+ .append("delete",4)
+ .append("options",3)
+ .append("head",2)
+ .append("patch",1);
@Override
public int compare(String o1, String o2) {
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/4f26c881/juneau-core/src/main/java/org/apache/juneau/utils/AList.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/utils/AList.java b/juneau-core/src/main/java/org/apache/juneau/utils/AList.java
new file mode 100644
index 0000000..b4873b9
--- /dev/null
+++ b/juneau-core/src/main/java/org/apache/juneau/utils/AList.java
@@ -0,0 +1,34 @@
+// ***************************************************************************************************************************
+// * 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.juneau.utils;
+
+import java.util.*;
+
+/**
+ * An extension of {@link LinkedList} with a convenience {@link #append(Object)} method.
+ * @param <T> The entry type.
+ */
+@SuppressWarnings("serial")
+public class AList<T> extends LinkedList<T> {
+
+ /**
+ * Adds an entry to this list.
+ *
+ * @param t The entry to add to this list.
+ * @return This object (for method chaining).
+ */
+ public AList<T> append(T t) {
+ add(t);
+ return this;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/4f26c881/juneau-core/src/main/java/org/apache/juneau/utils/AMap.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/utils/AMap.java b/juneau-core/src/main/java/org/apache/juneau/utils/AMap.java
new file mode 100644
index 0000000..059ef80
--- /dev/null
+++ b/juneau-core/src/main/java/org/apache/juneau/utils/AMap.java
@@ -0,0 +1,36 @@
+// ***************************************************************************************************************************
+// * 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.juneau.utils;
+
+import java.util.*;
+
+/**
+ * An extension of {@link LinkedHashMap} with a convenience {@link #append(Object,Object)} method.
+ * @param <K> The key type.
+ * @param <V> The value type.
+ */
+@SuppressWarnings("serial")
+public class AMap<K,V> extends LinkedHashMap<K,V> {
+
+ /**
+ * Adds an entry to this map.
+ *
+ * @param k The key.
+ * @param v The value.
+ * @return This object (for method chaining).
+ */
+ public AMap<K,V> append(K k, V v) {
+ put(k, v);
+ return this;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/4f26c881/juneau-core/src/main/java/org/apache/juneau/utils/ASet.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/utils/ASet.java b/juneau-core/src/main/java/org/apache/juneau/utils/ASet.java
new file mode 100644
index 0000000..64647f3
--- /dev/null
+++ b/juneau-core/src/main/java/org/apache/juneau/utils/ASet.java
@@ -0,0 +1,34 @@
+// ***************************************************************************************************************************
+// * 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.juneau.utils;
+
+import java.util.*;
+
+/**
+ * An extension of {@link LinkedHashSet} with a convenience {@link #append(Object)} method.
+ * @param <T> The entry type.
+ */
+@SuppressWarnings("serial")
+public class ASet<T> extends LinkedHashSet<T> {
+
+ /**
+ * Adds an entry to this set.
+ *
+ * @param t The entry to add to this set.
+ * @return This object (for method chaining).
+ */
+ public ASet<T> append(T t) {
+ add(t);
+ return this;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/4f26c881/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/DTO2s.java
----------------------------------------------------------------------
diff --git a/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/DTO2s.java b/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/DTO2s.java
index a1820c7..262d34c 100644
--- a/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/DTO2s.java
+++ b/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/DTO2s.java
@@ -16,6 +16,7 @@ import java.util.*;
import org.apache.juneau.annotation.*;
import org.apache.juneau.urlencoding.annotation.*;
+import org.apache.juneau.utils.*;
public class DTO2s {
@@ -35,7 +36,6 @@ public class DTO2s {
}
- @SuppressWarnings("serial")
@Bean(sort=true)
public static class B {
public String[] f01;
@@ -85,54 +85,53 @@ public class DTO2s {
static B create() {
B t = new B();
t.f01 = new String[]{"a","b"};
- t.f02 = new ArrayList<String>(){{add("c");add("d");}};
+ t.f02 = new AList<String>().append("c").append("d");
t.f03 = new int[]{1,2};
- t.f04 = new ArrayList<Integer>(){{add(3);add(4);}};
+ t.f04 = new AList<Integer>().append(3).append(4);
t.f05 = new String[][]{{"e","f"},{"g","h"}};
- t.f06 = new ArrayList<String[]>(){{add(new String[]{"i","j"});add(new String[]{"k","l"});}};
+ t.f06 = new AList<String[]>().append(new String[]{"i","j"}).append(new String[]{"k","l"});
t.f07 = new A[]{A.create(),A.create()};
- t.f08 = new ArrayList<A>(){{add(A.create());add(A.create());}};
+ t.f08 = new AList<A>().append(A.create()).append(A.create());
t.f09 = new A[][]{{A.create()},{A.create()}};
- t.f10 = new ArrayList<List<A>>(){{add(Arrays.asList(A.create()));add(Arrays.asList(A.create()));}};
+ t.f10 = new AList<List<A>>().append(Arrays.asList(A.create())).append(Arrays.asList(A.create()));
t.setF11(new String[]{"a","b"});
- t.setF12(new ArrayList<String>(){{add("c");add("d");}});
+ t.setF12(new AList<String>().append("c").append("d"));
t.setF13(new int[]{1,2});
- t.setF14(new ArrayList<Integer>(){{add(3);add(4);}});
+ t.setF14(new AList<Integer>().append(3).append(4));
t.setF15(new String[][]{{"e","f"},{"g","h"}});
- t.setF16(new ArrayList<String[]>(){{add(new String[]{"i","j"});add(new String[]{"k","l"});}});
+ t.setF16(new AList<String[]>().append(new String[]{"i","j"}).append(new String[]{"k","l"}));
t.setF17(new A[]{A.create(),A.create()});
- t.setF18(new ArrayList<A>(){{add(A.create());add(A.create());}});
+ t.setF18(new AList<A>().append(A.create()).append(A.create()));
t.setF19(new A[][]{{A.create()},{A.create()}});
- t.setF20(new ArrayList<List<A>>(){{add(Arrays.asList(A.create()));add(Arrays.asList(A.create()));}});
+ t.setF20(new AList<List<A>>().append(Arrays.asList(A.create())).append(Arrays.asList(A.create())));
return t;
}
}
@UrlEncoding(expandedParams=true)
public static class C extends B {
- @SuppressWarnings("serial")
static C create() {
C t = new C();
t.f01 = new String[]{"a","b"};
- t.f02 = new ArrayList<String>(){{add("c");add("d");}};
+ t.f02 = new AList<String>().append("c").append("d");
t.f03 = new int[]{1,2};
- t.f04 = new ArrayList<Integer>(){{add(3);add(4);}};
+ t.f04 = new AList<Integer>().append(3).append(4);
t.f05 = new String[][]{{"e","f"},{"g","h"}};
- t.f06 = new ArrayList<String[]>(){{add(new String[]{"i","j"});add(new String[]{"k","l"});}};
+ t.f06 = new AList<String[]>().append(new String[]{"i","j"}).append(new String[]{"k","l"});
t.f07 = new A[]{A.create(),A.create()};
- t.f08 = new ArrayList<A>(){{add(A.create());add(A.create());}};
+ t.f08 = new AList<A>().append(A.create()).append(A.create());
t.f09 = new A[][]{{A.create()},{A.create()}};
- t.f10 = new ArrayList<List<A>>(){{add(Arrays.asList(A.create()));add(Arrays.asList(A.create()));}};
+ t.f10 = new AList<List<A>>().append(Arrays.asList(A.create())).append(Arrays.asList(A.create()));
t.setF11(new String[]{"a","b"});
- t.setF12(new ArrayList<String>(){{add("c");add("d");}});
+ t.setF12(new AList<String>().append("c").append("d"));
t.setF13(new int[]{1,2});
- t.setF14(new ArrayList<Integer>(){{add(3);add(4);}});
+ t.setF14(new AList<Integer>().append(3).append(4));
t.setF15(new String[][]{{"e","f"},{"g","h"}});
- t.setF16(new ArrayList<String[]>(){{add(new String[]{"i","j"});add(new String[]{"k","l"});}});
+ t.setF16(new AList<String[]>().append(new String[]{"i","j"}).append(new String[]{"k","l"}));
t.setF17(new A[]{A.create(),A.create()});
- t.setF18(new ArrayList<A>(){{add(A.create());add(A.create());}});
+ t.setF18(new AList<A>().append(A.create()).append(A.create()));
t.setF19(new A[][]{{A.create()},{A.create()}});
- t.setF20(new ArrayList<List<A>>(){{add(Arrays.asList(A.create()));add(Arrays.asList(A.create()));}});
+ t.setF20(new AList<List<A>>().append(Arrays.asList(A.create())).append(Arrays.asList(A.create())));
return t;
}
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/4f26c881/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/InterfaceProxy.java
----------------------------------------------------------------------
diff --git a/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/InterfaceProxy.java b/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/InterfaceProxy.java
index 67e2f5f..f138488 100644
--- a/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/InterfaceProxy.java
+++ b/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/InterfaceProxy.java
@@ -28,8 +28,23 @@ public interface InterfaceProxy {
String returnString();
String returnNullString();
int[] returnIntArray();
+ int[][] returnInt2dArray();
+ int[][][] returnInt3dArray();
+ Integer[] returnIntegerArray();
+ Integer[][] returnInteger2dArray();
+ Integer[][][] returnInteger3dArray();
String[] returnStringArray();
+ String[][] returnString2dArray();
+ String[][][] returnString3dArray();
List<Integer> returnIntegerList();
+ List<List<Integer>> returnInteger2dList();
+ List<List<List<Integer>>> returnInteger3dList();
+ List<Integer[]> returnInteger1d1dList();
+ List<Integer[][]> returnInteger1d2dList();
+ List<Integer[][][]> returnInteger1d3dList();
+ List<int[]> returnInt1d1dList();
+ List<int[][]> returnInt1d2dList();
+ List<int[][][]> returnInt1d3dList();
List<String> returnStringList();
Bean returnBean();
Bean[] returnBeanArray();
@@ -50,8 +65,23 @@ public interface InterfaceProxy {
void setString(String x);
void setNullString(String x);
void setIntArray(int[] x);
+ void setInt2dArray(int[][] x);
+ void setInt3dArray(int[][][] x);
+ void setIntegerArray(Integer[] x);
+ void setInteger2dArray(Integer[][] x);
+ void setInteger3dArray(Integer[][][] x);
void setStringArray(String[] x);
+ void setString2dArray(String[][] x);
+ void setString3dArray(String[][][] x);
void setIntegerList(List<Integer> x);
+ void setInteger2dList(List<List<Integer>> x);
+ void setInteger3dList(List<List<List<Integer>>> x);
+ void setInteger1d1dList(List<Integer[]> x);
+ void setInteger1d2dList(List<Integer[][]> x);
+ void setInteger1d3dList(List<Integer[][][]> x);
+ void setInt1d1dList(List<int[]> x);
+ void setInt1d2dList(List<int[][]> x);
+ void setInt1d3dList(List<int[][][]> x);
void setStringList(List<String> x);
void setBean(Bean x);
void setBeanArray(Bean[] x);
@@ -70,7 +100,7 @@ public interface InterfaceProxy {
return this;
}
}
-
+
@SuppressWarnings("serial")
public static class InterfaceProxyException1 extends Throwable {
public InterfaceProxyException1(String msg) {
@@ -79,6 +109,6 @@ public interface InterfaceProxy {
}
@SuppressWarnings("serial")
- public static class InterfaceProxyException2 extends Throwable {
+ public static class InterfaceProxyException2 extends Throwable {
}
}