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 2022/06/11 19:12:41 UTC
[juneau] branch master updated: Rename pojotools to objecttools.
This is an automated email from the ASF dual-hosted git repository.
jamesbognar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/juneau.git
The following commit(s) were added to refs/heads/master by this push:
new 742d471df Rename pojotools to objecttools.
742d471df is described below
commit 742d471df3b2ade627def0f010839742a7f84fa8
Author: JamesBognar <ja...@salesforce.com>
AuthorDate: Sat Jun 11 15:08:53 2022 -0400
Rename pojotools to objecttools.
---
.../org/apache/juneau/dto/swagger/Swagger.java | 4 +-
.../org/apache/juneau/collections/JsonList.java | 38 ++--
.../org/apache/juneau/collections/JsonMap.java | 42 ++--
.../AbstractMatcher.java} | 8 +-
.../{pojotools => objecttools}/Equality.java | 4 +-
.../{pojotools => objecttools}/MatcherFactory.java | 8 +-
.../NumberMatcherFactory.java | 10 +-
.../juneau/objecttools/ObjectIntrospector.java | 243 +++++++++++++++++++++
.../ObjectMerger.java} | 20 +-
.../ObjectPaginator.java} | 24 +-
.../PojoRest.java => objecttools/ObjectRest.java} | 97 +++++---
.../ObjectRestException.java} | 10 +-
.../ObjectSearcher.java} | 55 +++--
.../ObjectSorter.java} | 30 ++-
.../PojoTool.java => objecttools/ObjectTool.java} | 6 +-
.../ObjectViewer.java} | 30 ++-
.../{pojotools => objecttools}/PageArgs.java | 4 +-
.../PatternException.java | 4 +-
.../{pojotools => objecttools}/SearchArgs.java | 6 +-
.../{pojotools => objecttools}/SortArgs.java | 6 +-
.../StringMatcherFactory.java | 8 +-
.../TimeMatcherFactory.java | 8 +-
.../{pojotools => objecttools}/ViewArgs.java | 6 +-
.../{pojotools => objecttools}/package-info.java | 4 +-
.../main/java/org/apache/juneau/parser/Parser.java | 3 +-
.../org/apache/juneau/parser/ParserSession.java | 4 +-
.../org/apache/juneau/utils/PojoIntrospector.java | 143 ------------
.../java/org/apache/juneau/utils/PojoQuery.java | 5 +
juneau-doc/docs/ReleaseNotes/5.0.0.00.html | 2 +-
juneau-doc/docs/ReleaseNotes/5.1.0.14.html | 2 +-
juneau-doc/docs/ReleaseNotes/5.2.0.0.html | 30 +--
juneau-doc/docs/ReleaseNotes/6.4.0.html | 14 +-
...25.jm.PojoTools.html => 25.jm.ObjectTools.html} | 4 +-
.../apache/juneau/rest/client/ResponseBody.java | 19 +-
.../org/apache/juneau/rest/client/RestClient.java | 5 +-
.../juneau/rest/converter/Introspectable.java | 8 +-
.../apache/juneau/rest/converter/Traversable.java | 12 +-
.../org/apache/juneau/rest/vars/SwaggerVar.java | 4 +-
.../test/java/org/apache/juneau/BeanMapTest.java | 4 +-
.../test/java/org/apache/juneau/JsonMapTest.java | 6 +-
.../ObjectIntrospectorTest.java} | 20 +-
.../ObjectMergerTest.java} | 14 +-
.../ObjectRestTest.java} | 36 +--
.../ObjectSearcherTest.java} | 6 +-
.../ObjectSorterTest.java} | 6 +-
.../ObjectViewerTest.java} | 6 +-
.../rest/client/RestClient_Response_Body_Test.java | 6 +-
47 files changed, 626 insertions(+), 408 deletions(-)
diff --git a/juneau-core/juneau-dto/src/main/java/org/apache/juneau/dto/swagger/Swagger.java b/juneau-core/juneau-dto/src/main/java/org/apache/juneau/dto/swagger/Swagger.java
index 2b08aa53b..14e127795 100644
--- a/juneau-core/juneau-dto/src/main/java/org/apache/juneau/dto/swagger/Swagger.java
+++ b/juneau-core/juneau-dto/src/main/java/org/apache/juneau/dto/swagger/Swagger.java
@@ -26,7 +26,7 @@ import org.apache.juneau.collections.*;
import org.apache.juneau.http.header.*;
import org.apache.juneau.internal.*;
import org.apache.juneau.json.*;
-import org.apache.juneau.utils.*;
+import org.apache.juneau.objecttools.*;
/**
* This is the root document object for the API specification.
@@ -1756,7 +1756,7 @@ public class Swagger extends SwaggerElement {
if (! ref.startsWith("#/"))
throw runtimeException("Unsupported reference: ''{0}''", ref);
try {
- return new PojoRest(this).get(ref.substring(1), c);
+ return new ObjectRest(this).get(ref.substring(1), c);
} catch (Exception e) {
throw new BeanRuntimeException(e, c, "Reference ''{0}'' could not be converted to type ''{1}''.", ref, className(c));
}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/collections/JsonList.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/collections/JsonList.java
index ec6b07358..4e374bd96 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/collections/JsonList.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/collections/JsonList.java
@@ -23,9 +23,9 @@ import java.util.function.*;
import org.apache.juneau.*;
import org.apache.juneau.json.*;
+import org.apache.juneau.objecttools.*;
import org.apache.juneau.parser.*;
import org.apache.juneau.serializer.*;
-import org.apache.juneau.utils.*;
/**
* Java implementation of a JSON array.
@@ -110,7 +110,7 @@ public class JsonList extends LinkedList<Object> {
private static final long serialVersionUID = 1L;
transient BeanSession session = null;
- private transient PojoRest pojoRest;
+ private transient ObjectRest objectRest;
/**
* An empty read-only JsonList.
@@ -680,8 +680,8 @@ public class JsonList extends LinkedList<Object> {
* </p>
*
* <p>
- * This method uses the {@link PojoRest} class to perform the lookup, so the map can contain any of the various
- * class types that the {@link PojoRest} class supports (e.g. beans, collections, arrays).
+ * This method uses the {@link ObjectRest} class to perform the lookup, so the map can contain any of the various
+ * class types that the {@link ObjectRest} class supports (e.g. beans, collections, arrays).
*
* @param path The path to the entry.
* @param type The class type.
@@ -690,7 +690,7 @@ public class JsonList extends LinkedList<Object> {
* @return The value, or <jk>null</jk> if the entry doesn't exist.
*/
public <T> T getAt(String path, Class<T> type) {
- return getPojoRest().get(path, type);
+ return getObjectRest().get(path, type);
}
/**
@@ -704,7 +704,7 @@ public class JsonList extends LinkedList<Object> {
* @return The value, or <jk>null</jk> if the entry doesn't exist.
*/
public <T> T getAt(String path, Type type, Type...args) {
- return getPojoRest().get(path, type, args);
+ return getObjectRest().get(path, type, args);
}
/**
@@ -725,15 +725,15 @@ public class JsonList extends LinkedList<Object> {
* </p>
*
* <p>
- * This method uses the {@link PojoRest} class to perform the lookup, so the map can contain any of the various
- * class types that the {@link PojoRest} class supports (e.g. beans, collections, arrays).
+ * This method uses the {@link ObjectRest} class to perform the lookup, so the map can contain any of the various
+ * class types that the {@link ObjectRest} class supports (e.g. beans, collections, arrays).
*
* @param path The path to the entry.
* @param o The new value.
* @return The previous value, or <jk>null</jk> if the entry doesn't exist.
*/
public Object putAt(String path, Object o) {
- return getPojoRest().put(path, o);
+ return getObjectRest().put(path, o);
}
/**
@@ -753,15 +753,15 @@ public class JsonList extends LinkedList<Object> {
* </p>
*
* <p>
- * This method uses the {@link PojoRest} class to perform the lookup, so the map can contain any of the various
- * class types that the {@link PojoRest} class supports (e.g. beans, collections, arrays).
+ * This method uses the {@link ObjectRest} class to perform the lookup, so the map can contain any of the various
+ * class types that the {@link ObjectRest} class supports (e.g. beans, collections, arrays).
*
* @param path The path to the entry.
* @param o The new value.
* @return The previous value, or <jk>null</jk> if the entry doesn't exist.
*/
public Object postAt(String path, Object o) {
- return getPojoRest().post(path, o);
+ return getObjectRest().post(path, o);
}
/**
@@ -782,14 +782,14 @@ public class JsonList extends LinkedList<Object> {
* </p>
*
* <p>
- * This method uses the {@link PojoRest} class to perform the lookup, so the map can contain any of the various
- * class types that the {@link PojoRest} class supports (e.g. beans, collections, arrays).
+ * This method uses the {@link ObjectRest} class to perform the lookup, so the map can contain any of the various
+ * class types that the {@link ObjectRest} class supports (e.g. beans, collections, arrays).
*
* @param path The path to the entry.
* @return The previous value, or <jk>null</jk> if the entry doesn't exist.
*/
public Object deleteAt(String path) {
- return getPojoRest().delete(path);
+ return getObjectRest().delete(path);
}
//------------------------------------------------------------------------------------------------------------------
@@ -984,10 +984,10 @@ public class JsonList extends LinkedList<Object> {
p.parseIntoCollection(r, this, bs().object());
}
- private PojoRest getPojoRest() {
- if (pojoRest == null)
- pojoRest = new PojoRest(this);
- return pojoRest;
+ private ObjectRest getObjectRest() {
+ if (objectRest == null)
+ objectRest = new ObjectRest(this);
+ return objectRest;
}
BeanSession bs() {
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/collections/JsonMap.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/collections/JsonMap.java
index c83d1721b..9cd46d3c3 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/collections/JsonMap.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/collections/JsonMap.java
@@ -25,10 +25,10 @@ import java.util.function.*;
import org.apache.juneau.*;
import org.apache.juneau.internal.*;
import org.apache.juneau.json.*;
+import org.apache.juneau.objecttools.*;
import org.apache.juneau.parser.*;
import org.apache.juneau.serializer.*;
import org.apache.juneau.swap.*;
-import org.apache.juneau.utils.*;
/**
* Java implementation of a JSON object.
@@ -272,7 +272,7 @@ public class JsonMap extends LinkedHashMap<String,Object> {
private transient BeanSession session;
private Map<String,Object> inner;
- private transient PojoRest pojoRest;
+ private transient ObjectRest objectRest;
private transient Predicate<Object> valueFilter = x -> true;
/**
@@ -1424,8 +1424,8 @@ public class JsonMap extends LinkedHashMap<String,Object> {
* </p>
*
* <p>
- * This method uses the {@link PojoRest} class to perform the lookup, so the map can contain any of the various
- * class types that the {@link PojoRest} class supports (e.g. beans, collections, arrays).
+ * This method uses the {@link ObjectRest} class to perform the lookup, so the map can contain any of the various
+ * class types that the {@link ObjectRest} class supports (e.g. beans, collections, arrays).
*
* @param path The path to the entry.
* @param type The class type.
@@ -1434,15 +1434,15 @@ public class JsonMap extends LinkedHashMap<String,Object> {
* @return The value, or <jk>null</jk> if the entry doesn't exist.
*/
public <T> T getAt(String path, Class<T> type) {
- return getPojoRest().get(path, type);
+ return getObjectRest().get(path, type);
}
/**
* Same as {@link #getAt(String,Class)}, but allows for conversion to complex maps and collections.
*
* <p>
- * This method uses the {@link PojoRest} class to perform the lookup, so the map can contain any of the various
- * class types that the {@link PojoRest} class supports (e.g. beans, collections, arrays).
+ * This method uses the {@link ObjectRest} class to perform the lookup, so the map can contain any of the various
+ * class types that the {@link ObjectRest} class supports (e.g. beans, collections, arrays).
*
* @param path The path to the entry.
* @param type The class type.
@@ -1452,7 +1452,7 @@ public class JsonMap extends LinkedHashMap<String,Object> {
* @return The value, or <jk>null</jk> if the entry doesn't exist.
*/
public <T> T getAt(String path, Type type, Type...args) {
- return getPojoRest().get(path, type, args);
+ return getObjectRest().get(path, type, args);
}
/**
@@ -1473,15 +1473,15 @@ public class JsonMap extends LinkedHashMap<String,Object> {
* </p>
*
* <p>
- * This method uses the {@link PojoRest} class to perform the lookup, so the map can contain any of the various
- * class types that the {@link PojoRest} class supports (e.g. beans, collections, arrays).
+ * This method uses the {@link ObjectRest} class to perform the lookup, so the map can contain any of the various
+ * class types that the {@link ObjectRest} class supports (e.g. beans, collections, arrays).
*
* @param path The path to the entry.
* @param o The new value.
* @return The previous value, or <jk>null</jk> if the entry doesn't exist.
*/
public Object putAt(String path, Object o) {
- return getPojoRest().put(path, o);
+ return getObjectRest().put(path, o);
}
/**
@@ -1501,15 +1501,15 @@ public class JsonMap extends LinkedHashMap<String,Object> {
* </p>
*
* <p>
- * This method uses the {@link PojoRest} class to perform the lookup, so the map can contain any of the various
- * class types that the {@link PojoRest} class supports (e.g. beans, collections, arrays).
+ * This method uses the {@link ObjectRest} class to perform the lookup, so the map can contain any of the various
+ * class types that the {@link ObjectRest} class supports (e.g. beans, collections, arrays).
*
* @param path The path to the entry.
* @param o The new value.
* @return The previous value, or <jk>null</jk> if the entry doesn't exist.
*/
public Object postAt(String path, Object o) {
- return getPojoRest().post(path, o);
+ return getObjectRest().post(path, o);
}
/**
@@ -1530,14 +1530,14 @@ public class JsonMap extends LinkedHashMap<String,Object> {
* </p>
*
* <p>
- * This method uses the {@link PojoRest} class to perform the lookup, so the map can contain any of the various
- * class types that the {@link PojoRest} class supports (e.g. beans, collections, arrays).
+ * This method uses the {@link ObjectRest} class to perform the lookup, so the map can contain any of the various
+ * class types that the {@link ObjectRest} class supports (e.g. beans, collections, arrays).
*
* @param path The path to the entry.
* @return The previous value, or <jk>null</jk> if the entry doesn't exist.
*/
public Object deleteAt(String path) {
- return getPojoRest().delete(path);
+ return getObjectRest().delete(path);
}
//------------------------------------------------------------------------------------------------------------------
@@ -1672,10 +1672,10 @@ public class JsonMap extends LinkedHashMap<String,Object> {
return session;
}
- private PojoRest getPojoRest() {
- if (pojoRest == null)
- pojoRest = new PojoRest(this);
- return pojoRest;
+ private ObjectRest getObjectRest() {
+ if (objectRest == null)
+ objectRest = new ObjectRest(this);
+ return objectRest;
}
/*
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/pojotools/Matcher.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/AbstractMatcher.java
similarity index 91%
rename from juneau-core/juneau-marshall/src/main/java/org/apache/juneau/pojotools/Matcher.java
rename to juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/AbstractMatcher.java
index 661791064..d0069195d 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/pojotools/Matcher.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/AbstractMatcher.java
@@ -10,19 +10,19 @@
// * "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.pojotools;
+package org.apache.juneau.objecttools;
import org.apache.juneau.*;
/**
- * Common interface for matchers used by the {@link PojoSearcher} class.
+ * Common interface for matchers used by the {@link ObjectSearcher} class.
*
* <ul class='seealso'>
- * <li class='link'>{@doc jm.PojoTools}
+ * <li class='link'>{@doc jm.ObjectTools}
* <li class='extlink'>{@source}
* </ul>
*/
-public abstract class Matcher {
+public abstract class AbstractMatcher {
/**
* Returns <jk>true</jk> if this matcher matches the specified object..
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/pojotools/Equality.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/Equality.java
similarity index 95%
rename from juneau-core/juneau-marshall/src/main/java/org/apache/juneau/pojotools/Equality.java
rename to juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/Equality.java
index 2d218e08c..90351e1da 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/pojotools/Equality.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/Equality.java
@@ -10,13 +10,13 @@
// * "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.pojotools;
+package org.apache.juneau.objecttools;
/**
* Represents possible values for number and date comparisons.
*
* <ul class='seealso'>
- * <li class='link'>{@doc jm.PojoTools}
+ * <li class='link'>{@doc jm.ObjectTools}
* <li class='extlink'>{@source}
* </ul>
*/
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/pojotools/MatcherFactory.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/MatcherFactory.java
similarity index 90%
rename from juneau-core/juneau-marshall/src/main/java/org/apache/juneau/pojotools/MatcherFactory.java
rename to juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/MatcherFactory.java
index 473b8fc51..370d7a2c8 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/pojotools/MatcherFactory.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/MatcherFactory.java
@@ -10,15 +10,15 @@
// * "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.pojotools;
+package org.apache.juneau.objecttools;
import org.apache.juneau.*;
/**
- * Common interface for matchers used by the {@link PojoSearcher} class.
+ * Common interface for matchers used by the {@link ObjectSearcher} class.
*
* <ul class='seealso'>
- * <li class='link'>{@doc jm.PojoTools}
+ * <li class='link'>{@doc jm.ObjectTools}
* <li class='extlink'>{@source}
* </ul>
*/
@@ -38,5 +38,5 @@ public abstract class MatcherFactory {
* @param pattern The pattern string.
* @return A matcher for the specified pattern.
*/
- public abstract Matcher create(String pattern);
+ public abstract AbstractMatcher create(String pattern);
}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/pojotools/NumberMatcherFactory.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/NumberMatcherFactory.java
similarity index 97%
rename from juneau-core/juneau-marshall/src/main/java/org/apache/juneau/pojotools/NumberMatcherFactory.java
rename to juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/NumberMatcherFactory.java
index c73a8d158..9b8b12cf9 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/pojotools/NumberMatcherFactory.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/NumberMatcherFactory.java
@@ -10,7 +10,7 @@
// * "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.pojotools;
+package org.apache.juneau.objecttools;
import static org.apache.juneau.internal.StateMachineState.*;
@@ -20,10 +20,10 @@ import org.apache.juneau.*;
import org.apache.juneau.internal.*;
/**
- * Number matcher used by {@link PojoSearcher}
+ * Number matcher used by {@link ObjectSearcher}
*
* <ul class='seealso'>
- * <li class='link'>{@doc jm.PojoTools}
+ * <li class='link'>{@doc jm.ObjectTools}
* <li class='extlink'>{@source}
* </ul>
*/
@@ -40,14 +40,14 @@ public class NumberMatcherFactory extends MatcherFactory {
}
@Override
- public Matcher create(String pattern) {
+ public AbstractMatcher create(String pattern) {
return new NumberMatcher(pattern);
}
/**
* A construct representing a single search pattern.
*/
- private static class NumberMatcher extends Matcher {
+ private static class NumberMatcher extends AbstractMatcher {
NumberRange[] numberRanges;
String pattern;
private static final AsciiSet
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/ObjectIntrospector.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/ObjectIntrospector.java
new file mode 100644
index 000000000..e45421dbd
--- /dev/null
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/ObjectIntrospector.java
@@ -0,0 +1,243 @@
+// ***************************************************************************************************************************
+// * 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.objecttools;
+
+import java.io.*;
+import java.lang.reflect.*;
+
+import org.apache.juneau.json.*;
+import org.apache.juneau.parser.*;
+import org.apache.juneau.reflect.*;
+
+/**
+ * Used to invoke methods on {@code Objects} using arguments in serialized form.
+ *
+ * <h5 class='section'>Example:</h5>
+ * <p class='bjava'>
+ * String <jv>string1</jv> = <js>"foobar"</js>;
+ * String <jv>string2</jv> = ObjectIntrospector
+ * .create(<jv>string</jv>)
+ * .invoke(String.<jk>class</jk>, <js>"substring(int,int)"</js>, <js>"[3,6]"</js>); <jc>// "bar"</jc>
+ * </p>
+ *
+ * <ul class='seealso'>
+ * <li class='extlink'>{@source}
+ * </ul>
+ */
+public final class ObjectIntrospector {
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // Static
+ //-----------------------------------------------------------------------------------------------------------------
+
+ /**
+ * Static creator.
+ * @param o The object on which Java methods will be invoked.
+ * @return A new {@link ObjectIntrospector} object.
+ */
+ public static ObjectIntrospector create(Object o) {
+ return new ObjectIntrospector(o);
+ }
+
+ /**
+ * Static creator.
+ * @param o The object on which Java methods will be invoked.
+ * @param parser The parser to use to parse the method arguments.
+ * @return A new {@link ObjectIntrospector} object.
+ */
+ public static ObjectIntrospector create(Object o, ReaderParser parser) {
+ return new ObjectIntrospector(o, parser);
+ }
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // Instance
+ //-----------------------------------------------------------------------------------------------------------------
+
+ private final Object object;
+ private final ReaderParser parser;
+
+ /**
+ * Constructor.
+ *
+ * @param object The object on which Java methods will be invoked.
+ * @param parser The parser to use to parse the method arguments.
+ * If <jk>null</jk>, {@link JsonParser#DEFAULT} is used.
+ */
+ public ObjectIntrospector(Object object, ReaderParser parser) {
+ if (parser == null)
+ parser = JsonParser.DEFAULT;
+ this.object = object;
+ this.parser = parser;
+ }
+
+ /**
+ * Shortcut for calling <code><jk>new</jk> ObjectIntrospector(o, <jk>null</jk>);</code>
+ *
+ * @param o The object on which Java methods will be invoked.
+ */
+ public ObjectIntrospector(Object o) {
+ this(o, null);
+ }
+
+ /**
+ * Primary method.
+ *
+ * <p>
+ * Invokes the specified method on this bean.
+ *
+ * @param method The method being invoked.
+ * @param args
+ * The arguments to pass as parameters to the method.
+ * These will automatically be converted to the appropriate object type if possible.
+ * Can be <jk>null</jk> if method has no arguments.
+ * @return The object returned by the call to the method, or <jk>null</jk> if target object is <jk>null</jk>.
+ * @throws IllegalAccessException
+ * If the <c>Constructor</c> object enforces Java language access control and the underlying constructor is
+ * inaccessible.
+ * @throws IllegalArgumentException
+ * If one of the following occurs:
+ * <ul class='spaced-list'>
+ * <li>
+ * The number of actual and formal parameters differ.
+ * <li>
+ * An unwrapping conversion for primitive arguments fails.
+ * <li>
+ * A parameter value cannot be converted to the corresponding formal parameter type by a method invocation
+ * conversion.
+ * <li>
+ * The constructor pertains to an enum type.
+ * </ul>
+ * @throws InvocationTargetException If the underlying constructor throws an exception.
+ * @throws ParseException Malformed input encountered.
+ * @throws IOException Thrown by underlying stream.
+ */
+ public Object invokeMethod(Method method, Reader args) throws InvocationTargetException, IllegalArgumentException, IllegalAccessException, ParseException, IOException {
+ if (object == null)
+ return null;
+ Object[] params = args == null ? null : parser.parseArgs(args, method.getGenericParameterTypes());
+ return method.invoke(object, params);
+ }
+
+ /**
+ * Primary method.
+ *
+ * <p>
+ * Invokes the specified method on this bean.
+ *
+ * @param <T> The return type of the method call.
+ * @param returnType The return type of the method call.
+ * @param method The method being invoked.
+ * @param args
+ * The arguments to pass as parameters to the method.
+ * These will automatically be converted to the appropriate object type if possible.
+ * Can be <jk>null</jk> if method has no arguments.
+ * @return The object returned by the call to the method, or <jk>null</jk> if target object is <jk>null</jk>.
+ * @throws IllegalAccessException
+ * If the <c>Constructor</c> object enforces Java language access control and the underlying constructor is
+ * inaccessible.
+ * @throws IllegalArgumentException
+ * If one of the following occurs:
+ * <ul class='spaced-list'>
+ * <li>
+ * The number of actual and formal parameters differ.
+ * <li>
+ * An unwrapping conversion for primitive arguments fails.
+ * <li>
+ * A parameter value cannot be converted to the corresponding formal parameter type by a method invocation
+ * conversion.
+ * <li>
+ * The constructor pertains to an enum type.
+ * </ul>
+ * @throws InvocationTargetException If the underlying constructor throws an exception.
+ * @throws ParseException Malformed input encountered.
+ * @throws IOException Thrown by underlying stream.
+ */
+ public <T> T invokeMethod(Class<T> returnType, Method method, Reader args) throws InvocationTargetException, IllegalArgumentException, IllegalAccessException, ParseException, IOException {
+ return returnType.cast(invokeMethod(method, args));
+ }
+
+ /**
+ * Convenience method for invoking argument from method signature (@see {@link MethodInfo#getSignature()}.
+ *
+ * @param method The method being invoked.
+ * @param args
+ * The arguments to pass as parameters to the method.
+ * These will automatically be converted to the appropriate object type if possible.
+ * Can be <jk>null</jk> if method has no arguments.
+ * @return The object returned by the call to the method, or <jk>null</jk> if target object is <jk>null</jk>.
+ * @throws NoSuchMethodException If method does not exist.
+ * @throws IllegalAccessException
+ * If the <c>Constructor</c> object enforces Java language access control and
+ * the underlying constructor is inaccessible.
+ * @throws IllegalArgumentException
+ * If one of the following occurs:
+ * <ul class='spaced-list'>
+ * <li>
+ * The number of actual and formal parameters differ.
+ * <li>
+ * An unwrapping conversion for primitive arguments fails.
+ * <li>
+ * A parameter value cannot be converted to the corresponding formal parameter type by a method invocation
+ * conversion.
+ * <li>
+ * The constructor pertains to an enum type.
+ * </ul>
+ * @throws InvocationTargetException If the underlying constructor throws an exception.
+ * @throws ParseException Malformed input encountered.
+ * @throws IOException Thrown by underlying stream.
+ */
+ public Object invokeMethod(String method, String args) throws NoSuchMethodException, IllegalArgumentException, InvocationTargetException, IllegalAccessException, ParseException, IOException {
+ if (object == null)
+ return null;
+ Method m = parser.getBeanContext().getClassMeta(object.getClass()).getPublicMethods().get(method);
+ if (m == null)
+ throw new NoSuchMethodException(method);
+ return invokeMethod(m, args == null ? null : new StringReader(args));
+ }
+
+ /**
+ * Convenience method for invoking argument from method signature (@see {@link MethodInfo#getSignature()}.
+ *
+ * @param <T> The return type of the method call.
+ * @param returnType The return type of the method call.
+ * @param method The method being invoked.
+ * @param args
+ * The arguments to pass as parameters to the method.
+ * These will automatically be converted to the appropriate object type if possible.
+ * Can be <jk>null</jk> if method has no arguments.
+ * @return The object returned by the call to the method, or <jk>null</jk> if target object is <jk>null</jk>.
+ * @throws NoSuchMethodException If method does not exist.
+ * @throws IllegalAccessException
+ * If the <c>Constructor</c> object enforces Java language access control and
+ * the underlying constructor is inaccessible.
+ * @throws IllegalArgumentException
+ * If one of the following occurs:
+ * <ul class='spaced-list'>
+ * <li>
+ * The number of actual and formal parameters differ.
+ * <li>
+ * An unwrapping conversion for primitive arguments fails.
+ * <li>
+ * A parameter value cannot be converted to the corresponding formal parameter type by a method invocation
+ * conversion.
+ * <li>
+ * The constructor pertains to an enum type.
+ * </ul>
+ * @throws InvocationTargetException If the underlying constructor throws an exception.
+ * @throws ParseException Malformed input encountered.
+ * @throws IOException Thrown by underlying stream.
+ */
+ public <T> T invokeMethod(Class<T> returnType, String method, String args) throws NoSuchMethodException, IllegalArgumentException, InvocationTargetException, IllegalAccessException, ParseException, IOException {
+ return returnType.cast(invokeMethod(method, args));
+ }
+}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/PojoMerge.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/ObjectMerger.java
similarity index 86%
rename from juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/PojoMerge.java
rename to juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/ObjectMerger.java
index 45d5ea61e..3a2dc9913 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/PojoMerge.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/ObjectMerger.java
@@ -10,7 +10,7 @@
// * "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;
+package org.apache.juneau.objecttools;
import java.lang.reflect.*;
@@ -52,15 +52,13 @@ import org.apache.juneau.ExecutableException;
* The getters will be called in order until the first non-null value is returned...
*
* <p class='bjava'>
- * PojoMerge <jv>merge</jv>;
- *
- * <jv>merge</jv> = PojoMerge.<jsm>merge</jsm>(IA.<jk>class</jk>, <jk>new</jk> A(<js>"1"</js>), <jk>new</jk> A(<js>"2"</js>));
+ * <jv>merge</jv> = ObjectMerger.<jsm>merger</jsm>(IA.<jk>class</jk>, <jk>new</jk> A(<js>"1"</js>), <jk>new</jk> A(<js>"2"</js>));
* <jsm>assertEquals</jsm>(<js>"1"</js>, <jv>merge</jv>.getX());
*
- * <jv>merge</jv> = PojoMerge.<jsm>merge</jsm>(IA.<jk>class</jk>, <jk>new</jk> A(<jk>null</jk>), <jk>new</jk> A(<js>"2"</js>));
+ * <jv>merge</jv> = ObjectMerger.<jsm>merger</jsm>(IA.<jk>class</jk>, <jk>new</jk> A(<jk>null</jk>), <jk>new</jk> A(<js>"2"</js>));
* <jsm>assertEquals</jsm>(<js>"2"</js>, <jv>merge</jv>.getX());
*
- * <jv>merge</jv> = PojoMerge.<jsm>merge</jsm>(IA.<jk>class</jk>, <jk>new</jk> A(<jk>null</jk>), <jk>new</jk> A(<jk>null</jk>));
+ * <jv>merge</jv> = ObjectMerger.<jsm>merger</jsm>(IA.<jk>class</jk>, <jk>new</jk> A(<jk>null</jk>), <jk>new</jk> A(<jk>null</jk>));
* <jsm>assertEquals</jsm>(<jk>null</jk>, <jv>merge</jv>.getX());
* </p>
*
@@ -78,7 +76,7 @@ import org.apache.juneau.ExecutableException;
* <li class='extlink'>{@source}
* </ul>
*/
-public class PojoMerge {
+public class ObjectMerger {
/**
* Create a proxy interface on top of zero or more POJOs.
@@ -113,21 +111,21 @@ public class PojoMerge {
*/
@SuppressWarnings("unchecked")
public static <T> T merge(Class<T> interfaceClass, boolean callAllNonGetters, T...pojos) {
- return (T)Proxy.newProxyInstance(interfaceClass.getClassLoader(), new Class[] { interfaceClass }, new PojoMergeInvocationHandler(callAllNonGetters, pojos));
+ return (T)Proxy.newProxyInstance(interfaceClass.getClassLoader(), new Class[] { interfaceClass }, new MergeInvocationHandler(callAllNonGetters, pojos));
}
- private static class PojoMergeInvocationHandler implements InvocationHandler {
+ private static class MergeInvocationHandler implements InvocationHandler {
private final Object[] pojos;
private final boolean callAllNonGetters;
- public PojoMergeInvocationHandler(boolean callAllNonGetters, Object...pojos) {
+ public MergeInvocationHandler(boolean callAllNonGetters, Object...pojos) {
this.callAllNonGetters = callAllNonGetters;
this.pojos = pojos;
}
/**
* Implemented to handle the method called.
- * @throws ExecutableException Exception occurred on invoked constructor/method/field.
+ * @throws ExecutableException Exception occurred on invoked constructor/method/field.
*/
@Override /* InvocationHandler */
public Object invoke(Object proxy, Method method, Object[] args) throws ExecutableException {
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/pojotools/PojoPaginator.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/ObjectPaginator.java
similarity index 78%
rename from juneau-core/juneau-marshall/src/main/java/org/apache/juneau/pojotools/PojoPaginator.java
rename to juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/ObjectPaginator.java
index 06e256f20..3424e94a6 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/pojotools/PojoPaginator.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/ObjectPaginator.java
@@ -10,7 +10,7 @@
// * "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.pojotools;
+package org.apache.juneau.objecttools;
import org.apache.juneau.*;
@@ -21,13 +21,29 @@ import org.apache.juneau.*;
* Allows you to quickly return subsets of arrays and collections based on position/limit arguments.
*
* <ul class='seealso'>
- * <li class='link'>{@doc jm.PojoTools}
+ * <li class='link'>{@doc jm.ObjectTools}
* <li class='extlink'>{@source}
* </ul>
*/
-public final class PojoPaginator implements PojoTool<Object> {
+public final class ObjectPaginator implements ObjectTool<Object> {
- @Override /* PojoTool */
+ //-----------------------------------------------------------------------------------------------------------------
+ // Static
+ //-----------------------------------------------------------------------------------------------------------------
+
+ /**
+ * Static creator.
+ * @return A new {@link ObjectPaginator} object.
+ */
+ public static ObjectPaginator create() {
+ return new ObjectPaginator();
+ }
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // Instance
+ //-----------------------------------------------------------------------------------------------------------------
+
+ @Override /* ObjectTool */
public Object run(BeanSession session, Object input, Object args) {
// if (input == null)
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/PojoRest.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/ObjectRest.java
similarity index 85%
rename from juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/PojoRest.java
rename to juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/ObjectRest.java
index 2baf89b92..ebbd8140f 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/PojoRest.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/ObjectRest.java
@@ -10,7 +10,7 @@
// * "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;
+package org.apache.juneau.objecttools;
import static java.net.HttpURLConnection.*;
@@ -76,8 +76,8 @@ import org.apache.juneau.parser.*;
* + <js>"} "</js>
* );
*
- * <jc>// Wrap Map inside a PojoRest object</jc>
- * PojoRest <jv>johnSmith</jv> = <jk>new</jk> PojoRest(<jv>map</jv>);
+ * <jc>// Wrap Map inside an ObjectRest object</jc>
+ * ObjectRest <jv>johnSmith</jv> = ObjectRest.<jsf>create</jsf>(<jv>map</jv>);
*
* <jc>// Get a simple value at the top level</jc>
* <jc>// "John Smith"</jc>
@@ -122,7 +122,7 @@ import org.apache.juneau.parser.*;
* <h5 class='section'>Example:</h5>
* <p class='bjava'>
* <jc>// Get map/bean with name attribute value of 'foo' from a list of items</jc>
- * Map <jv>map</jv> = <jv>pojoRest</jv>.getMap(<js>"/items/@name=foo"</js>);
+ * Map <jv>map</jv> = <jv>objectRest</jv>.getMap(<js>"/items/@name=foo"</js>);
* </p>
*
* <ul class='seealso'>
@@ -130,11 +130,38 @@ import org.apache.juneau.parser.*;
* </ul>
*/
@SuppressWarnings({"unchecked","rawtypes"})
-public final class PojoRest {
+public final class ObjectRest {
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // Static
+ //-----------------------------------------------------------------------------------------------------------------
/** The list of possible request types. */
private static final int GET=1, PUT=2, POST=3, DELETE=4;
+ /**
+ * Static creator.
+ * @param o The object being wrapped.
+ * @return A new {@link ObjectRest} object.
+ */
+ public static ObjectRest create(Object o) {
+ return new ObjectRest(o);
+ }
+
+ /**
+ * Static creator.
+ * @param o The object being wrapped.
+ * @param parser The parser to use for parsing arguments and converting objects to the correct data type.
+ * @return A new {@link ObjectRest} object.
+ */
+ public static ObjectRest create(Object o, ReaderParser parser) {
+ return new ObjectRest(o, parser);
+ }
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // Instance
+ //-----------------------------------------------------------------------------------------------------------------
+
private ReaderParser parser = JsonParser.DEFAULT;
final BeanSession session;
@@ -152,7 +179,7 @@ public final class PojoRest {
*
* @param o The object to be wrapped.
*/
- public PojoRest(Object o) {
+ public ObjectRest(Object o) {
this(o, null);
}
@@ -165,7 +192,7 @@ public final class PojoRest {
* @param o The object to be wrapped.
* @param parser The parser to use for parsing arguments and converting objects to the correct data type.
*/
- public PojoRest(Object o, ReaderParser parser) {
+ public ObjectRest(Object o, ReaderParser parser) {
this.session = parser == null ? BeanContext.DEFAULT_SESSION : parser.getBeanContext().getSession();
if (parser == null)
parser = JsonParser.DEFAULT;
@@ -178,7 +205,7 @@ public final class PojoRest {
*
* @return This object.
*/
- public PojoRest setRootLocked() {
+ public ObjectRest setRootLocked() {
this.rootLocked = true;
return this;
}
@@ -226,22 +253,22 @@ public final class PojoRest {
*
* <h5 class='section'>Examples:</h5>
* <p class='bjava'>
- * PojoRest <jv>pojoRest</jv> = <jk>new</jk> PojoRest(<jv>object</jv>);
+ * ObjectRest <jv>objectRest</jv> = <jk>new</jk> ObjectRest(<jv>object</jv>);
*
* <jc>// Value converted to a string.</jc>
- * String <jv>string</jv> = <jv>pojoRest</jv>.get(<js>"path/to/string"</js>, String.<jk>class</jk>);
+ * String <jv>string</jv> = <jv>objectRest</jv>.get(<js>"path/to/string"</js>, String.<jk>class</jk>);
*
* <jc>// Value converted to a bean.</jc>
- * MyBean <jv>bean</jv> = <jv>pojoRest</jv>.get(<js>"path/to/bean"</js>, MyBean.<jk>class</jk>);
+ * MyBean <jv>bean</jv> = <jv>objectRest</jv>.get(<js>"path/to/bean"</js>, MyBean.<jk>class</jk>);
*
* <jc>// Value converted to a bean array.</jc>
- * MyBean[] <jv>beanArray</jv> = <jv>pojoRest</jv>.get(<js>"path/to/beanarray"</js>, MyBean[].<jk>class</jk>);
+ * MyBean[] <jv>beanArray</jv> = <jv>objectRest</jv>.get(<js>"path/to/beanarray"</js>, MyBean[].<jk>class</jk>);
*
* <jc>// Value converted to a linked-list of objects.</jc>
- * List <jv>list</jv> = <jv>pojoRest</jv>.get(<js>"path/to/list"</js>, LinkedList.<jk>class</jk>);
+ * List <jv>list</jv> = <jv>objectRest</jv>.get(<js>"path/to/list"</js>, LinkedList.<jk>class</jk>);
*
* <jc>// Value converted to a map of object keys/values.</jc>
- * Map <jv>map</jv> = <jv>pojoRest</jv>.get(<js>"path/to/map"</js>, TreeMap.<jk>class</jk>);
+ * Map <jv>map</jv> = <jv>objectRest</jv>.get(<js>"path/to/map"</js>, TreeMap.<jk>class</jk>);
* </p>
*
* @param url
@@ -267,22 +294,22 @@ public final class PojoRest {
*
* <h5 class='section'>Examples:</h5>
* <p class='bjava'>
- * PojoRest <jv>pojoRest</jv> = <jk>new</jk> PojoRest(<jv>object</jv>);
+ * ObjectRest <jv>objectRest</jv> = <jk>new</jk> ObjectRest(<jv>object</jv>);
*
* <jc>// Value converted to a linked-list of strings.</jc>
- * List<String> <jv>list1</jv> = <jv>pojoRest</jv>.get(<js>"path/to/list1"</js>, LinkedList.<jk>class</jk>, String.<jk>class</jk>);
+ * List<String> <jv>list1</jv> = <jv>objectRest</jv>.get(<js>"path/to/list1"</js>, LinkedList.<jk>class</jk>, String.<jk>class</jk>);
*
* <jc>// Value converted to a linked-list of beans.</jc>
- * List<MyBean> <jv>list2</jv> = <jv>pojoRest</jv>.get(<js>"path/to/list2"</js>, LinkedList.<jk>class</jk>, MyBean.<jk>class</jk>);
+ * List<MyBean> <jv>list2</jv> = <jv>objectRest</jv>.get(<js>"path/to/list2"</js>, LinkedList.<jk>class</jk>, MyBean.<jk>class</jk>);
*
* <jc>// Value converted to a linked-list of linked-lists of strings.</jc>
- * List<List<String>> <jv>list3</jv> = <jv>pojoRest</jv>.get(<js>"path/to/list3"</js>, LinkedList.<jk>class</jk>, LinkedList.<jk>class</jk>, String.<jk>class</jk>);
+ * List<List<String>> <jv>list3</jv> = <jv>objectRest</jv>.get(<js>"path/to/list3"</js>, LinkedList.<jk>class</jk>, LinkedList.<jk>class</jk>, String.<jk>class</jk>);
*
* <jc>// Value converted to a map of string keys/values.</jc>
- * Map<String,String> <jv>map1</jv> = <jv>pojoRest</jv>.get(<js>"path/to/map1"</js>, TreeMap.<jk>class</jk>, String.<jk>class</jk>, String.<jk>class</jk>);
+ * Map<String,String> <jv>map1</jv> = <jv>objectRest</jv>.get(<js>"path/to/map1"</js>, TreeMap.<jk>class</jk>, String.<jk>class</jk>, String.<jk>class</jk>);
*
* <jc>// Value converted to a map containing string keys and values of lists containing beans.</jc>
- * Map<String,List<MyBean>> <jv>map2</jv> = <jv>pojoRest</jv>.get(<js>"path/to/map2"</js>, TreeMap.<jk>class</jk>, String.<jk>class</jk>, List.<jk>class</jk>, MyBean.<jk>class</jk>);
+ * Map<String,List<MyBean>> <jv>map2</jv> = <jv>objectRest</jv>.get(<js>"path/to/map2"</js>, TreeMap.<jk>class</jk>, String.<jk>class</jk>, List.<jk>class</jk>, MyBean.<jk>class</jk>);
* </p>
*
* <p>
@@ -610,7 +637,7 @@ public final class PojoRest {
*/
public Object invokeMethod(String url, String method, String args) throws ExecutableException, ParseException, IOException {
try {
- return new PojoIntrospector(get(url), parser).invokeMethod(method, args);
+ return new ObjectIntrospector(get(url), parser).invokeMethod(method, args);
} catch (NoSuchMethodException | IllegalArgumentException | InvocationTargetException | IllegalAccessException e) {
throw new ExecutableException(e);
}
@@ -729,7 +756,7 @@ public final class PojoRest {
/*
* Workhorse method.
*/
- private Object service(int method, String url, Object val) throws PojoRestException {
+ private Object service(int method, String url, Object val) throws ObjectRestException {
url = normalizeUrl(url);
@@ -746,14 +773,14 @@ public final class PojoRest {
if (method == PUT) {
if (url.length() == 0) {
if (rootLocked)
- throw new PojoRestException(HTTP_FORBIDDEN, "Cannot overwrite root object");
+ throw new ObjectRestException(HTTP_FORBIDDEN, "Cannot overwrite root object");
Object o = root.o;
root = new JsonNode(null, null, val, session.object());
return o;
}
JsonNode n = (parentUrl == null ? root : getNode(parentUrl, root));
if (n == null)
- throw new PojoRestException(HTTP_NOT_FOUND, "Node at URL ''{0}'' not found.", parentUrl);
+ throw new ObjectRestException(HTTP_NOT_FOUND, "Node at URL ''{0}'' not found.", parentUrl);
ClassMeta cm = n.cm;
Object o = n.o;
if (cm.isMap())
@@ -773,11 +800,11 @@ public final class PojoRest {
m.put(n.keyName, o);
return url;
}
- throw new PojoRestException(HTTP_BAD_REQUEST, "Cannot perform PUT on ''{0}'' with parent node type ''{1}''", url, pct);
+ throw new ObjectRestException(HTTP_BAD_REQUEST, "Cannot perform PUT on ''{0}'' with parent node type ''{1}''", url, pct);
}
if (cm.isBean())
return session.toBeanMap(o).put(childKey, val);
- throw new PojoRestException(HTTP_BAD_REQUEST, "Cannot perform PUT on ''{0}'' whose parent is of type ''{1}''", url, cm);
+ throw new ObjectRestException(HTTP_BAD_REQUEST, "Cannot perform PUT on ''{0}'' whose parent is of type ''{1}''", url, cm);
}
if (method == POST) {
@@ -795,11 +822,11 @@ public final class PojoRest {
root = new JsonNode(null, null, o2, null);
return url + "/" + (o2.length-1);
}
- throw new PojoRestException(HTTP_BAD_REQUEST, "Cannot perform POST on ''{0}'' of type ''{1}''", url, cm);
+ throw new ObjectRestException(HTTP_BAD_REQUEST, "Cannot perform POST on ''{0}'' of type ''{1}''", url, cm);
}
JsonNode n = getNode(url, root);
if (n == null)
- throw new PojoRestException(HTTP_NOT_FOUND, "Node at URL ''{0}'' not found.", url);
+ throw new ObjectRestException(HTTP_NOT_FOUND, "Node at URL ''{0}'' not found.", url);
ClassMeta cm = n.cm;
Object o = n.o;
if (cm.isArray()) {
@@ -815,20 +842,20 @@ public final class PojoRest {
m.put(childKey, o2);
return url + "/" + (o2.length-1);
}
- throw new PojoRestException(HTTP_BAD_REQUEST, "Cannot perform POST on ''{0}'' with parent node type ''{1}''", url, pct);
+ throw new ObjectRestException(HTTP_BAD_REQUEST, "Cannot perform POST on ''{0}'' with parent node type ''{1}''", url, pct);
}
if (cm.isCollection()) {
Collection c = (Collection)o;
c.add(convert(val, cm.getElementType()));
return (c instanceof List ? url + "/" + (c.size()-1) : null);
}
- throw new PojoRestException(HTTP_BAD_REQUEST, "Cannot perform POST on ''{0}'' of type ''{1}''", url, cm);
+ throw new ObjectRestException(HTTP_BAD_REQUEST, "Cannot perform POST on ''{0}'' of type ''{1}''", url, cm);
}
if (method == DELETE) {
if (url.length() == 0) {
if (rootLocked)
- throw new PojoRestException(HTTP_FORBIDDEN, "Cannot overwrite root object");
+ throw new ObjectRestException(HTTP_FORBIDDEN, "Cannot overwrite root object");
Object o = root.o;
root = new JsonNode(null, null, null, session.object());
return o;
@@ -855,11 +882,11 @@ public final class PojoRest {
m.put(n.keyName, o2);
return old;
}
- throw new PojoRestException(HTTP_BAD_REQUEST, "Cannot perform POST on ''{0}'' with parent node type ''{1}''", url, pct);
+ throw new ObjectRestException(HTTP_BAD_REQUEST, "Cannot perform POST on ''{0}'' with parent node type ''{1}''", url, pct);
}
if (cm.isBean())
return session.toBeanMap(o).put(childKey, null);
- throw new PojoRestException(HTTP_BAD_REQUEST, "Cannot perform PUT on ''{0}'' whose parent is of type ''{1}''", url, cm);
+ throw new ObjectRestException(HTTP_BAD_REQUEST, "Cannot perform PUT on ''{0}'' whose parent is of type ''{1}''", url, cm);
}
return null; // Never gets here.
@@ -955,7 +982,7 @@ public final class PojoRest {
o2 = m.get(parentKey);
BeanPropertyMeta pMeta = m.getPropertyMeta(parentKey);
if (pMeta == null)
- throw new PojoRestException(HTTP_BAD_REQUEST,
+ throw new ObjectRestException(HTTP_BAD_REQUEST,
"Unknown property ''{0}'' encountered while trying to parse into class ''{1}''",
parentKey, m.getClassMeta()
);
@@ -980,7 +1007,7 @@ public final class PojoRest {
try {
return Integer.parseInt(key);
} catch (NumberFormatException e) {
- throw new PojoRestException(HTTP_BAD_REQUEST,
+ throw new ObjectRestException(HTTP_BAD_REQUEST,
"Cannot address an item in an array with a non-integer key ''{0}''", key
);
}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/PojoRestException.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/ObjectRestException.java
similarity index 87%
rename from juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/PojoRestException.java
rename to juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/ObjectRestException.java
index 6a7d4a963..771e704d3 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/PojoRestException.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/ObjectRestException.java
@@ -10,7 +10,7 @@
// * "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;
+package org.apache.juneau.objecttools;
import java.net.*;
import java.text.*;
@@ -18,7 +18,7 @@ import java.text.*;
import org.apache.juneau.*;
/**
- * Generic exception thrown from the {@link PojoRest} class.
+ * Generic exception thrown from the {@link ObjectRest} class.
*
* <p>
* Typically, this is a user-error, such as trying to address a non-existent node in the tree.
@@ -43,7 +43,7 @@ import org.apache.juneau.*;
*
* @serial exclude
*/
-public final class PojoRestException extends BasicRuntimeException {
+public final class ObjectRestException extends BasicRuntimeException {
private static final long serialVersionUID = 1L;
@@ -57,7 +57,7 @@ public final class PojoRestException extends BasicRuntimeException {
* @param message The {@link MessageFormat}-style message.
* @param args Optional {@link MessageFormat}-style arguments.
*/
- public PojoRestException(Throwable cause, int status, String message, Object... args) {
+ public ObjectRestException(Throwable cause, int status, String message, Object... args) {
super(cause, message, args);
this.status = status;
}
@@ -69,7 +69,7 @@ public final class PojoRestException extends BasicRuntimeException {
* @param message The detailed message.
* @param args Optional {@link MessageFormat}-style arguments.
*/
- public PojoRestException(int status, String message, Object...args) {
+ public ObjectRestException(int status, String message, Object...args) {
this(null, status, message, args);
}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/pojotools/PojoSearcher.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/ObjectSearcher.java
similarity index 73%
rename from juneau-core/juneau-marshall/src/main/java/org/apache/juneau/pojotools/PojoSearcher.java
rename to juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/ObjectSearcher.java
index ecc9df0ae..8943bdd86 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/pojotools/PojoSearcher.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/ObjectSearcher.java
@@ -10,7 +10,7 @@
// * "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.pojotools;
+package org.apache.juneau.objecttools;
import static org.apache.juneau.internal.CollectionUtils.*;
import static org.apache.juneau.internal.StringUtils.*;
@@ -27,37 +27,62 @@ import org.apache.juneau.*;
* Allows you to quickly return subsets of arrays and collections based on position/limit arguments.
*
* <ul class='seealso'>
- * <li class='link'>{@doc jm.PojoTools}
+ * <li class='link'>{@doc jm.ObjectTools}
* <li class='extlink'>{@source}
* </ul>
*/
@SuppressWarnings({"rawtypes"})
-public final class PojoSearcher implements PojoTool<SearchArgs> {
+public final class ObjectSearcher implements ObjectTool<SearchArgs> {
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // Static
+ //-----------------------------------------------------------------------------------------------------------------
/**
* Default reusable searcher.
*/
- public static final PojoSearcher DEFAULT = new PojoSearcher();
-
- final MatcherFactory[] factories;
+ public static final ObjectSearcher DEFAULT = new ObjectSearcher();
/**
- * Constructor.
+ * Static creator.
*
- * @param factories The matcher factories to use.
+ * @param factories
+ * The matcher factories to use.
+ * <br>If not specified, uses the following:
+ * <ul>
+ * <li>{@link NumberMatcherFactory#DEFAULT}
+ * <li>{@link TimeMatcherFactory#DEFAULT}
+ * <li>{@link StringMatcherFactory#DEFAULT}
+ * </ul>
+ * @return A new {@link ObjectSearcher} object.
*/
- public PojoSearcher(MatcherFactory...factories) {
- this.factories = factories;
+ public static ObjectSearcher create(MatcherFactory...factories) {
+ return new ObjectSearcher(factories);
}
+ //-----------------------------------------------------------------------------------------------------------------
+ // Instance
+ //-----------------------------------------------------------------------------------------------------------------
+
+ final MatcherFactory[] factories;
+
/**
* Constructor.
+ *
+ * @param factories
+ * The matcher factories to use.
+ * <br>If not specified, uses the following:
+ * <ul>
+ * <li>{@link NumberMatcherFactory#DEFAULT}
+ * <li>{@link TimeMatcherFactory#DEFAULT}
+ * <li>{@link StringMatcherFactory#DEFAULT}
+ * </ul>
*/
- public PojoSearcher() {
- this(NumberMatcherFactory.DEFAULT, TimeMatcherFactory.DEFAULT, StringMatcherFactory.DEFAULT);
+ public ObjectSearcher(MatcherFactory...factories) {
+ this.factories = factories.length == 0 ? new MatcherFactory[]{NumberMatcherFactory.DEFAULT, TimeMatcherFactory.DEFAULT, StringMatcherFactory.DEFAULT} : factories;
}
- @Override /* PojoTool */
+ @Override /* ObjectTool */
public Object run(BeanSession session, Object input, SearchArgs args) {
ClassMeta<?> type = session.getClassMetaForObject(input);
@@ -153,13 +178,13 @@ public final class PojoSearcher implements PojoTool<SearchArgs> {
private class ColumnMatcher {
String searchPattern;
- Matcher[] matchers;
+ AbstractMatcher[] matchers;
BeanSession bs;
ColumnMatcher(BeanSession bs, String searchPattern) {
this.bs = bs;
this.searchPattern = searchPattern;
- this.matchers = new Matcher[factories.length];
+ this.matchers = new AbstractMatcher[factories.length];
}
boolean matches(Object o) {
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/pojotools/PojoSorter.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/ObjectSorter.java
similarity index 78%
rename from juneau-core/juneau-marshall/src/main/java/org/apache/juneau/pojotools/PojoSorter.java
rename to juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/ObjectSorter.java
index ec346d08d..33e40e866 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/pojotools/PojoSorter.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/ObjectSorter.java
@@ -10,7 +10,7 @@
// * "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.pojotools;
+package org.apache.juneau.objecttools;
import static org.apache.juneau.internal.CollectionUtils.*;
@@ -24,14 +24,36 @@ import org.apache.juneau.internal.*;
* Sorts arrays and collections of maps and beans.
*
* <ul class='seealso'>
- * <li class='link'>{@doc jm.PojoTools}
+ * <li class='link'>{@doc jm.ObjectTools}
* <li class='extlink'>{@source}
* </ul>
*/
@SuppressWarnings({"unchecked","rawtypes"})
-public final class PojoSorter implements PojoTool<SortArgs> {
+public final class ObjectSorter implements ObjectTool<SortArgs> {
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // Static
+ //-----------------------------------------------------------------------------------------------------------------
+
+ /**
+ * Default reusable searcher.
+ */
+ public static final ObjectSorter DEFAULT = new ObjectSorter();
+
+ /**
+ * Static creator.
+ *
+ * @return A new {@link ObjectSorter} object.
+ */
+ public static ObjectSorter create() {
+ return new ObjectSorter();
+ }
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // Instance
+ //-----------------------------------------------------------------------------------------------------------------
- @Override /* PojoTool */
+ @Override /* ObjectTool */
public Object run(BeanSession session, Object input, SortArgs args) {
if (input == null)
return null;
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/pojotools/PojoTool.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/ObjectTool.java
similarity index 94%
rename from juneau-core/juneau-marshall/src/main/java/org/apache/juneau/pojotools/PojoTool.java
rename to juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/ObjectTool.java
index 0c6e66e81..e447fa62f 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/pojotools/PojoTool.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/ObjectTool.java
@@ -10,7 +10,7 @@
// * "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.pojotools;
+package org.apache.juneau.objecttools;
import org.apache.juneau.*;
@@ -18,13 +18,13 @@ import org.apache.juneau.*;
* Interface for classes that convert POJOs in some way using some predefined arguments object.
*
* <ul class='seealso'>
- * <li class='link'>{@doc jm.PojoTools}
+ * <li class='link'>{@doc jm.ObjectTools}
* <li class='extlink'>{@source}
* </ul>
*
* @param <T> The argument object type.
*/
-public interface PojoTool<T> {
+public interface ObjectTool<T> {
/**
* Converts the specified input to some other output.
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/pojotools/PojoViewer.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/ObjectViewer.java
similarity index 76%
rename from juneau-core/juneau-marshall/src/main/java/org/apache/juneau/pojotools/PojoViewer.java
rename to juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/ObjectViewer.java
index e8b150911..95d2c6969 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/pojotools/PojoViewer.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/ObjectViewer.java
@@ -10,7 +10,7 @@
// * "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.pojotools;
+package org.apache.juneau.objecttools;
import static org.apache.juneau.internal.CollectionUtils.*;
@@ -27,14 +27,36 @@ import org.apache.juneau.internal.*;
* Allows you to quickly return subsets of arrays and collections based on position/limit arguments.
*
* <ul class='seealso'>
- * <li class='link'>{@doc jm.PojoTools}
+ * <li class='link'>{@doc jm.ObjectTools}
* <li class='extlink'>{@source}
* </ul>
*/
@SuppressWarnings({"unchecked","rawtypes"})
-public final class PojoViewer implements PojoTool<ViewArgs> {
+public final class ObjectViewer implements ObjectTool<ViewArgs> {
- @Override /* PojoTool */
+ //-----------------------------------------------------------------------------------------------------------------
+ // Static
+ //-----------------------------------------------------------------------------------------------------------------
+
+ /**
+ * Default reusable searcher.
+ */
+ public static final ObjectViewer DEFAULT = new ObjectViewer();
+
+ /**
+ * Static creator.
+ *
+ * @return A new {@link ObjectViewer} object.
+ */
+ public static ObjectViewer create() {
+ return new ObjectViewer();
+ }
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // Instance
+ //-----------------------------------------------------------------------------------------------------------------
+
+ @Override /* ObjectTool */
public Object run(BeanSession session, Object input, ViewArgs args) {
if (input == null)
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/pojotools/PageArgs.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/PageArgs.java
similarity index 95%
rename from juneau-core/juneau-marshall/src/main/java/org/apache/juneau/pojotools/PageArgs.java
rename to juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/PageArgs.java
index 1acc68b70..47ad30827 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/pojotools/PageArgs.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/PageArgs.java
@@ -10,13 +10,13 @@
// * "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.pojotools;
+package org.apache.juneau.objecttools;
/**
* TODO
*
* <ul class='seealso'>
- * <li class='link'>{@doc jm.PojoTools}
+ * <li class='link'>{@doc jm.ObjectTools}
* <li class='extlink'>{@source}
* </ul>
*/
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/pojotools/PatternException.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/PatternException.java
similarity index 96%
rename from juneau-core/juneau-marshall/src/main/java/org/apache/juneau/pojotools/PatternException.java
rename to juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/PatternException.java
index 3c575aca0..9297cf82f 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/pojotools/PatternException.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/PatternException.java
@@ -10,7 +10,7 @@
// * "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.pojotools;
+package org.apache.juneau.objecttools;
import org.apache.juneau.*;
@@ -18,7 +18,7 @@ import org.apache.juneau.*;
* Indicates an invalid search pattern was specified.
*
* <ul class='seealso'>
- * <li class='link'>{@doc jm.PojoTools}
+ * <li class='link'>{@doc jm.ObjectTools}
* <li class='extlink'>{@source}
* </ul>
*
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/pojotools/SearchArgs.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/SearchArgs.java
similarity index 95%
rename from juneau-core/juneau-marshall/src/main/java/org/apache/juneau/pojotools/SearchArgs.java
rename to juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/SearchArgs.java
index 1bb0b2ce2..c72ecc5e0 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/pojotools/SearchArgs.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/SearchArgs.java
@@ -10,7 +10,7 @@
// * "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.pojotools;
+package org.apache.juneau.objecttools;
import static org.apache.juneau.internal.CollectionUtils.*;
import static org.apache.juneau.internal.StringUtils.*;
@@ -20,10 +20,10 @@ import java.util.*;
import org.apache.juneau.internal.*;
/**
- * Encapsulates arguments for the {@link PojoSorter} class.
+ * Encapsulates arguments for the {@link ObjectSorter} class.
*
* <ul class='seealso'>
- * <li class='link'>{@doc jm.PojoTools}
+ * <li class='link'>{@doc jm.ObjectTools}
* <li class='extlink'>{@source}
* </ul>
*/
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/pojotools/SortArgs.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/SortArgs.java
similarity index 95%
rename from juneau-core/juneau-marshall/src/main/java/org/apache/juneau/pojotools/SortArgs.java
rename to juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/SortArgs.java
index b1c0d3a2a..2db172133 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/pojotools/SortArgs.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/SortArgs.java
@@ -10,7 +10,7 @@
// * "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.pojotools;
+package org.apache.juneau.objecttools;
import static org.apache.juneau.internal.CollectionUtils.*;
import static org.apache.juneau.internal.StringUtils.*;
@@ -18,10 +18,10 @@ import static org.apache.juneau.internal.StringUtils.*;
import java.util.*;
/**
- * Encapsulates arguments for the {@link PojoSorter} class.
+ * Encapsulates arguments for the {@link ObjectSorter} class.
*
* <ul class='seealso'>
- * <li class='link'>{@doc jm.PojoTools}
+ * <li class='link'>{@doc jm.ObjectTools}
* <li class='extlink'>{@source}
* </ul>
*/
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/pojotools/StringMatcherFactory.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/StringMatcherFactory.java
similarity index 96%
rename from juneau-core/juneau-marshall/src/main/java/org/apache/juneau/pojotools/StringMatcherFactory.java
rename to juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/StringMatcherFactory.java
index b2172527f..3d8735c77 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/pojotools/StringMatcherFactory.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/StringMatcherFactory.java
@@ -10,7 +10,7 @@
// * "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.pojotools;
+package org.apache.juneau.objecttools;
import static org.apache.juneau.internal.StringUtils.*;
@@ -24,7 +24,7 @@ import org.apache.juneau.internal.*;
* TODO
*
* <ul class='seealso'>
- * <li class='link'>{@doc jm.PojoTools}
+ * <li class='link'>{@doc jm.ObjectTools}
* <li class='extlink'>{@source}
* </ul>
*/
@@ -41,14 +41,14 @@ public class StringMatcherFactory extends MatcherFactory {
}
@Override
- public Matcher create(String pattern) {
+ public AbstractMatcher create(String pattern) {
return new StringMatcher(pattern);
}
/**
* A construct representing a single search pattern.
*/
- private static class StringMatcher extends Matcher {
+ private static class StringMatcher extends AbstractMatcher {
private String pattern;
private static final AsciiSet
META_CHARS = AsciiSet.create("*?'\""),
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/pojotools/TimeMatcherFactory.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/TimeMatcherFactory.java
similarity index 98%
rename from juneau-core/juneau-marshall/src/main/java/org/apache/juneau/pojotools/TimeMatcherFactory.java
rename to juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/TimeMatcherFactory.java
index 987bf3762..596f18a96 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/pojotools/TimeMatcherFactory.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/TimeMatcherFactory.java
@@ -10,7 +10,7 @@
// * "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.pojotools;
+package org.apache.juneau.objecttools;
import static java.util.Calendar.*;
import static org.apache.juneau.internal.ThrowableUtils.*;
@@ -26,7 +26,7 @@ import org.apache.juneau.internal.*;
* TODO
*
* <ul class='seealso'>
- * <li class='link'>{@doc jm.PojoTools}
+ * <li class='link'>{@doc jm.ObjectTools}
* <li class='extlink'>{@source}
* </ul>
*/
@@ -81,14 +81,14 @@ public class TimeMatcherFactory extends MatcherFactory {
}
@Override
- public Matcher create(String pattern) {
+ public AbstractMatcher create(String pattern) {
return new TimeMatcher(formats, pattern);
}
/**
* A construct representing a single search pattern.
*/
- private static class TimeMatcher extends Matcher {
+ private static class TimeMatcher extends AbstractMatcher {
private static final AsciiSet
DT = AsciiSet.create("0123456789-:T./"),
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/pojotools/ViewArgs.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/ViewArgs.java
similarity index 94%
rename from juneau-core/juneau-marshall/src/main/java/org/apache/juneau/pojotools/ViewArgs.java
rename to juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/ViewArgs.java
index a10874b7f..40b6510e7 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/pojotools/ViewArgs.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/ViewArgs.java
@@ -10,17 +10,17 @@
// * "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.pojotools;
+package org.apache.juneau.objecttools;
import static org.apache.juneau.internal.CollectionUtils.*;
import java.util.*;
/**
- * Encapsulates arguments for the {@link PojoViewer} class.
+ * Encapsulates arguments for the {@link ObjectViewer} class.
*
* <ul class='seealso'>
- * <li class='link'>{@doc jm.PojoTools}
+ * <li class='link'>{@doc jm.ObjectTools}
* <li class='extlink'>{@source}
* </ul>
*/
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/pojotools/package-info.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/package-info.java
similarity index 95%
rename from juneau-core/juneau-marshall/src/main/java/org/apache/juneau/pojotools/package-info.java
rename to juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/package-info.java
index cae16f675..bfca4362d 100755
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/pojotools/package-info.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/package-info.java
@@ -12,7 +12,7 @@
// ***************************************************************************************************************************
/**
- * POJO Tools
+ * Java Object Tools
*/
-package org.apache.juneau.pojotools;
+package org.apache.juneau.objecttools;
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/Parser.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/Parser.java
index 4bd61788a..928b1a56b 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/Parser.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/Parser.java
@@ -29,6 +29,7 @@ import org.apache.juneau.http.header.*;
import org.apache.juneau.internal.*;
import org.apache.juneau.json.*;
import org.apache.juneau.msgpack.*;
+import org.apache.juneau.objecttools.*;
import org.apache.juneau.swap.*;
import org.apache.juneau.swaps.*;
import org.apache.juneau.uon.*;
@@ -1338,7 +1339,7 @@ public class Parser extends BeanContextable {
* Used in the following locations:
* <ul class='spaced-list'>
* <li>
- * Used to parse argument strings in the {@link PojoIntrospector#invokeMethod(Method, Reader)} method.
+ * Used to parse argument strings in the {@link ObjectIntrospector#invokeMethod(Method, Reader)} method.
* </ul>
*
* @param input The input. Subclasses can support different input types.
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ParserSession.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ParserSession.java
index 67277304f..b0b5f7a0e 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ParserSession.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ParserSession.java
@@ -30,8 +30,8 @@ import org.apache.juneau.cp.*;
import org.apache.juneau.http.header.*;
import org.apache.juneau.httppart.*;
import org.apache.juneau.internal.*;
+import org.apache.juneau.objecttools.*;
import org.apache.juneau.swap.*;
-import org.apache.juneau.utils.*;
/**
* Session object that lives for the duration of a single use of {@link Parser}.
@@ -928,7 +928,7 @@ public class ParserSession extends BeanSession {
* Used in the following locations:
* <ul class='spaced-list'>
* <li>
- * Used to parse argument strings in the {@link PojoIntrospector#invokeMethod(Method, Reader)} method.
+ * Used to parse argument strings in the {@link ObjectIntrospector#invokeMethod(Method, Reader)} method.
* </ul>
*
* @param input The input. Subclasses can support different input types.
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/PojoIntrospector.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/PojoIntrospector.java
deleted file mode 100644
index c29ebbc3a..000000000
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/PojoIntrospector.java
+++ /dev/null
@@ -1,143 +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.juneau.utils;
-
-import java.io.*;
-import java.lang.reflect.*;
-
-import org.apache.juneau.json.*;
-import org.apache.juneau.parser.*;
-import org.apache.juneau.reflect.*;
-
-/**
- * Used to invoke methods on {@code Objects} using arguments in serialized form.
- *
- * <h5 class='section'>Example:</h5>
- * <p class='bjava'>
- * String <jv>string1</jv> = <js>"foobar"</js>;
- * String <jv>string2</jv> = (String)<jk>new</jk> PojoIntrospector(<jv>string</jv>)
- * .invoke(<js>"substring(int,int)"</js>, <js>"[3,6]"</js>); <jc>// "bar"</jc>
- * </p>
- *
- * <ul class='seealso'>
- * <li class='extlink'>{@source}
- * </ul>
- */
-public final class PojoIntrospector {
-
- private final Object o;
- private final ReaderParser p;
-
- /**
- * Constructor.
- *
- * @param o The object on which Java methods will be invoked.
- * @param p The parser to use to parse the method arguments.
- * If <jk>null</jk>, {@link JsonParser#DEFAULT} is used.
- */
- public PojoIntrospector(Object o, ReaderParser p) {
- if (p == null)
- p = JsonParser.DEFAULT;
- this.o = o;
- this.p = p;
- }
-
- /**
- * Shortcut for calling <code><jk>new</jk> PojoIntrospector(o, <jk>null</jk>);</code>
- *
- * @param o The object on which Java methods will be invoked.
- */
- public PojoIntrospector(Object o) {
- this(o, null);
- }
-
- /**
- * Primary method.
- *
- * <p>
- * Invokes the specified method on this bean.
- *
- * @param method The method being invoked.
- * @param args
- * The arguments to pass as parameters to the method.
- * These will automatically be converted to the appropriate object type if possible.
- * Can be <jk>null</jk> if method has no arguments.
- * @return The object returned by the call to the method, or <jk>null</jk> if target object is <jk>null</jk>.
- * @throws IllegalAccessException
- * If the <c>Constructor</c> object enforces Java language access control and the underlying constructor is
- * inaccessible.
- * @throws IllegalArgumentException
- * If one of the following occurs:
- * <ul class='spaced-list'>
- * <li>
- * The number of actual and formal parameters differ.
- * <li>
- * An unwrapping conversion for primitive arguments fails.
- * <li>
- * A parameter value cannot be converted to the corresponding formal parameter type by a method invocation
- * conversion.
- * <li>
- * The constructor pertains to an enum type.
- * </ul>
- * @throws InvocationTargetException If the underlying constructor throws an exception.
- * @throws ParseException Malformed input encountered.
- * @throws IOException Thrown by underlying stream.
- */
- public Object invokeMethod(Method method, Reader args) throws InvocationTargetException, IllegalArgumentException,
- IllegalAccessException, ParseException, IOException {
- if (o == null)
- return null;
- Object[] params = args == null ? null : p.parseArgs(args, method.getGenericParameterTypes());
- return method.invoke(o, params);
- }
-
- /**
- * Convenience method for invoking argument from method signature (@see {@link MethodInfo#getSignature()}.
- *
- * @param method The method being invoked.
- * @param args
- * The arguments to pass as parameters to the method.
- * These will automatically be converted to the appropriate object type if possible.
- * Can be <jk>null</jk> if method has no arguments.
- * @return The object returned by the call to the method, or <jk>null</jk> if target object is <jk>null</jk>.
- * @throws NoSuchMethodException If method does not exist.
- * @throws IllegalAccessException
- * If the <c>Constructor</c> object enforces Java language access control and
- * the underlying constructor is inaccessible.
- * @throws IllegalArgumentException
- * If one of the following occurs:
- * <ul class='spaced-list'>
- * <li>
- * The number of actual and formal parameters differ.
- * <li>
- * An unwrapping conversion for primitive arguments fails.
- * <li>
- * A parameter value cannot be converted to the corresponding formal parameter type by a method invocation
- * conversion.
- * <li>
- * The constructor pertains to an enum type.
- * </ul>
- * @throws InvocationTargetException If the underlying constructor throws an exception.
- * @throws ParseException Malformed input encountered.
- * @throws IOException Thrown by underlying stream.
- */
- public Object invokeMethod(String method, String args) throws NoSuchMethodException, IllegalArgumentException,
- InvocationTargetException, IllegalAccessException, ParseException, IOException {
- if (o == null)
- return null;
- Method m = p.getBeanContext().getClassMeta(o.getClass()).getPublicMethods().get(method);
- if (m == null)
- throw new NoSuchMethodException(method);
- return invokeMethod(m, args == null ? null : new StringReader(args));
- }
-}
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/PojoQuery.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/PojoQuery.java
index 644410315..63ac13972 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/PojoQuery.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/PojoQuery.java
@@ -21,10 +21,12 @@ import java.lang.reflect.*;
import java.text.*;
import java.util.*;
import java.util.regex.*;
+import java.util.regex.Matcher;
import org.apache.juneau.*;
import org.apache.juneau.collections.*;
import org.apache.juneau.internal.*;
+import org.apache.juneau.objecttools.*;
/**
* Designed to provide search/view/sort/paging filtering on tabular in-memory POJO models.
@@ -199,7 +201,10 @@ import org.apache.juneau.internal.*;
* <ul class='seealso'>
* <li class='extlink'>{@source}
* </ul>
+ *
+ * @deprecated Use {@link ObjectSearcher}
*/
+@Deprecated
@SuppressWarnings({"unchecked","rawtypes"})
public final class PojoQuery {
diff --git a/juneau-doc/docs/ReleaseNotes/5.0.0.00.html b/juneau-doc/docs/ReleaseNotes/5.0.0.00.html
index 43c1c2a5c..d364f33f7 100644
--- a/juneau-doc/docs/ReleaseNotes/5.0.0.00.html
+++ b/juneau-doc/docs/ReleaseNotes/5.0.0.00.html
@@ -85,7 +85,7 @@
JSON-schema support.
</li>
<li>
- New {@link oaj.utils.PojoIntrospector} class.
+ New {@del oaj.utils.PojoIntrospector} class.
</li>
<li>
Significant REST servlet API improvements.
diff --git a/juneau-doc/docs/ReleaseNotes/5.1.0.14.html b/juneau-doc/docs/ReleaseNotes/5.1.0.14.html
index 018812b43..eac5a4033 100644
--- a/juneau-doc/docs/ReleaseNotes/5.1.0.14.html
+++ b/juneau-doc/docs/ReleaseNotes/5.1.0.14.html
@@ -26,7 +26,7 @@
<h5 class='topic w800'>Core</h5>
<ul class='spaced-list'>
- <li>Simplified {@link oaj.utils.PojoIntrospector} class.
+ <li>Simplified {@del oaj.utils.PojoIntrospector} class.
<li>New {@del ClassUtils#getMethodSignature(Method)} method.
</ul>
diff --git a/juneau-doc/docs/ReleaseNotes/5.2.0.0.html b/juneau-doc/docs/ReleaseNotes/5.2.0.0.html
index b50d80cf8..6fbc3a1ed 100644
--- a/juneau-doc/docs/ReleaseNotes/5.2.0.0.html
+++ b/juneau-doc/docs/ReleaseNotes/5.2.0.0.html
@@ -123,21 +123,21 @@
<li>{@del IOUtils#readFile(String)}
<li>{@del IOUtils#write(File,Reader)}
</ul>
- <li>New methods on {@link oaj.utils.PojoRest}:
+ <li>New methods on {@del oaj.utils.PojoRest}:
<ul>
<li>{@del PojoRest#get(Class,String,Object)}
- <li>{@link oaj.utils.PojoRest#getString(String)}
- <li>{@link oaj.utils.PojoRest#getString(String,String)}
- <li>{@link oaj.utils.PojoRest#getInt(String)}
- <li>{@link oaj.utils.PojoRest#getInt(String,Integer)}
- <li>{@link oaj.utils.PojoRest#getLong(String)}
- <li>{@link oaj.utils.PojoRest#getLong(String,Long)}
- <li>{@link oaj.utils.PojoRest#getBoolean(String)}
- <li>{@link oaj.utils.PojoRest#getBoolean(String,Boolean)}
- <li>{@link oaj.utils.PojoRest#getMap(String)}
- <li>{@link oaj.utils.PojoRest#getMap(String,Map)}
- <li>{@link oaj.utils.PojoRest#getList(String)}
- <li>{@link oaj.utils.PojoRest#getList(String,List)}
+ <li>{@del oaj.utils.PojoRest#getString(String)}
+ <li>{@del oaj.utils.PojoRest#getString(String,String)}
+ <li>{@del oaj.utils.PojoRest#getInt(String)}
+ <li>{@del oaj.utils.PojoRest#getInt(String,Integer)}
+ <li>{@del oaj.utils.PojoRest#getLong(String)}
+ <li>{@del oaj.utils.PojoRest#getLong(String,Long)}
+ <li>{@del oaj.utils.PojoRest#getBoolean(String)}
+ <li>{@del oaj.utils.PojoRest#getBoolean(String,Boolean)}
+ <li>{@del oaj.utils.PojoRest#getMap(String)}
+ <li>{@del oaj.utils.PojoRest#getMap(String,Map)}
+ <li>{@del oaj.utils.PojoRest#getList(String)}
+ <li>{@del oaj.utils.PojoRest#getList(String,List)}
<li>{@del getObjectMap(String)}
<li>{@del getObjectMap(String,ObjectMap)}
<li>{@del getObjectList(String)}
@@ -194,9 +194,9 @@
<li>Removed <c>org.apache.juneau.utils.CharsetUtils</c> class.
<li>Removed <c>org.apache.juneau.utils.ConcurrentIdentityList</c> class.
<li>Fixed bug in {@link oaj.internal.MultiIterable} class.
- <li>{@link oaj.utils.PojoIntrospector} must now be instantiated with a <c>ReaderParser</c>.
+ <li>{@del oaj.utils.PojoIntrospector} must now be instantiated with a <c>ReaderParser</c>.
Simplifies the API on the class.
- <li>{@link oaj.utils.PojoRest} must now be instantiated with a <c>ReaderParser</c>.
+ <li>{@del oaj.utils.PojoRest} must now be instantiated with a <c>ReaderParser</c>.
Simplifies the API on the class.
<li>{@del oaj.utils.MessageBundle} and <c>SafeResourceMultiBundle</c> moved from server component.
<li>Several bug fixes and performance improvements in {@del StringVarResolver}.
diff --git a/juneau-doc/docs/ReleaseNotes/6.4.0.html b/juneau-doc/docs/ReleaseNotes/6.4.0.html
index 8fa2f3461..c7ca79bbb 100644
--- a/juneau-doc/docs/ReleaseNotes/6.4.0.html
+++ b/juneau-doc/docs/ReleaseNotes/6.4.0.html
@@ -341,13 +341,13 @@
<li>{@del oaj.ObjectMap#getList(String,Class,List) getList(String,Class,List)}
</ul>
<li>
- New methods on {@link oaj.utils.PojoRest}:
+ New methods on {@del oaj.utils.PojoRest}:
<ul>
- <li>{@link oaj.utils.PojoRest#get(String,Class) get(String,Class)}
- <li>{@link oaj.utils.PojoRest#get(String,Type,Type...) get(String,Type,Type...)}
- <li>{@link oaj.utils.PojoRest#getWithDefault(String,Object) getWithDefault(String,Object)}
- <li>{@link oaj.utils.PojoRest#getWithDefault(String,Object,Class) getWithDefault(String,Object,Class)}
- <li>{@link oaj.utils.PojoRest#getWithDefault(String,Object,Type,Type...) getWithDefault(String,Object,Type,Type...)}
+ <li>{@del oaj.utils.PojoRest#get(String,Class) get(String,Class)}
+ <li>{@del oaj.utils.PojoRest#get(String,Type,Type...) get(String,Type,Type...)}
+ <li>{@del oaj.utils.PojoRest#getWithDefault(String,Object) getWithDefault(String,Object)}
+ <li>{@del oaj.utils.PojoRest#getWithDefault(String,Object,Class) getWithDefault(String,Object,Class)}
+ <li>{@del oaj.utils.PojoRest#getWithDefault(String,Object,Type,Type...) getWithDefault(String,Object,Type,Type...)}
</ul>
<li>
Fixed bug where {@link oaj.BeanSession#getMediaType()} wasn't returning a value.
@@ -358,7 +358,7 @@
the call to <c>getClass()</c> to retrieve the annotation value could not be called before calling
the <c><jk>super</jk>()</c> method.
<li>
- New class: {@link oaj.utils.PojoMerge}
+ New class: {@del oaj.utils.PojoMerge}
<li>
New doc: <dc>2.6.2 - @Pojo annotation</dc>
<li>
diff --git a/juneau-doc/docs/Topics/02.juneau-marshall/25.jm.PojoTools.html b/juneau-doc/docs/Topics/02.juneau-marshall/25.jm.ObjectTools.html
similarity index 89%
rename from juneau-doc/docs/Topics/02.juneau-marshall/25.jm.PojoTools.html
rename to juneau-doc/docs/Topics/02.juneau-marshall/25.jm.ObjectTools.html
index 67e3ab7bd..8aa6e30e7 100644
--- a/juneau-doc/docs/Topics/02.juneau-marshall/25.jm.PojoTools.html
+++ b/juneau-doc/docs/Topics/02.juneau-marshall/25.jm.ObjectTools.html
@@ -13,11 +13,11 @@
***************************************************************************************************************************/
-->
-{title:'POJO Tools', created:'9.0.0', flags:'TODO'}
+{title:'Object Tools', created:'9.0.0', flags:'TODO'}
<div class='topic'>
<p>
- The {@link org.apache.juneau.pojotools} package defines convenience utility classes for accessing
+ The {@link org.apache.juneau.objecttools} package defines convenience utility classes for accessing
and manipulating POJOs. It consists of the following classes:
</p>
<ul class='javatree'>
diff --git a/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/ResponseBody.java b/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/ResponseBody.java
index af1aeaec4..91a58488c 100644
--- a/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/ResponseBody.java
+++ b/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/ResponseBody.java
@@ -21,6 +21,7 @@ import java.lang.reflect.*;
import java.nio.charset.*;
import java.util.concurrent.*;
import java.util.regex.*;
+import java.util.regex.Matcher;
import org.apache.http.*;
import org.apache.http.conn.*;
@@ -32,11 +33,11 @@ import org.apache.juneau.http.resource.*;
import org.apache.juneau.httppart.*;
import org.apache.juneau.internal.*;
import org.apache.juneau.oapi.*;
+import org.apache.juneau.objecttools.*;
import org.apache.juneau.parser.*;
import org.apache.juneau.parser.ParseException;
import org.apache.juneau.reflect.*;
import org.apache.juneau.rest.client.assertion.*;
-import org.apache.juneau.utils.*;
/**
* Represents the body of an HTTP response.
@@ -949,38 +950,38 @@ public class ResponseBody implements HttpEntity {
}
/**
- * Parses the output from the body into the specified type and then wraps that in a {@link PojoRest}.
+ * Parses the output from the body into the specified type and then wraps that in a {@link ObjectRest}.
*
* <p>
* Useful if you want to quickly retrieve a single value from inside of a larger JSON document.
*
* @param innerType The class type of the POJO being wrapped.
- * @return The parsed output wrapped in a {@link PojoRest}.
+ * @return The parsed output wrapped in a {@link ObjectRest}.
* @throws RestCallException
* <ul>
* <li>If the input contains a syntax error or is malformed, or is not valid for the specified type.
* <li>If a connection error occurred.
* </ul>
*/
- public PojoRest asPojoRest(Class<?> innerType) throws RestCallException {
- return new PojoRest(as(innerType));
+ public ObjectRest asObjectRest(Class<?> innerType) throws RestCallException {
+ return new ObjectRest(as(innerType));
}
/**
- * Converts the output from the connection into an {@link JsonMap} and then wraps that in a {@link PojoRest}.
+ * Converts the output from the connection into an {@link JsonMap} and then wraps that in a {@link ObjectRest}.
*
* <p>
* Useful if you want to quickly retrieve a single value from inside of a larger JSON document.
*
- * @return The parsed output wrapped in a {@link PojoRest}.
+ * @return The parsed output wrapped in a {@link ObjectRest}.
* @throws RestCallException
* <ul>
* <li>If the input contains a syntax error or is malformed, or is not valid for the specified type.
* <li>If a connection error occurred.
* </ul>
*/
- public PojoRest asPojoRest() throws RestCallException {
- return asPojoRest(JsonMap.class);
+ public ObjectRest asObjectRest() throws RestCallException {
+ return asObjectRest(JsonMap.class);
}
/**
diff --git a/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestClient.java b/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestClient.java
index 6c896f654..c345b7e19 100644
--- a/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestClient.java
+++ b/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestClient.java
@@ -80,6 +80,7 @@ import org.apache.juneau.json.*;
import org.apache.juneau.marshall.*;
import org.apache.juneau.msgpack.*;
import org.apache.juneau.oapi.*;
+import org.apache.juneau.objecttools.*;
import org.apache.juneau.parser.*;
import org.apache.juneau.parser.ParseException;
import org.apache.juneau.plaintext.*;
@@ -679,8 +680,8 @@ import org.apache.juneau.xml.*;
* <li class='jm'><c>{@link ResponseBody#asString() asString()} <jk>returns</jk> String</c>
* <li class='jm'><c>{@link ResponseBody#asStringFuture() asStringFuture()} <jk>returns</jk> Future<String></c>
* <li class='jm'><c>{@link ResponseBody#asAbbreviatedString(int) asAbbreviatedString(int)} <jk>returns</jk> String</c>
- * <li class='jm'><c>{@link ResponseBody#asPojoRest(Class) asPojoRest(Class<?>)} <jk>returns</jk> {@link PojoRest}</c>
- * <li class='jm'><c>{@link ResponseBody#asPojoRest() asPojoRest()} <jk>returns</jk> {@link PojoRest}</c>
+ * <li class='jm'><c>{@link ResponseBody#asObjectRest(Class) asObjectRest(Class<?>)} <jk>returns</jk> {@link ObjectRest}</c>
+ * <li class='jm'><c>{@link ResponseBody#asObjectRest() asObjectRest()} <jk>returns</jk> {@link ObjectRest}</c>
* <li class='jm'><c>{@link ResponseBody#asMatcher(Pattern) asMatcher(Pattern)} <jk>returns</jk> {@link Matcher}</c>
* <li class='jm'><c>{@link ResponseBody#asMatcher(String) asMatcher(String)} <jk>returns</jk> {@link Matcher}</c>
* </ul>
diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/converter/Introspectable.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/converter/Introspectable.java
index c925b8875..4707a0edc 100644
--- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/converter/Introspectable.java
+++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/converter/Introspectable.java
@@ -14,13 +14,13 @@ package org.apache.juneau.rest.converter;
import org.apache.juneau.*;
import org.apache.juneau.json.*;
+import org.apache.juneau.objecttools.*;
import org.apache.juneau.rest.*;
import org.apache.juneau.swap.*;
import org.apache.juneau.http.response.*;
-import org.apache.juneau.utils.*;
/**
- * Converter for enablement of {@link PojoIntrospector} support on response objects returned by a
+ * Converter for enablement of {@link ObjectIntrospector} support on response objects returned by a
* <c>@RestOp</c>-annotated method.
*
* <p>
@@ -42,7 +42,7 @@ import org.apache.juneau.utils.*;
* </ul>
*
* <ul class='seealso'>
- * <li class='jc'>{@link PojoIntrospector} - Additional information on introspection of POJO methods.
+ * <li class='jc'>{@link ObjectIntrospector} - Additional information on introspection of POJO methods.
* <li class='jm'>{@link org.apache.juneau.rest.RestOpContext.Builder#converters()} - Registering converters with REST resources.
* <li class='link'>{@doc jrs.Converters}
* <li class='extlink'>{@source}
@@ -70,7 +70,7 @@ public final class Introspectable implements RestConverter {
ObjectSwap swap = bs.getClassMetaForObject(o).getSwap(bs);
if (swap != null)
o = swap.swap(bs, o);
- return new PojoIntrospector(o, JsonParser.DEFAULT).invokeMethod(method, args);
+ return ObjectIntrospector.create(o, JsonParser.DEFAULT).invokeMethod(method, args);
} catch (Exception e) {
return new InternalServerError(e,
"Error occurred trying to invoke method: {0}",
diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/converter/Traversable.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/converter/Traversable.java
index de2a5c860..5bf6d3778 100644
--- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/converter/Traversable.java
+++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/converter/Traversable.java
@@ -18,11 +18,11 @@ import org.apache.juneau.*;
import org.apache.juneau.rest.*;
import org.apache.juneau.swap.*;
import org.apache.juneau.http.response.*;
+import org.apache.juneau.objecttools.*;
import org.apache.juneau.parser.*;
-import org.apache.juneau.utils.*;
/**
- * Converter for enabling of {@link PojoRest} support on response objects returned by a <c>@RestOp</c>-annotated method.
+ * Converter for enabling of {@link ObjectRest} support on response objects returned by a <c>@RestOp</c>-annotated method.
*
* <p>
* When enabled, objects in a POJO tree returned by the REST method can be addressed through additional URL path
@@ -37,7 +37,7 @@ import org.apache.juneau.utils.*;
* </p>
*
* <ul class='seealso'>
- * <li class='jc'>{@link PojoRest} - Additional information on addressing elements in a POJO tree using URL notation.
+ * <li class='jc'>{@link ObjectRest} - Additional information on addressing elements in a POJO tree using URL notation.
* <li class='jm'>{@link org.apache.juneau.rest.RestOpContext.Builder#converters()} - Registering converters with REST resources.
* <li class='link'>{@doc jrs.Converters}
* <li class='extlink'>{@source}
@@ -60,9 +60,9 @@ public final class Traversable implements RestConverter {
if (swap != null)
o = swap.swap(bs, o);
ReaderParser rp = req.getBody().getParserMatch().map(ParserMatch::getParser).filter(ReaderParser.class::isInstance).map(ReaderParser.class::cast).orElse(null);
- PojoRest p = new PojoRest(o, rp);
- o = p.get(pathRemainder);
- } catch (PojoRestException e) {
+ ObjectRest or = ObjectRest.create(o, rp);
+ o = or.get(pathRemainder);
+ } catch (ObjectRestException e) {
throw new BasicHttpException(e.getStatus(), e);
} catch (Throwable t) {
throw toHttpException(t, InternalServerError.class);
diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/vars/SwaggerVar.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/vars/SwaggerVar.java
index 689fb3eba..9283220b0 100644
--- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/vars/SwaggerVar.java
+++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/vars/SwaggerVar.java
@@ -13,9 +13,9 @@
package org.apache.juneau.rest.vars;
import org.apache.juneau.http.response.*;
+import org.apache.juneau.objecttools.*;
import org.apache.juneau.rest.*;
import org.apache.juneau.svl.*;
-import org.apache.juneau.utils.*;
/**
* Swagger attribute variable resolver.
@@ -69,7 +69,7 @@ public class SwaggerVar extends MultipartResolvingVar {
@Override /* Var */
public String resolve(VarResolverSession session, String key) {
RestRequest req = session.getBean(RestRequest.class).orElseThrow(InternalServerError::new);
- return new PojoRest(req.getSwagger()).getString(key);
+ return new ObjectRest(req.getSwagger()).getString(key);
}
@Override /* Var */
diff --git a/juneau-utest/src/test/java/org/apache/juneau/BeanMapTest.java b/juneau-utest/src/test/java/org/apache/juneau/BeanMapTest.java
index 316243472..9995da036 100755
--- a/juneau-utest/src/test/java/org/apache/juneau/BeanMapTest.java
+++ b/juneau-utest/src/test/java/org/apache/juneau/BeanMapTest.java
@@ -23,11 +23,11 @@ import org.apache.juneau.annotation.*;
import org.apache.juneau.collections.*;
import org.apache.juneau.html.*;
import org.apache.juneau.json.*;
+import org.apache.juneau.objecttools.*;
import org.apache.juneau.parser.*;
import org.apache.juneau.serializer.*;
import org.apache.juneau.uon.*;
import org.apache.juneau.urlencoding.*;
-import org.apache.juneau.utils.*;
import org.apache.juneau.xml.*;
import org.junit.*;
@@ -606,7 +606,7 @@ public class BeanMapTest {
F t5 = new F();
ReaderParser p = JsonParser.DEFAULT;
BeanMap m = bc.toBeanMap(t5);
- new PojoIntrospector(t5, p).invokeMethod("doSetAProperty(java.lang.String)", "['baz']");
+ ObjectIntrospector.create(t5, p).invokeMethod("doSetAProperty(java.lang.String)", "['baz']");
assertEquals("baz", m.get("prop"));
}
diff --git a/juneau-utest/src/test/java/org/apache/juneau/JsonMapTest.java b/juneau-utest/src/test/java/org/apache/juneau/JsonMapTest.java
index 7ccfdcf15..42fb9bf69 100755
--- a/juneau-utest/src/test/java/org/apache/juneau/JsonMapTest.java
+++ b/juneau-utest/src/test/java/org/apache/juneau/JsonMapTest.java
@@ -20,7 +20,7 @@ import static org.apache.juneau.testutils.StreamUtils.*;
import java.util.*;
import org.apache.juneau.collections.*;
-import org.apache.juneau.utils.*;
+import org.apache.juneau.objecttools.*;
import org.junit.*;
@FixMethodOrder(NAME_ASCENDING)
@@ -238,12 +238,12 @@ public class JsonMapTest {
}
private String getDeepString(JsonMap m, String url) {
- PojoRest r = new PojoRest(m);
+ ObjectRest r = ObjectRest.create(m);
return (String)r.get(url);
}
private Boolean getDeepBoolean(JsonMap m, String url) {
- PojoRest r = new PojoRest(m);
+ ObjectRest r = ObjectRest.create(m);
return (Boolean)r.get(url);
}
diff --git a/juneau-utest/src/test/java/org/apache/juneau/utils/PojoIntrospectorTest.java b/juneau-utest/src/test/java/org/apache/juneau/objecttools/ObjectIntrospectorTest.java
similarity index 73%
rename from juneau-utest/src/test/java/org/apache/juneau/utils/PojoIntrospectorTest.java
rename to juneau-utest/src/test/java/org/apache/juneau/objecttools/ObjectIntrospectorTest.java
index 90914c96b..87c00c2b0 100755
--- a/juneau-utest/src/test/java/org/apache/juneau/utils/PojoIntrospectorTest.java
+++ b/juneau-utest/src/test/java/org/apache/juneau/objecttools/ObjectIntrospectorTest.java
@@ -10,7 +10,7 @@
// * "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;
+package org.apache.juneau.objecttools;
import static org.apache.juneau.assertions.Assertions.*;
import static org.junit.Assert.*;
@@ -19,7 +19,7 @@ import static org.junit.runners.MethodSorters.*;
import org.junit.*;
@FixMethodOrder(NAME_ASCENDING)
-public class PojoIntrospectorTest {
+public class ObjectIntrospectorTest {
//====================================================================================================
// testBasic
@@ -29,28 +29,28 @@ public class PojoIntrospectorTest {
String in = null;
Object r;
- r = new PojoIntrospector(in, null).invokeMethod("substring(int,int)", "[3,6]");
+ r = new ObjectIntrospector(in, null).invokeMethod("substring(int,int)", "[3,6]");
assertNull(r);
in = "foobar";
- r = new PojoIntrospector(in).invokeMethod("substring(int,int)", "[3,6]");
+ r = new ObjectIntrospector(in).invokeMethod("substring(int,int)", "[3,6]");
assertEquals("bar", r);
- r = new PojoIntrospector(in).invokeMethod("toString", null);
+ r = new ObjectIntrospector(in).invokeMethod("toString", null);
assertEquals("foobar", r);
- r = new PojoIntrospector(in).invokeMethod("toString", "");
+ r = new ObjectIntrospector(in).invokeMethod("toString", "");
assertEquals("foobar", r);
- r = new PojoIntrospector(in).invokeMethod("toString", "[]");
+ r = new ObjectIntrospector(in).invokeMethod("toString", "[]");
assertEquals("foobar", r);
- assertThrown(()->new PojoIntrospector("foobar").invokeMethod("noSuchMethod", "[3,6]")).isType(NoSuchMethodException.class);
+ assertThrown(()->new ObjectIntrospector("foobar").invokeMethod("noSuchMethod", "[3,6]")).isType(NoSuchMethodException.class);
- r = new PojoIntrospector(null).invokeMethod(String.class.getMethod("toString"), null);
+ r = new ObjectIntrospector(null).invokeMethod(String.class.getMethod("toString"), null);
assertNull(r);
- r = new PojoIntrospector("foobar").invokeMethod(String.class.getMethod("toString"), null);
+ r = new ObjectIntrospector("foobar").invokeMethod(String.class.getMethod("toString"), null);
assertEquals("foobar", r);
}
}
diff --git a/juneau-utest/src/test/java/org/apache/juneau/utils/PojoMergeTest.java b/juneau-utest/src/test/java/org/apache/juneau/objecttools/ObjectMergerTest.java
similarity index 87%
rename from juneau-utest/src/test/java/org/apache/juneau/utils/PojoMergeTest.java
rename to juneau-utest/src/test/java/org/apache/juneau/objecttools/ObjectMergerTest.java
index 7776c3642..3a0a62a80 100644
--- a/juneau-utest/src/test/java/org/apache/juneau/utils/PojoMergeTest.java
+++ b/juneau-utest/src/test/java/org/apache/juneau/objecttools/ObjectMergerTest.java
@@ -10,7 +10,7 @@
// * "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;
+package org.apache.juneau.objecttools;
import static org.junit.Assert.*;
import static org.junit.runners.MethodSorters.*;
@@ -21,7 +21,7 @@ import org.junit.*;
* Test the PojoMerge class.
*/
@FixMethodOrder(NAME_ASCENDING)
-public class PojoMergeTest {
+public class ObjectMergerTest {
//====================================================================================================
// Basic tests
@@ -31,7 +31,7 @@ public class PojoMergeTest {
IA a1, a2, am;
a1 = new A("1"); a2 = new A("2");
- am = PojoMerge.merge(IA.class, a1, a2);
+ am = ObjectMerger.merge(IA.class, a1, a2);
assertEquals("1", am.getA());
am.setA("x");
assertEquals("x", am.getA());
@@ -39,7 +39,7 @@ public class PojoMergeTest {
assertEquals("2", a2.getA());
a1 = new A("1"); a2 = new A("2");
- am = PojoMerge.merge(IA.class, true, a1, a2);
+ am = ObjectMerger.merge(IA.class, true, a1, a2);
assertEquals("1", am.getA());
am.setA("x");
assertEquals("x", am.getA());
@@ -47,7 +47,7 @@ public class PojoMergeTest {
assertEquals("x", a2.getA());
a1 = new A(null); a2 = new A("2");
- am = PojoMerge.merge(IA.class, a1, a2);
+ am = ObjectMerger.merge(IA.class, a1, a2);
assertEquals("2", am.getA());
am.setA("x");
assertEquals("x", am.getA());
@@ -55,11 +55,11 @@ public class PojoMergeTest {
assertEquals("2", a2.getA());
a1 = new A(null); a2 = new A(null);
- am = PojoMerge.merge(IA.class, a1, a2);
+ am = ObjectMerger.merge(IA.class, a1, a2);
assertEquals(null, am.getA());
a1 = new A(null); a2 = new A("2");
- am = PojoMerge.merge(IA.class, null, a1, null, null, a2, null);
+ am = ObjectMerger.merge(IA.class, null, a1, null, null, a2, null);
assertEquals("2", am.getA());
}
diff --git a/juneau-utest/src/test/java/org/apache/juneau/utils/PojoRestTest.java b/juneau-utest/src/test/java/org/apache/juneau/objecttools/ObjectRestTest.java
similarity index 95%
rename from juneau-utest/src/test/java/org/apache/juneau/utils/PojoRestTest.java
rename to juneau-utest/src/test/java/org/apache/juneau/objecttools/ObjectRestTest.java
index d1d504b15..4f9af4bb5 100755
--- a/juneau-utest/src/test/java/org/apache/juneau/utils/PojoRestTest.java
+++ b/juneau-utest/src/test/java/org/apache/juneau/objecttools/ObjectRestTest.java
@@ -10,7 +10,7 @@
// * "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;
+package org.apache.juneau.objecttools;
import static org.apache.juneau.assertions.Assertions.*;
import static org.junit.Assert.*;
@@ -27,7 +27,7 @@ import org.junit.*;
@SuppressWarnings({"unchecked","rawtypes","serial"})
@FixMethodOrder(NAME_ASCENDING)
-public class PojoRestTest {
+public class ObjectRestTest {
//====================================================================================================
// testBasic
@@ -37,7 +37,7 @@ public class PojoRestTest {
// TODO: Need to write some exhaustive tests here. Will open work item
// to do that later.
- PojoRest model = new PojoRest(new JsonMap()); // An empty model.
+ ObjectRest model = ObjectRest.create(new JsonMap()); // An empty model.
// Do a PUT
model.put("A", new JsonMap());
@@ -64,10 +64,10 @@ public class PojoRestTest {
//====================================================================================================
@Test
public void testBeans() throws Exception {
- PojoRest model;
+ ObjectRest model;
// Java beans.
- model = new PojoRest(new JsonMap());
+ model = ObjectRest.create(new JsonMap());
Person p = new Person("some name", 123,
new Address("street A", "city A", "state A", 12345, true),
new Address("street B", "city B", "state B", 12345, false)
@@ -109,7 +109,7 @@ public class PojoRestTest {
assertEquals(expectedValue, s);
// Try adding an address
- model = new PojoRest(p);
+ model = ObjectRest.create(p);
model.post("addresses", new Address("street C", "city C", "state C", 12345, true));
s = ((Address)model.get("addresses/2")).toString();
expectedValue = "Address(street=street C,city=city C,state=state C,zip=12345,isCurrent=true)";
@@ -163,7 +163,7 @@ public class PojoRestTest {
// Make sure we can get non-existent branches without throwing any exceptions.
// get() method should just return null.
- model = new PojoRest(new JsonMap());
+ model = ObjectRest.create(new JsonMap());
Object o = model.get("xxx");
assertEquals("null", (""+o));
@@ -184,7 +184,7 @@ public class PojoRestTest {
assertEquals("{x:2}", s);
// Make sure doing a POST against "" or "/" adds to the root object.
- model = new PojoRest(new JsonList());
+ model = ObjectRest.create(new JsonList());
model.post("", new Integer(1));
model.post("/", new Integer(2));
s = model.get("").toString();
@@ -196,9 +196,9 @@ public class PojoRestTest {
//====================================================================================================
@Test
public void testAddressBook() {
- PojoRest model;
+ ObjectRest model;
- model = new PojoRest(new AddressBook());
+ model = ObjectRest.create(new AddressBook());
// Try adding a person to the address book.
Person billClinton = new Person("Bill Clinton", 65,
@@ -272,7 +272,7 @@ public class PojoRestTest {
//====================================================================================================
@Test
public void testConstructors() throws Exception {
- PojoRest model = new PojoRest(new AddressBook(), JsonParser.DEFAULT);
+ ObjectRest model = ObjectRest.create(new AddressBook(), JsonParser.DEFAULT);
// Try adding a person to the address book.
Person billClinton = new Person("Bill Clinton", 65,
@@ -290,7 +290,7 @@ public class PojoRestTest {
//====================================================================================================
@Test
public void testRootLocked() throws Exception {
- PojoRest model = new PojoRest(new AddressBook()).setRootLocked();
+ ObjectRest model = ObjectRest.create(new AddressBook()).setRootLocked();
assertThrown(()->model.put("", new AddressBook())).asMessage().is("Cannot overwrite root object");
assertThrown(()->model.put(null, new AddressBook())).asMessage().is("Cannot overwrite root object");
assertThrown(()->model.put("/", new AddressBook())).asMessage().is("Cannot overwrite root object");
@@ -301,7 +301,7 @@ public class PojoRestTest {
//====================================================================================================
@Test
public void testGetRootObject() throws Exception {
- PojoRest model = new PojoRest(new AddressBook());
+ ObjectRest model = ObjectRest.create(new AddressBook());
assertTrue(model.getRootObject() instanceof AddressBook);
model.put("", "foobar");
assertTrue(model.getRootObject() instanceof String);
@@ -331,7 +331,7 @@ public class PojoRestTest {
//====================================================================================================
@Test
public void testGetMethods() throws Exception {
- PojoRest model = new PojoRest(new A());
+ ObjectRest model = ObjectRest.create(new A());
JsonList l = JsonList.ofJson("[{a:'b'}]");
JsonMap m = JsonMap.ofJson("{a:'b'}");
@@ -809,10 +809,10 @@ public class PojoRestTest {
@Test
public void testInvokeMethod() throws Exception {
- PojoRest model = new PojoRest(new AddressBook().init());
+ ObjectRest model = ObjectRest.create(new AddressBook().init());
assertEquals("Person(name=Bill Clinton,age=65)", model.invokeMethod("0", "toString", ""));
- model = new PojoRest(new AddressBook().init(), JsonParser.DEFAULT);
+ model = ObjectRest.create(new AddressBook().init(), JsonParser.DEFAULT);
assertEquals("Person(name=Bill Clinton,age=65)", model.invokeMethod("0", "toString", ""));
assertEquals("NY", model.invokeMethod("0/addresses/0/state", "toString", ""));
assertNull(model.invokeMethod("1", "toString", ""));
@@ -823,7 +823,7 @@ public class PojoRestTest {
//====================================================================================================
@Test
public void testGetPublicMethods() throws Exception {
- PojoRest model = new PojoRest(new AddressBook().init());
+ ObjectRest model = ObjectRest.create(new AddressBook().init());
assertTrue(SimpleJsonSerializer.DEFAULT.toString(model.getPublicMethods("0")).contains("'toString'"));
assertTrue(SimpleJsonSerializer.DEFAULT.toString(model.getPublicMethods("0/addresses/0/state")).contains("'toString'"));
assertNull(model.getPublicMethods("1"));
@@ -834,7 +834,7 @@ public class PojoRestTest {
//====================================================================================================
@Test
public void testGetClassMeta() throws Exception {
- PojoRest model = new PojoRest(new AddressBook().init());
+ ObjectRest model = ObjectRest.create(new AddressBook().init());
assertEquals("Person", model.getClassMeta("0").getInnerClass().getSimpleName());
assertEquals("String", model.getClassMeta("0/addresses/0/state").getInnerClass().getSimpleName());
assertNull(model.getClassMeta("1"));
diff --git a/juneau-utest/src/test/java/org/apache/juneau/pojotools/PojoSearcherTest.java b/juneau-utest/src/test/java/org/apache/juneau/objecttools/ObjectSearcherTest.java
similarity index 96%
rename from juneau-utest/src/test/java/org/apache/juneau/pojotools/PojoSearcherTest.java
rename to juneau-utest/src/test/java/org/apache/juneau/objecttools/ObjectSearcherTest.java
index 6732889ff..0b3c50d7d 100755
--- a/juneau-utest/src/test/java/org/apache/juneau/pojotools/PojoSearcherTest.java
+++ b/juneau-utest/src/test/java/org/apache/juneau/objecttools/ObjectSearcherTest.java
@@ -10,7 +10,7 @@
// * "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.pojotools;
+package org.apache.juneau.objecttools;
import static org.apache.juneau.assertions.Assertions.*;
import static org.apache.juneau.internal.CollectionUtils.*;
@@ -29,10 +29,10 @@ import org.junit.*;
* Tests the PojoSearcher class.
*/
@FixMethodOrder(NAME_ASCENDING)
-public class PojoSearcherTest {
+public class ObjectSearcherTest {
private static BeanSession bs = BeanContext.DEFAULT_SESSION;
- private static PojoSearcher ps = PojoSearcher.DEFAULT;
+ private static ObjectSearcher ps = ObjectSearcher.DEFAULT;
private static WriterSerializer ws = JsonSerializer.create().ssq().swaps(TemporalCalendarSwap.IsoLocalDateTime.class).build();
//-----------------------------------------------------------------------------------------------------------------
diff --git a/juneau-utest/src/test/java/org/apache/juneau/pojotools/PojoSorterTest.java b/juneau-utest/src/test/java/org/apache/juneau/objecttools/ObjectSorterTest.java
similarity index 98%
rename from juneau-utest/src/test/java/org/apache/juneau/pojotools/PojoSorterTest.java
rename to juneau-utest/src/test/java/org/apache/juneau/objecttools/ObjectSorterTest.java
index ee158923e..fbd9fd919 100644
--- a/juneau-utest/src/test/java/org/apache/juneau/pojotools/PojoSorterTest.java
+++ b/juneau-utest/src/test/java/org/apache/juneau/objecttools/ObjectSorterTest.java
@@ -10,7 +10,7 @@
// * "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.pojotools;
+package org.apache.juneau.objecttools;
import static org.apache.juneau.assertions.Assertions.*;
import static org.apache.juneau.internal.CollectionUtils.*;
@@ -24,9 +24,9 @@ import org.junit.*;
* Tests the PojoPaginator class.
*/
@FixMethodOrder(NAME_ASCENDING)
-public class PojoSorterTest {
+public class ObjectSorterTest {
- PojoSorter p = new PojoSorter();
+ ObjectSorter p = new ObjectSorter();
BeanSession bs = BeanContext.DEFAULT_SESSION;
//-----------------------------------------------------------------------------------------------------------------
diff --git a/juneau-utest/src/test/java/org/apache/juneau/pojotools/PojoViewerTest.java b/juneau-utest/src/test/java/org/apache/juneau/objecttools/ObjectViewerTest.java
similarity index 99%
rename from juneau-utest/src/test/java/org/apache/juneau/pojotools/PojoViewerTest.java
rename to juneau-utest/src/test/java/org/apache/juneau/objecttools/ObjectViewerTest.java
index d739ef31a..b949e6ab9 100644
--- a/juneau-utest/src/test/java/org/apache/juneau/pojotools/PojoViewerTest.java
+++ b/juneau-utest/src/test/java/org/apache/juneau/objecttools/ObjectViewerTest.java
@@ -10,7 +10,7 @@
// * "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.pojotools;
+package org.apache.juneau.objecttools;
import static org.apache.juneau.assertions.Assertions.*;
import static org.apache.juneau.internal.CollectionUtils.*;
@@ -24,9 +24,9 @@ import org.junit.*;
* Tests the PojoPaginator class.
*/
@FixMethodOrder(NAME_ASCENDING)
-public class PojoViewerTest {
+public class ObjectViewerTest {
- PojoViewer p = new PojoViewer();
+ ObjectViewer p = new ObjectViewer();
BeanSession bs = BeanContext.DEFAULT_SESSION;
//-----------------------------------------------------------------------------------------------------------------
diff --git a/juneau-utest/src/test/java/org/apache/juneau/rest/client/RestClient_Response_Body_Test.java b/juneau-utest/src/test/java/org/apache/juneau/rest/client/RestClient_Response_Body_Test.java
index 8b905347b..7ef559fca 100644
--- a/juneau-utest/src/test/java/org/apache/juneau/rest/client/RestClient_Response_Body_Test.java
+++ b/juneau-utest/src/test/java/org/apache/juneau/rest/client/RestClient_Response_Body_Test.java
@@ -32,11 +32,11 @@ import org.apache.http.entity.ContentType;
import org.apache.http.message.*;
import org.apache.juneau.*;
import org.apache.juneau.json.*;
+import org.apache.juneau.objecttools.*;
import org.apache.juneau.parser.*;
import org.apache.juneau.rest.annotation.*;
import org.apache.juneau.rest.mock.*;
import org.apache.juneau.rest.servlet.*;
-import org.apache.juneau.utils.*;
import org.apache.juneau.xml.*;
import org.junit.*;
@@ -248,10 +248,10 @@ public class RestClient_Response_Body_Test {
String x18 = testClient().entity(stringEntity("12345")).get().run().getBody().asAbbreviatedString(4);
assertString(x18).is("1...");
- PojoRest x20 = testClient().entity(stringEntity("{f:1}")).get().run().getBody().asPojoRest(ABean.class);
+ ObjectRest x20 = testClient().entity(stringEntity("{f:1}")).get().run().getBody().asObjectRest(ABean.class);
assertString(x20.get("f")).is("1");
- PojoRest x22 = testClient().entity(stringEntity("{f:1}")).get().run().getBody().asPojoRest();
+ ObjectRest x22 = testClient().entity(stringEntity("{f:1}")).get().run().getBody().asObjectRest();
assertString(x22.get("f")).is("1");
Matcher x24 = testClient().entity(stringEntity("foo=123")).get().run().getBody().asMatcher(Pattern.compile("foo=(.*)"));