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 2016/08/27 15:38:26 UTC
[7/8] incubator-juneau git commit: Tweak new name 'Transform' into
'BeanFilter' and 'PojoSwap'
Tweak new name 'Transform' into 'BeanFilter' and 'PojoSwap'
Project: http://git-wip-us.apache.org/repos/asf/incubator-juneau/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-juneau/commit/0ce0e663
Tree: http://git-wip-us.apache.org/repos/asf/incubator-juneau/tree/0ce0e663
Diff: http://git-wip-us.apache.org/repos/asf/incubator-juneau/diff/0ce0e663
Branch: refs/heads/master
Commit: 0ce0e663e9cffc90c7ba5c6a4c953036255e84f5
Parents: a6ba780
Author: jamesbognar <ja...@gmail.com>
Authored: Sat Aug 27 10:14:33 2016 -0400
Committer: jamesbognar <ja...@gmail.com>
Committed: Sat Aug 27 11:29:35 2016 -0400
----------------------------------------------------------------------
.../java/org/apache/juneau/client/package.html | 2 +-
.../java/org/apache/juneau/BeanContext.java | 86 +--
.../main/java/org/apache/juneau/BeanMap.java | 18 +-
.../java/org/apache/juneau/BeanMapEntry.java | 10 +-
.../main/java/org/apache/juneau/BeanMeta.java | 16 +-
.../org/apache/juneau/BeanPropertyMeta.java | 42 +-
.../main/java/org/apache/juneau/ClassMeta.java | 46 +-
.../java/org/apache/juneau/ContextFactory.java | 12 +-
.../main/java/org/apache/juneau/ObjectMap.java | 8 +-
.../java/org/apache/juneau/annotation/Bean.java | 10 +-
.../apache/juneau/annotation/BeanProperty.java | 4 +-
.../java/org/apache/juneau/annotation/Pojo.java | 18 +-
.../org/apache/juneau/dto/atom/CommonEntry.java | 2 +-
.../java/org/apache/juneau/dto/atom/Entry.java | 2 +-
.../org/apache/juneau/dto/cognos/Column.java | 10 +-
.../org/apache/juneau/dto/cognos/DataSet.java | 6 +-
.../org/apache/juneau/dto/cognos/package.html | 4 +-
.../apache/juneau/dto/jsonschema/Schema.java | 48 +-
.../java/org/apache/juneau/html/HtmlParser.java | 4 +-
.../juneau/html/HtmlSchemaDocSerializer.java | 2 +-
.../org/apache/juneau/html/HtmlSerializer.java | 22 +-
.../org/apache/juneau/internal/HashCode.java | 4 +-
.../apache/juneau/internal/JuneauLogger.java | 8 +-
.../java/org/apache/juneau/jena/RdfParser.java | 4 +-
.../org/apache/juneau/jena/RdfSerializer.java | 4 +-
.../java/org/apache/juneau/jena/package.html | 16 +-
.../java/org/apache/juneau/json/JsonParser.java | 4 +-
.../juneau/json/JsonSchemaSerializer.java | 2 +-
.../org/apache/juneau/json/JsonSerializer.java | 4 +-
.../java/org/apache/juneau/json/package.html | 22 +-
.../apache/juneau/msgpack/MsgPackParser.java | 4 +-
.../juneau/msgpack/MsgPackSerializer.java | 4 +-
.../main/java/org/apache/juneau/package.html | 6 +-
.../java/org/apache/juneau/parser/Parser.java | 8 +-
.../org/apache/juneau/parser/ParserGroup.java | 4 +-
.../juneau/plaintext/PlainTextParser.java | 2 +-
.../juneau/plaintext/PlainTextSerializer.java | 2 +-
.../juneau/serializer/SerializerGroup.java | 4 +-
.../juneau/serializer/SerializerSession.java | 4 +-
.../juneau/transform/AnnotationBeanFilter.java | 70 ++
.../transform/AnnotationBeanTransform.java | 70 --
.../org/apache/juneau/transform/BeanFilter.java | 526 ++++++++++++++
.../apache/juneau/transform/BeanTransform.java | 526 --------------
.../juneau/transform/InterfaceBeanFilter.java | 39 ++
.../transform/InterfaceBeanTransform.java | 39 --
.../org/apache/juneau/transform/PojoSwap.java | 265 +++++++
.../apache/juneau/transform/PojoTransform.java | 265 -------
.../apache/juneau/transform/SurrogateSwap.java | 207 ++++++
.../juneau/transform/SurrogateTransform.java | 207 ------
.../org/apache/juneau/transform/Transform.java | 14 +-
.../org/apache/juneau/transform/package.html | 136 ++--
.../juneau/transforms/BeanStringSwap.java | 39 ++
.../juneau/transforms/BeanStringTransform.java | 39 --
.../juneau/transforms/ByteArrayBase64Swap.java | 51 ++
.../transforms/ByteArrayBase64Transform.java | 51 --
.../juneau/transforms/CalendarLongSwap.java | 54 ++
.../transforms/CalendarLongTransform.java | 54 --
.../juneau/transforms/CalendarMapSwap.java | 62 ++
.../juneau/transforms/CalendarMapTransform.java | 62 --
.../apache/juneau/transforms/CalendarSwap.java | 293 ++++++++
.../juneau/transforms/CalendarTransform.java | 293 --------
.../apache/juneau/transforms/DateLongSwap.java | 52 ++
.../juneau/transforms/DateLongTransform.java | 52 --
.../apache/juneau/transforms/DateMapSwap.java | 56 ++
.../juneau/transforms/DateMapTransform.java | 56 --
.../org/apache/juneau/transforms/DateSwap.java | 370 ++++++++++
.../apache/juneau/transforms/DateTransform.java | 370 ----------
.../juneau/transforms/EnumerationSwap.java | 39 ++
.../juneau/transforms/EnumerationTransform.java | 39 --
.../apache/juneau/transforms/IteratorSwap.java | 39 ++
.../juneau/transforms/IteratorTransform.java | 39 --
.../apache/juneau/transforms/ReaderSwap.java | 112 +++
.../juneau/transforms/ReaderTransform.java | 112 ---
.../transforms/XMLGregorianCalendarSwap.java | 64 ++
.../XMLGregorianCalendarTransform.java | 64 --
.../apache/juneau/urlencoding/UonParser.java | 4 +-
.../juneau/urlencoding/UonSerializer.java | 4 +-
.../juneau/urlencoding/UrlEncodingParser.java | 4 +-
.../urlencoding/UrlEncodingSerializer.java | 4 +-
.../org/apache/juneau/urlencoding/package.html | 8 +-
.../java/org/apache/juneau/xml/XmlParser.java | 4 +-
.../org/apache/juneau/xml/XmlSerializer.java | 4 +-
.../java/org/apache/juneau/xml/package.html | 6 +-
juneau-core/src/main/java/overview.html | 108 +--
.../java/org/apache/juneau/BeanConfigTest.java | 28 +-
.../java/org/apache/juneau/BeanFilterTest.java | 145 ++++
.../java/org/apache/juneau/BeanMapTest.java | 4 +-
.../org/apache/juneau/BeanTransformTest.java | 145 ----
.../java/org/apache/juneau/ClassMetaTest.java | 160 ++---
.../org/apache/juneau/DataConversionTest.java | 2 +-
.../java/org/apache/juneau/PojoSwapTest.java | 57 ++
.../org/apache/juneau/PojoTransformTest.java | 57 --
.../test/java/org/apache/juneau/TestUtils.java | 4 +-
.../juneau/a/rttests/RoundTripBeanMapsTest.java | 70 +-
.../juneau/a/rttests/RoundTripMapsTest.java | 6 +-
.../a/rttests/RoundTripTransformBeansTest.java | 42 +-
.../java/org/apache/juneau/html/HtmlTest.java | 16 +-
.../org/apache/juneau/jena/RdfParserTest.java | 4 +-
.../juneau/transforms/BeanFilterTest.java | 205 ++++++
.../apache/juneau/transforms/BeanMapTest.java | 14 +-
.../juneau/transforms/BeanTransformTest.java | 205 ------
.../transforms/ByteArrayBase64SwapTest.java | 172 +++++
.../ByteArrayBase64TransformTest.java | 172 -----
.../juneau/transforms/CalendarSwapTest.java | 697 +++++++++++++++++++
.../transforms/CalendarTransformTest.java | 697 -------------------
.../juneau/transforms/DateFilterTest.java | 20 +-
.../juneau/transforms/EnumerationSwapTest.java | 36 +
.../transforms/EnumerationTransformTest.java | 36 -
.../juneau/transforms/IteratorSwapTest.java | 38 +
.../transforms/IteratorTransformTest.java | 38 -
.../juneau/transforms/ReaderFilterTest.java | 4 +-
.../org/apache/juneau/utils/PojoQueryTest.java | 4 +-
.../apache/juneau/utils/StringUtilsTest.java | 2 +-
.../resources/DirectoryResource.java | 2 +-
.../microservice/resources/LogsResource.java | 6 +-
.../samples/addressbook/CreatePerson.java | 2 +-
.../juneau/samples/addressbook/Person.java | 2 +-
.../server/samples/RequestEchoResource.java | 2 +-
.../server/samples/UrlEncodedFormResource.java | 2 +-
.../addressbook/AddressBookResource.java | 6 +-
.../server/samples/AddressBookResourceTest.java | 6 +-
.../SampleRemoteableServicesResourceTest.java | 2 +-
.../apache/juneau/server/samples/TestUtils.java | 4 +-
juneau-server-test/.classpath | 79 +--
.../server/TestBeanContextProperties.java | 6 +-
.../apache/juneau/server/TestInheritance.java | 18 +-
.../org/apache/juneau/server/TestMessages.java | 6 +-
.../org/apache/juneau/server/TestParams.java | 2 +-
.../apache/juneau/server/TestTransforms.java | 44 +-
.../juneau/server/TestTransformsParent.java | 2 +-
.../juneau/server/TestClientVersionTest.java | 14 +-
.../org/apache/juneau/server/TestUtils.java | 2 +-
.../org/apache/juneau/server/RestServlet.java | 6 +-
.../juneau/server/annotation/RestMethod.java | 2 +-
.../juneau/server/annotation/RestResource.java | 2 +-
.../server/converters/Introspectable.java | 4 +-
.../juneau/server/converters/Queryable.java | 4 +-
.../juneau/server/converters/Traversable.java | 4 +-
.../juneau/server/jaxrs/JuneauProvider.java | 2 +-
.../java/org/apache/juneau/server/package.html | 18 +-
140 files changed, 4390 insertions(+), 4389 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/0ce0e663/juneau-client/src/main/java/org/apache/juneau/client/package.html
----------------------------------------------------------------------
diff --git a/juneau-client/src/main/java/org/apache/juneau/client/package.html b/juneau-client/src/main/java/org/apache/juneau/client/package.html
index c5d2478..7fb2581 100755
--- a/juneau-client/src/main/java/org/apache/juneau/client/package.html
+++ b/juneau-client/src/main/java/org/apache/juneau/client/package.html
@@ -185,7 +185,7 @@
.getResponse(Boolean.<jk>class</jk>);
<jc>// GET request, getting a filtered object</jc>
- client.getParser().addTransforms(CalendarTransform.<jsf>ISO8601</jsf>.<jk>class</jk>);
+ client.getParser().addTransforms(CalendarSwap.<jsf>ISO8601</jsf>.<jk>class</jk>);
Calendar birthDate = client.doGet(<js>"http://localhost:9080/sample/addressBook/0/birthDate"</js>)
.getResponse(GregorianCalendar.<jk>class</jk>);
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/0ce0e663/juneau-core/src/main/java/org/apache/juneau/BeanContext.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/BeanContext.java b/juneau-core/src/main/java/org/apache/juneau/BeanContext.java
index 9027d57..f32e46e 100644
--- a/juneau-core/src/main/java/org/apache/juneau/BeanContext.java
+++ b/juneau-core/src/main/java/org/apache/juneau/BeanContext.java
@@ -164,10 +164,10 @@ import org.apache.juneau.transform.Transform;
* {@link Transform Transforms} are used to tailor how beans and non-beans are handled.<br>
* There are two subclasses of transforms:
* <ol class='spaced-list'>
- * <li>{@link BeanTransform} - Allows you to tailor handling of bean classes.
+ * <li>{@link BeanFilter} - Allows you to tailor handling of bean classes.
* This class can be considered a programmatic equivalent to the {@link Bean} annotation when
* annotating classes are not possible (e.g. you don't have access to the source).
- * <li>{@link PojoTransform} - Allows you to convert objects to serializable forms.
+ * <li>{@link PojoSwap} - Allows you to convert objects to serializable forms.
* </ol>
* <p>
* See {@link org.apache.juneau.transform} for more information.
@@ -396,14 +396,14 @@ public class BeanContext extends Context {
* <p>
* There are two category of classes that can be passed in through this method:
* <ul class='spaced-list'>
- * <li>Subclasses of {@link PojoTransform} and {@link BeanTransform}.
+ * <li>Subclasses of {@link PojoSwap} and {@link BeanFilter}.
* <li>Any other class.
* </ul>
* <p>
* When <code>Transform</code> classes are specified, they identify objects that need to be
* transformed into some other type during serialization (and optionally the reverse during parsing).
* <p>
- * When non-<code>Transform</code> classes are specified, they are wrapped inside {@link BeanTransform BeanTransforms}.
+ * When non-<code>Transform</code> classes are specified, they are wrapped inside {@link BeanFilter BeanFilters}.
* For example, if you have an interface <code>IFoo</code> and a subclass <code>Foo</code>, and you
* only want properties defined on <code>IFoo</code> to be visible as bean properties for <code>Foo</code> objects,
* you can simply pass in <code>IFoo.<jk>class</jk></code> to this method.
@@ -512,8 +512,8 @@ public class BeanContext extends Context {
final Class<?>[] notBeanClasses;
final String[] notBeanPackageNames, notBeanPackagePrefixes;
- final BeanTransform<?>[] beanTransforms;
- final PojoTransform<?,?>[] pojoTransforms;
+ final BeanFilter<?>[] beanFilters;
+ final PojoSwap<?,?>[] pojoSwaps;
final Map<Class<?>,Class<?>> implClasses;
final Class<?>[] implKeyClasses, implValueClasses;
final ClassLoader classLoader;
@@ -578,17 +578,17 @@ public class BeanContext extends Context {
notBeanPackageNames = l1.toArray(new String[l1.size()]);
notBeanPackagePrefixes = l2.toArray(new String[l2.size()]);
- LinkedList<BeanTransform<?>> lbf = new LinkedList<BeanTransform<?>>();
- LinkedList<PojoTransform<?,?>> lpf = new LinkedList<PojoTransform<?,?>>();
+ LinkedList<BeanFilter<?>> lbf = new LinkedList<BeanFilter<?>>();
+ LinkedList<PojoSwap<?,?>> lpf = new LinkedList<PojoSwap<?,?>>();
for (Class<?> c : pm.get(BEAN_transforms, Class[].class, new Class[0])) {
if (isParentClass(Transform.class, c)) {
try {
- if (isParentClass(BeanTransform.class, c)) {
- BeanTransform<?> f = (BeanTransform<?>)c.newInstance();
+ if (isParentClass(BeanFilter.class, c)) {
+ BeanFilter<?> f = (BeanFilter<?>)c.newInstance();
//f.setBeanContext(this);
lbf.add(f);
- } else if (isParentClass(PojoTransform.class, c)) {
- PojoTransform<?,?> f = (PojoTransform<?,?>)c.newInstance();
+ } else if (isParentClass(PojoSwap.class, c)) {
+ PojoSwap<?,?> f = (PojoSwap<?,?>)c.newInstance();
f.setBeanContext(this);
lpf.add(f);
}
@@ -597,22 +597,22 @@ public class BeanContext extends Context {
}
} else {
if (! c.getClass().isInterface()) {
- List<SurrogateTransform<?,?>> l = SurrogateTransform.findTransforms(c);
+ List<SurrogateSwap<?,?>> l = SurrogateSwap.findTransforms(c);
if (! l.isEmpty()) {
- for (SurrogateTransform<?,?> f : l) {
+ for (SurrogateSwap<?,?> f : l) {
f.setBeanContext(this);
lpf.add(f);
}
continue;
}
}
- BeanTransform<?> f = new InterfaceBeanTransform(c);
+ BeanFilter<?> f = new InterfaceBeanFilter(c);
f.setBeanContext(this);
lbf.add(f);
}
}
- beanTransforms = lbf.toArray(new BeanTransform[0]);
- pojoTransforms = lpf.toArray(new PojoTransform[0]);
+ beanFilters = lbf.toArray(new BeanFilter[0]);
+ pojoSwaps = lpf.toArray(new PojoSwap[0]);
implClasses = new TreeMap<Class<?>,Class<?>>(new ClassComparator());
Map<Class,Class> m = pm.getMap(BEAN_implClasses, Class.class, Class.class, null);
@@ -872,7 +872,7 @@ public class BeanContext extends Context {
T o = (T)m.newBean(outer);
if (o == null) {
// Beans with subtypes won't be instantiated until the sub type property is specified.
- if (cm.beanTransform != null && cm.beanTransform.getSubTypeProperty() != null)
+ if (cm.beanFilter != null && cm.beanFilter.getSubTypeProperty() != null)
return null;
throw new BeanRuntimeException(c, "Class does not have a no-arg constructor.");
}
@@ -942,8 +942,8 @@ public class BeanContext extends Context {
// If this is an array, then we want it wrapped in an uncached ClassMeta object.
// Note that if it has a pojo transform, we still want to cache it so that
- // we can cache something like byte[] with ByteArrayBase64Transform.
- if (c.isArray() && findPojoTransform(c) == null)
+ // we can cache something like byte[] with ByteArrayBase64Swap.
+ if (c.isArray() && findPojoSwap(c) == null)
return new ClassMeta(c, this);
// This can happen if we have transforms defined against String or Object.
@@ -1410,46 +1410,46 @@ public class BeanContext extends Context {
}
/**
- * Returns the {@link PojoTransform} associated with the specified class, or <jk>null</jk> if there is no
+ * Returns the {@link PojoSwap} associated with the specified class, or <jk>null</jk> if there is no
* pojo transform associated with the class.
*
* @param <T> The class associated with the transform.
* @param c The class associated with the transform.
* @return The transform associated with the class, or null if there is no association.
*/
- protected <T> PojoTransform findPojoTransform(Class<T> c) {
+ protected <T> PojoSwap findPojoSwap(Class<T> c) {
// Note: On first
if (c != null)
- for (PojoTransform f : pojoTransforms)
+ for (PojoSwap f : pojoSwaps)
if (isParentClass(f.forClass(), c))
return f;
return null;
}
/**
- * Checks whether a class has a {@link PojoTransform} associated with it in this bean context.
+ * Checks whether a class has a {@link PojoSwap} associated with it in this bean context.
* @param c The class to check.
- * @return <jk>true</jk> if the specified class or one of its subclasses has a {@link PojoTransform} associated with it.
+ * @return <jk>true</jk> if the specified class or one of its subclasses has a {@link PojoSwap} associated with it.
*/
- protected boolean hasChildPojoTransforms(Class<?> c) {
+ protected boolean hasChildPojoSwaps(Class<?> c) {
if (c != null)
- for (PojoTransform f : pojoTransforms)
+ for (PojoSwap f : pojoSwaps)
if (isParentClass(c, f.forClass()))
return true;
return false;
}
/**
- * Returns the {@link BeanTransform} associated with the specified class, or <jk>null</jk> if there is no
- * bean transform associated with the class.
+ * Returns the {@link BeanFilter} associated with the specified class, or <jk>null</jk> if there is no
+ * bean filter associated with the class.
*
* @param <T> The class associated with the transform.
* @param c The class associated with the transform.
* @return The transform associated with the class, or null if there is no association.
*/
- protected <T> BeanTransform findBeanTransform(Class<T> c) {
+ protected <T> BeanFilter findBeanFilter(Class<T> c) {
if (c != null)
- for (BeanTransform f : beanTransforms)
+ for (BeanFilter f : beanFilters)
if (isParentClass(f.forClass(), c))
return f;
return null;
@@ -1569,19 +1569,19 @@ public class BeanContext extends Context {
* <tr><th>Convert to type</th><th>Valid input value types</th><th>Notes</th></tr>
* <tr>
* <td>
- * A class that is the normal type of a registered {@link PojoTransform}.
+ * A class that is the normal type of a registered {@link PojoSwap}.
* </td>
* <td>
- * A value whose class matches the transformed type of that registered {@link PojoTransform}.
+ * A value whose class matches the transformed type of that registered {@link PojoSwap}.
* </td>
* <td> </td>
* </tr>
* <tr>
* <td>
- * A class that is the transformed type of a registered {@link PojoTransform}.
+ * A class that is the transformed type of a registered {@link PojoSwap}.
* </td>
* <td>
- * A value whose class matches the normal type of that registered {@link PojoTransform}.
+ * A value whose class matches the normal type of that registered {@link PojoSwap}.
* </td>
* <td> </td>
* </tr>
@@ -1734,19 +1734,19 @@ public class BeanContext extends Context {
if (tc == Class.class)
return (T)(classLoader.loadClass(value.toString()));
- if (type.getPojoTransform() != null) {
- PojoTransform f = type.getPojoTransform();
+ if (type.getPojoSwap() != null) {
+ PojoSwap f = type.getPojoSwap();
Class<?> nc = f.getNormalClass(), fc = f.getTransformedClass();
if (isParentClass(nc, tc) && isParentClass(fc, value.getClass()))
- return (T)f.normalize(value, type);
+ return (T)f.unswap(value, type);
}
ClassMeta<?> vt = getClassMetaForObject(value);
- if (vt.getPojoTransform() != null) {
- PojoTransform f = vt.getPojoTransform();
+ if (vt.getPojoSwap() != null) {
+ PojoSwap f = vt.getPojoSwap();
Class<?> nc = f.getNormalClass(), fc = f.getTransformedClass();
if (isParentClass(nc, vt.getInnerClass()) && isParentClass(fc, tc))
- return (T)f.transform(value);
+ return (T)f.swap(value);
}
if (type.isPrimitive()) {
@@ -2055,8 +2055,8 @@ public class BeanContext extends Context {
.append("ignoreInvocationExceptionsOnGetters", ignoreInvocationExceptionsOnGetters)
.append("ignoreInvocationExceptionsOnSetters", ignoreInvocationExceptionsOnSetters)
.append("useJavaBeanIntrospector", useJavaBeanIntrospector)
- .append("beanTransforms", beanTransforms)
- .append("pojoTransforms", pojoTransforms)
+ .append("beanFilters", beanFilters)
+ .append("pojoSwaps", pojoSwaps)
.append("notBeanClasses", notBeanClasses)
.append("implClasses", implClasses)
.append("sortProperties", sortProperties);
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/0ce0e663/juneau-core/src/main/java/org/apache/juneau/BeanMap.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/BeanMap.java b/juneau-core/src/main/java/org/apache/juneau/BeanMap.java
index 6150526..d796367 100644
--- a/juneau-core/src/main/java/org/apache/juneau/BeanMap.java
+++ b/juneau-core/src/main/java/org/apache/juneau/BeanMap.java
@@ -42,12 +42,12 @@ import org.apache.juneau.xml.annotation.*;
* by the {@link java.beans.BeanInfo} class (i.e. ordered by definition in the class).
* </ul>
* <br>
- * The order can also be overridden through the use of a {@link BeanTransform}.
+ * The order can also be overridden through the use of a {@link BeanFilter}.
*
*
- * <h6 class='topic'>POJO transforms</h6>
+ * <h6 class='topic'>POJO swaps</h6>
* <p>
- * If {@link PojoTransform PojoTransforms} are defined on the class types of the properties of this bean or the bean properties themselves, the
+ * If {@link PojoSwap PojoSwaps} are defined on the class types of the properties of this bean or the bean properties themselves, the
* {@link #get(Object)} and {@link #put(String, Object)} methods will automatically
* transform the property value to and from the serialized form.
*
@@ -178,10 +178,10 @@ public class BeanMap<T> extends AbstractMap<String,Object> implements Delegate<T
/**
* Sets a property on the bean.
* <p>
- * If there is a {@link PojoTransform} associated with this bean property or bean property type class, then
+ * If there is a {@link PojoSwap} associated with this bean property or bean property type class, then
* you must pass in a transformed value.
* For example, if the bean property type class is a {@link Date} and the bean property has the
- * {@link org.apache.juneau.transforms.DateTransform.ISO8601DT} transform associated with it through the
+ * {@link org.apache.juneau.transforms.DateSwap.ISO8601DT} transform associated with it through the
* {@link BeanProperty#transform() @BeanProperty.transform()} annotation, the value being passed in must be
* a String containing an ISO8601 date-time string value.
*
@@ -193,7 +193,7 @@ public class BeanMap<T> extends AbstractMap<String,Object> implements Delegate<T
* Person p = <jk>new</jk> Person();
*
* <jc>// Create a bean context and add the ISO8601 date-time transform</jc>
- * BeanContext beanContext = <jk>new</jk> BeanContext().addTransform(DateTransform.ISO8601DT.<jk>class</jk>);
+ * BeanContext beanContext = <jk>new</jk> BeanContext().addTransform(DateSwap.ISO8601DT.<jk>class</jk>);
*
* <jc>// Wrap our bean in a bean map</jc>
* BeanMap<Person> b = beanContext.forBean(p);
@@ -264,10 +264,10 @@ public class BeanMap<T> extends AbstractMap<String,Object> implements Delegate<T
/**
* Gets a property on the bean.
* <p>
- * If there is a {@link PojoTransform} associated with this bean property or bean property type class, then
+ * If there is a {@link PojoSwap} associated with this bean property or bean property type class, then
* this method will return the transformed value.
* For example, if the bean property type class is a {@link Date} and the bean property has the
- * {@link org.apache.juneau.transforms.DateTransform.ISO8601DT} transform associated with it through the
+ * {@link org.apache.juneau.transforms.DateSwap.ISO8601DT} transform associated with it through the
* {@link BeanProperty#transform() @BeanProperty.transform()} annotation, this method will return a String
* containing an ISO8601 date-time string value.
*
@@ -280,7 +280,7 @@ public class BeanMap<T> extends AbstractMap<String,Object> implements Delegate<T
* p.setBirthDate(<jk>new</jk> Date(1, 2, 3, 4, 5, 6));
*
* <jc>// Create a bean context and add the ISO8601 date-time transform</jc>
- * BeanContext beanContext = <jk>new</jk> BeanContext().addTransform(DateTransform.ISO8601DT.<jk>class</jk>);
+ * BeanContext beanContext = <jk>new</jk> BeanContext().addTransform(DateSwap.ISO8601DT.<jk>class</jk>);
*
* <jc>// Wrap our bean in a bean map</jc>
* BeanMap<Person> b = beanContext.forBean(p);
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/0ce0e663/juneau-core/src/main/java/org/apache/juneau/BeanMapEntry.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/BeanMapEntry.java b/juneau-core/src/main/java/org/apache/juneau/BeanMapEntry.java
index 7e6910d..67b949f 100644
--- a/juneau-core/src/main/java/org/apache/juneau/BeanMapEntry.java
+++ b/juneau-core/src/main/java/org/apache/juneau/BeanMapEntry.java
@@ -36,7 +36,7 @@ import org.apache.juneau.transform.*;
* <jc>// Set the property value</jc>
* birthDate.setValue(<jk>new</jk> Date(1, 2, 3, 4, 5, 6));
*
- * <jc>// Or if the DateTransform.DEFAULT_ISO8601DT is registered with the bean context, set a transformed value</jc>
+ * <jc>// Or if the DateSwap.DEFAULT_ISO8601DT is registered with the bean context, set a transformed value</jc>
* birthDate.setValue(<js>"'1901-03-03T04:05:06-5000'"</js>);
* </p>
*
@@ -65,10 +65,10 @@ public class BeanMapEntry implements Map.Entry<String,Object> {
/**
* Returns the value of this property.
* <p>
- * If there is a {@link PojoTransform} associated with this bean property or bean property type class, then
+ * If there is a {@link PojoSwap} associated with this bean property or bean property type class, then
* this method will return the transformed value.
* For example, if the bean property type class is a {@link Date} and the bean property has the
- * {@link org.apache.juneau.transforms.DateTransform.ISO8601DT} transform associated with it through the
+ * {@link org.apache.juneau.transforms.DateSwap.ISO8601DT} transform associated with it through the
* {@link BeanProperty#transform() @BeanProperty.transform()} annotation, this method will return a String
* containing an ISO8601 date-time string value.
*/
@@ -84,10 +84,10 @@ public class BeanMapEntry implements Map.Entry<String,Object> {
* <p>
* If the property is a bean type {@code X}, then the value can either be an {@code X} or a {@code Map}.
* <p>
- * If there is a {@link PojoTransform} associated with this bean property or bean property type class, then
+ * If there is a {@link PojoSwap} associated with this bean property or bean property type class, then
* you must pass in a transformed value.
* For example, if the bean property type class is a {@link Date} and the bean property has the
- * {@link org.apache.juneau.transforms.DateTransform.ISO8601DT} transform associated with it through the
+ * {@link org.apache.juneau.transforms.DateSwap.ISO8601DT} transform associated with it through the
* {@link BeanProperty#transform() @BeanProperty.transform()} annotation, the value being passed in must be
* a String containing an ISO8601 date-time string value.
*
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/0ce0e663/juneau-core/src/main/java/org/apache/juneau/BeanMeta.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/BeanMeta.java b/juneau-core/src/main/java/org/apache/juneau/BeanMeta.java
index 1eb9123..78f72a3 100644
--- a/juneau-core/src/main/java/org/apache/juneau/BeanMeta.java
+++ b/juneau-core/src/main/java/org/apache/juneau/BeanMeta.java
@@ -34,7 +34,7 @@ import org.apache.juneau.utils.*;
* <h6 class='topic'>Description</h6>
* <p>
* Uses introspection to find all the properties associated with this class. If the {@link Bean @Bean} annotation
- * is present on the class, or the class has a {@link BeanTransform} registered with it in the bean context,
+ * is present on the class, or the class has a {@link BeanFilter} registered with it in the bean context,
* then that information is used to determine the properties on the class.
* Otherwise, the {@code BeanInfo} functionality in Java is used to determine the properties on the class.
*
@@ -52,7 +52,7 @@ import org.apache.juneau.utils.*;
* </ul>
* </ul>
* <br>
- * The order can also be overridden through the use of an {@link BeanTransform}.
+ * The order can also be overridden through the use of an {@link BeanFilter}.
*
*
* @param <T> The class type that this metadata applies to.
@@ -79,8 +79,8 @@ public class BeanMeta<T> {
/** The bean context that created this metadata object. */
protected BeanContext ctx;
- /** Optional bean transform associated with the target class. */
- protected BeanTransform<? extends T> transform;
+ /** Optional bean filter associated with the target class. */
+ protected BeanFilter<? extends T> transform;
/** Type variables implemented by this bean. */
protected Map<Class<?>,Class<?>[]> typeVarImpls;
@@ -106,9 +106,9 @@ public class BeanMeta<T> {
*
* @param classMeta The target class.
* @param ctx The bean context that created this object.
- * @param transform Optional bean transform associated with the target class. Can be <jk>null</jk>.
+ * @param transform Optional bean filter associated with the target class. Can be <jk>null</jk>.
*/
- protected BeanMeta(final ClassMeta<T> classMeta, BeanContext ctx, org.apache.juneau.transform.BeanTransform<? extends T> transform) {
+ protected BeanMeta(final ClassMeta<T> classMeta, BeanContext ctx, org.apache.juneau.transform.BeanFilter<? extends T> transform) {
this.classMeta = classMeta;
this.ctx = ctx;
this.transform = transform;
@@ -325,14 +325,14 @@ public class BeanMeta<T> {
// If a transform is defined, look for inclusion and exclusion lists.
if (transform != null) {
- // Eliminated excluded properties if BeanTransform.excludeKeys is specified.
+ // Eliminated excluded properties if BeanFilter.excludeKeys is specified.
String[] includeKeys = transform.getProperties();
String[] excludeKeys = transform.getExcludeProperties();
if (excludeKeys != null) {
for (String k : excludeKeys)
properties.remove(k);
- // Only include specified properties if BeanTransform.includeKeys is specified.
+ // Only include specified properties if BeanFilter.includeKeys is specified.
// Note that the order must match includeKeys.
} else if (includeKeys != null) {
Map<String,BeanPropertyMeta> properties2 = new LinkedHashMap<String,BeanPropertyMeta>();
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/0ce0e663/juneau-core/src/main/java/org/apache/juneau/BeanPropertyMeta.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/BeanPropertyMeta.java b/juneau-core/src/main/java/org/apache/juneau/BeanPropertyMeta.java
index 1cdd8ea..e017939 100644
--- a/juneau-core/src/main/java/org/apache/juneau/BeanPropertyMeta.java
+++ b/juneau-core/src/main/java/org/apache/juneau/BeanPropertyMeta.java
@@ -55,7 +55,7 @@ public class BeanPropertyMeta {
rawTypeMeta, // The real class type of the bean property.
typeMeta; // The transformed class type of the bean property.
private String[] properties;
- private PojoTransform transform; // PojoTransform defined only via @BeanProperty annotation.
+ private PojoSwap transform; // PojoSwap defined only via @BeanProperty annotation.
private MetadataMap extMeta = new MetadataMap(); // Extended metadata
@@ -130,7 +130,7 @@ public class BeanPropertyMeta {
/**
* Returns the {@link ClassMeta} of the class of this property.
* <p>
- * If this property or the property type class has a {@link PojoTransform} associated with it, this
+ * If this property or the property type class has a {@link PojoSwap} associated with it, this
* method returns the transformed class meta.
* This matches the class type that is used by the {@link #get(BeanMap)} and {@link #set(BeanMap, Object)} methods.
*
@@ -249,7 +249,7 @@ public class BeanPropertyMeta {
rawTypeMeta = f.getClassMeta(p, field.getGenericType(), typeVarImpls);
isUri |= (rawTypeMeta.isUri() || field.isAnnotationPresent(org.apache.juneau.annotation.URI.class));
if (p != null) {
- transform = getPropertyPojoTransform(p);
+ transform = getPropertyPojoSwap(p);
if (p.properties().length != 0)
properties = p.properties();
isBeanUri |= p.beanUri();
@@ -263,7 +263,7 @@ public class BeanPropertyMeta {
isUri |= (rawTypeMeta.isUri() || getter.isAnnotationPresent(org.apache.juneau.annotation.URI.class));
if (p != null) {
if (transform == null)
- transform = getPropertyPojoTransform(p);
+ transform = getPropertyPojoSwap(p);
if (properties != null && p.properties().length != 0)
properties = p.properties();
isBeanUri |= p.beanUri();
@@ -277,7 +277,7 @@ public class BeanPropertyMeta {
isUri |= (rawTypeMeta.isUri() || setter.isAnnotationPresent(org.apache.juneau.annotation.URI.class));
if (p != null) {
if (transform == null)
- transform = getPropertyPojoTransform(p);
+ transform = getPropertyPojoSwap(p);
if (properties != null && p.properties().length != 0)
properties = p.properties();
isBeanUri |= p.beanUri();
@@ -299,16 +299,16 @@ public class BeanPropertyMeta {
return true;
}
- private PojoTransform getPropertyPojoTransform(BeanProperty p) throws Exception {
- Class<? extends PojoTransform> c = p.transform();
- if (c == PojoTransform.NULL.class)
+ private PojoSwap getPropertyPojoSwap(BeanProperty p) throws Exception {
+ Class<? extends PojoSwap> c = p.transform();
+ if (c == PojoSwap.NULL.class)
return null;
try {
- PojoTransform f = c.newInstance();
+ PojoSwap f = c.newInstance();
f.setBeanContext(this.beanMeta.ctx);
return f;
} catch (Exception e) {
- throw new BeanRuntimeException(this.beanMeta.c, "Could not instantiate PojoTransform ''{0}'' for bean property ''{1}''", c.getName(), this.name).initCause(e);
+ throw new BeanRuntimeException(this.beanMeta.c, "Could not instantiate PojoSwap ''{0}'' for bean property ''{1}''", c.getName(), this.name).initCause(e);
}
}
@@ -383,7 +383,7 @@ public class BeanPropertyMeta {
public Object set(BeanMap<?> m, Object value) throws BeanRuntimeException {
try {
// Comvert to raw form.
- value = normalize(value);
+ value = unswap(value);
BeanContext bc = this.beanMeta.ctx;
if (m.bean == null) {
@@ -549,7 +549,7 @@ public class BeanPropertyMeta {
} else {
if (transform != null && value != null && isParentClass(transform.getTransformedClass(), value.getClass())) {
- value = transform.normalize(value, rawTypeMeta);
+ value = transform.unswap(value, rawTypeMeta);
} else {
value = beanMeta.ctx.convertToType(value, rawTypeMeta);
}
@@ -721,31 +721,31 @@ public class BeanPropertyMeta {
private Object transform(Object o) throws SerializeException {
// First use transform defined via @BeanProperty.
if (transform != null)
- return transform.transform(o);
+ return transform.swap(o);
if (o == null)
return null;
// Otherwise, look it up via bean context.
- if (rawTypeMeta.hasChildPojoTransforms()) {
+ if (rawTypeMeta.hasChildPojoSwaps()) {
Class c = o.getClass();
ClassMeta<?> cm = rawTypeMeta.innerClass == c ? rawTypeMeta : beanMeta.ctx.getClassMeta(c);
- PojoTransform f = cm.getPojoTransform();
+ PojoSwap f = cm.getPojoSwap();
if (f != null)
- return f.transform(o);
+ return f.swap(o);
}
return o;
}
- private Object normalize(Object o) throws ParseException {
+ private Object unswap(Object o) throws ParseException {
if (transform != null)
- return transform.normalize(o, rawTypeMeta);
+ return transform.unswap(o, rawTypeMeta);
if (o == null)
return null;
- if (rawTypeMeta.hasChildPojoTransforms()) {
+ if (rawTypeMeta.hasChildPojoSwaps()) {
Class c = o.getClass();
ClassMeta<?> cm = rawTypeMeta.innerClass == c ? rawTypeMeta : beanMeta.ctx.getClassMeta(c);
- PojoTransform f = cm.getPojoTransform();
+ PojoSwap f = cm.getPojoSwap();
if (f != null)
- return f.normalize(o, rawTypeMeta);
+ return f.unswap(o, rawTypeMeta);
}
return o;
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/0ce0e663/juneau-core/src/main/java/org/apache/juneau/ClassMeta.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/ClassMeta.java b/juneau-core/src/main/java/org/apache/juneau/ClassMeta.java
index f49b7ad..b4af534 100644
--- a/juneau-core/src/main/java/org/apache/juneau/ClassMeta.java
+++ b/juneau-core/src/main/java/org/apache/juneau/ClassMeta.java
@@ -76,8 +76,8 @@ public final class ClassMeta<T> implements Type {
Method namePropertyMethod; // The method to set the name on an object (if it has one).
Method parentPropertyMethod; // The method to set the parent on an object (if it has one).
String notABeanReason; // If this isn't a bean, the reason why.
- PojoTransform<T,?> pojoTransform; // The object transform associated with this bean (if it has one).
- BeanTransform<? extends T> beanTransform; // The bean transform associated with this bean (if it has one).
+ PojoSwap<T,?> pojoSwap; // The object transform associated with this bean (if it has one).
+ BeanFilter<? extends T> beanFilter; // The bean filter associated with this bean (if it has one).
boolean
isDelegate, // True if this class extends Delegate.
isAbstract, // True if this class is abstract.
@@ -86,7 +86,7 @@ public final class ClassMeta<T> implements Type {
private MetadataMap extMeta = new MetadataMap(); // Extended metadata
private Throwable initException; // Any exceptions thrown in the init() method.
- private boolean hasChildPojoTransforms; // True if this class or any subclass of this class has a PojoTransform associated with it.
+ private boolean hasChildPojoSwaps; // True if this class or any subclass of this class has a PojoSwap associated with it.
private Object primitiveDefault; // Default value for primitive type classes.
private Map<String,Method> remoteableMethods, // Methods annotated with @Remoteable. Contains all public methods if class is annotated with @Remotable.
publicMethods; // All public methods, including static methods.
@@ -130,10 +130,10 @@ public final class ClassMeta<T> implements Type {
Transform transform = findTransform(beanContext);
if (transform != null) {
if (transform.getType() == Transform.TransformType.BEAN)
- beanTransform = (BeanTransform)transform;
+ beanFilter = (BeanFilter)transform;
else
- pojoTransform = (PojoTransform)transform;
- transformedClassMeta = (pojoTransform == null ? this : beanContext.getClassMeta(pojoTransform.getTransformedClass()));
+ pojoSwap = (PojoSwap)transform;
+ transformedClassMeta = (pojoSwap == null ? this : beanContext.getClassMeta(pojoSwap.getTransformedClass()));
}
if (transformedClassMeta == null)
transformedClassMeta = this;
@@ -144,7 +144,7 @@ public final class ClassMeta<T> implements Type {
noArgConstructor = findNoArgConstructor(innerClass, Visibility.PUBLIC);
}
- this.hasChildPojoTransforms = beanContext.hasChildPojoTransforms(innerClass);
+ this.hasChildPojoSwaps = beanContext.hasChildPojoSwaps(innerClass);
Class c = innerClass;
@@ -305,7 +305,7 @@ public final class ClassMeta<T> implements Type {
// Note that this needs to be done after all other initialization has been done.
else if (classCategory == UNKNOWN) {
- BeanMeta newMeta = new BeanMeta(this, beanContext, beanTransform);
+ BeanMeta newMeta = new BeanMeta(this, beanContext, beanFilter);
try {
notABeanReason = newMeta.init();
} catch (RuntimeException e) {
@@ -399,12 +399,12 @@ public final class ClassMeta<T> implements Type {
}
/**
- * Returns <jk>true</jk> if this class as subtypes defined through {@link Bean#subTypes} or {@link BeanTransform#getSubTypes()}.
+ * Returns <jk>true</jk> if this class as subtypes defined through {@link Bean#subTypes} or {@link BeanFilter#getSubTypes()}.
*
* @return <jk>true</jk> if this class has subtypes.
*/
public boolean hasSubTypes() {
- return beanTransform != null && beanTransform.getSubTypeProperty() != null;
+ return beanFilter != null && beanFilter.getSubTypeProperty() != null;
}
/**
@@ -418,15 +418,15 @@ public final class ClassMeta<T> implements Type {
}
/**
- * Returns <jk>true</jk> if this class or any child classes has a {@link PojoTransform} associated with it.
+ * Returns <jk>true</jk> if this class or any child classes has a {@link PojoSwap} associated with it.
* <p>
* Used when transforming bean properties to prevent having to look up transforms if we know for certain
* that no transforms are associated with a bean property.
*
- * @return <jk>true</jk> if this class or any child classes has a {@link PojoTransform} associated with it.
+ * @return <jk>true</jk> if this class or any child classes has a {@link PojoSwap} associated with it.
*/
- public boolean hasChildPojoTransforms() {
- return hasChildPojoTransforms;
+ public boolean hasChildPojoSwaps() {
+ return hasChildPojoSwaps;
}
private Transform findTransform(BeanContext context) {
@@ -442,15 +442,15 @@ public final class ClassMeta<T> implements Type {
}
if (context == null)
return null;
- Transform f = context.findBeanTransform(innerClass);
+ Transform f = context.findBeanFilter(innerClass);
if (f != null)
return f;
- f = context.findPojoTransform(innerClass);
+ f = context.findPojoSwap(innerClass);
if (f != null)
return f;
List<Bean> ba = ReflectionUtils.findAnnotations(Bean.class, innerClass);
if (! ba.isEmpty())
- f = new AnnotationBeanTransform<T>(innerClass, ba);
+ f = new AnnotationBeanFilter<T>(innerClass, ba);
return f;
} catch (Exception e) {
throw new RuntimeException(e);
@@ -524,7 +524,7 @@ public final class ClassMeta<T> implements Type {
}
/**
- * Returns the generalized form of this class if there is an {@link PojoTransform} associated with it.
+ * Returns the generalized form of this class if there is an {@link PojoSwap} associated with it.
*
* @return The transformed class type, or this object if no transform is associated with the class.
*/
@@ -803,13 +803,13 @@ public final class ClassMeta<T> implements Type {
}
/**
- * Returns the {@link PojoTransform} associated with this class.
+ * Returns the {@link PojoSwap} associated with this class.
*
- * @return The {@link PojoTransform} associated with this class, or <jk>null</jk> if there is no POJO transform
+ * @return The {@link PojoSwap} associated with this class, or <jk>null</jk> if there is no POJO swap
* associated with this class.
*/
- public PojoTransform<T,?> getPojoTransform() {
- return pojoTransform;
+ public PojoSwap<T,?> getPojoSwap() {
+ return pojoSwap;
}
/**
@@ -895,7 +895,7 @@ public final class ClassMeta<T> implements Type {
if (beanMeta == null)
return false;
// Beans with transforms with subtype properties are assumed to be constructable.
- if (beanTransform != null && beanTransform.getSubTypeProperty() != null)
+ if (beanFilter != null && beanFilter.getSubTypeProperty() != null)
return true;
if (beanMeta.constructor == null)
return false;
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/0ce0e663/juneau-core/src/main/java/org/apache/juneau/ContextFactory.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/ContextFactory.java b/juneau-core/src/main/java/org/apache/juneau/ContextFactory.java
index bc957ca..2c6ab81 100644
--- a/juneau-core/src/main/java/org/apache/juneau/ContextFactory.java
+++ b/juneau-core/src/main/java/org/apache/juneau/ContextFactory.java
@@ -127,7 +127,7 @@ import org.apache.juneau.parser.*;
* <p>
* Lists are appended to the beginning of the set so that behavior can be overridden.<br>
* <p>
- * For sample, the following code shows the order in which POJO transforms are applied.<br>
+ * For sample, the following code shows the order in which POJO swaps are applied.<br>
* In this case, we want F3 and F4 to appear at the beginning of the set so that they
* take precedence over F1 and F2....
* <p class='bcode'>
@@ -264,7 +264,7 @@ public final class ContextFactory extends Lockable {
private static Comparator<Object> PROPERTY_COMPARATOR = new Comparator<Object>() {
@Override
public int compare(Object o1, Object o2) {
- return normalize(o1).toString().compareTo(normalize(o2).toString());
+ return unswap(o1).toString().compareTo(unswap(o2).toString());
}
};
@@ -750,8 +750,8 @@ public final class ContextFactory extends Lockable {
*/
protected static class NormalizingHashCode extends HashCode {
@Override /* HashCode */
- protected Object normalize(Object o) {
- return ContextFactory.normalize(o);
+ protected Object unswap(Object o) {
+ return ContextFactory.unswap(o);
}
}
@@ -1202,7 +1202,7 @@ public final class ContextFactory extends Lockable {
* @param o The object to normalize.
* @return The normalized object.
*/
- private static final Object normalize(Object o) {
+ private static final Object unswap(Object o) {
if (o instanceof Class)
return ((Class<?>)o).getName();
if (o instanceof Number || o instanceof Boolean)
@@ -1247,7 +1247,7 @@ public final class ContextFactory extends Lockable {
}
return false;
} else {
- return normalize(o1).equals(normalize(o2));
+ return unswap(o1).equals(unswap(o2));
}
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/0ce0e663/juneau-core/src/main/java/org/apache/juneau/ObjectMap.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/ObjectMap.java b/juneau-core/src/main/java/org/apache/juneau/ObjectMap.java
index 7bbbc8c..507c827 100644
--- a/juneau-core/src/main/java/org/apache/juneau/ObjectMap.java
+++ b/juneau-core/src/main/java/org/apache/juneau/ObjectMap.java
@@ -356,12 +356,12 @@ public class ObjectMap extends LinkedHashMap<String,Object> {
* @throws ParseException Thrown by the transform if a problem occurred trying to parse the value.
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
- public <T> T get(PojoTransform<T,?> transform, String key) throws ParseException {
+ public <T> T get(PojoSwap<T,?> transform, String key) throws ParseException {
Object o = super.get(key);
if (o == null)
return null;
- PojoTransform f = transform;
- return (T)f.normalize(o, null);
+ PojoSwap f = transform;
+ return (T)f.unswap(o, null);
}
/**
@@ -1130,7 +1130,7 @@ public class ObjectMap extends LinkedHashMap<String,Object> {
* <p>
* It can also be converted to any type that can be handled by the {@link BeanContext#convertToType(Object, Class)} method.
* In this case, the value is specified by an <code>value</code> entry of any type.
- * For example, if the bean context has a {@link CalendarTransform} associated with it, it can convert a string value to a calendar.
+ * For example, if the bean context has a {@link CalendarSwap} associated with it, it can convert a string value to a calendar.
* <p class='bcode'>
* {
* _class: <js>'java.util.GregorianCalendar'</js>,
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/0ce0e663/juneau-core/src/main/java/org/apache/juneau/annotation/Bean.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/annotation/Bean.java b/juneau-core/src/main/java/org/apache/juneau/annotation/Bean.java
index 55b6468..dd436a2 100644
--- a/juneau-core/src/main/java/org/apache/juneau/annotation/Bean.java
+++ b/juneau-core/src/main/java/org/apache/juneau/annotation/Bean.java
@@ -46,7 +46,7 @@ public @interface Bean {
* <p>
* The order specified is the same order that the entries will be returned by the {@link BeanMap#entrySet()} and related methods.
* <p>
- * This annotation is an alternative to using the {@link BeanTransform} class with an implemented {@link BeanTransform#getProperties()} method.
+ * This annotation is an alternative to using the {@link BeanFilter} class with an implemented {@link BeanFilter#getProperties()} method.
*
* <dl>
* <dt>Example:</dt>
@@ -84,7 +84,7 @@ public @interface Bean {
/**
* Specifies a list of properties that should be excluded from {@link BeanMap#entrySet()}.
* <p>
- * This annotation is an alternative to using the {@link BeanTransform} class with an implemented {@link BeanTransform#getExcludeProperties()} method.
+ * This annotation is an alternative to using the {@link BeanFilter} class with an implemented {@link BeanFilter#getExcludeProperties()} method.
*
* <dl>
* <dt>Example:</dt>
@@ -108,7 +108,7 @@ public @interface Bean {
* For example, the {@link PropertyNamerDashedLC} will convert property names to dashed-lowercase, and
* these will be used as attribute names in JSON, and element names in XML.
* <p>
- * This annotation is an alternative to using the {@link BeanTransform} class with an implemented {@link BeanTransform#getPropertyNamer()} method.
+ * This annotation is an alternative to using the {@link BeanFilter} class with an implemented {@link BeanFilter#getPropertyNamer()} method.
*
* <dl>
* <dt>Example:</dt>
@@ -170,7 +170,7 @@ public @interface Bean {
* <jsm>assertTrue</jsm>(a <jk>instanceof</jk> A1);
* </p>
* <p>
- * This annotation is an alternative to using the {@link BeanTransform} class with an implemented {@link BeanTransform#getSubTypeProperty()} method.
+ * This annotation is an alternative to using the {@link BeanFilter} class with an implemented {@link BeanFilter#getSubTypeProperty()} method.
*/
String subTypeProperty() default "";
@@ -205,7 +205,7 @@ public @interface Bean {
* Note that this annotation can be used on the parent class so that it filters to all child classes,
* or can be set individually on the child classes.
* <p>
- * This annotation is an alternative to using the {@link BeanTransform} class with an implemented {@link BeanTransform#getInterfaceClass()} method.
+ * This annotation is an alternative to using the {@link BeanFilter} class with an implemented {@link BeanFilter#getInterfaceClass()} method.
*/
Class<?> interfaceClass() default Object.class;
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/0ce0e663/juneau-core/src/main/java/org/apache/juneau/annotation/BeanProperty.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/annotation/BeanProperty.java b/juneau-core/src/main/java/org/apache/juneau/annotation/BeanProperty.java
index e9ff331..587da9c 100644
--- a/juneau-core/src/main/java/org/apache/juneau/annotation/BeanProperty.java
+++ b/juneau-core/src/main/java/org/apache/juneau/annotation/BeanProperty.java
@@ -126,14 +126,14 @@ public @interface BeanProperty {
* <jk>public class</jk> MyClass {
*
* <jc>// During serialization, convert to ISO8601 date-time string.</jc>
- * <ja>@BeanProperty</ja>(transform=CalendarTransform.ISO8601DT.<jk>class</jk>)
+ * <ja>@BeanProperty</ja>(transform=CalendarSwap.ISO8601DT.<jk>class</jk>)
* <jk>public</jk> Calendar getTime();
* }
* </p>
* </dd>
* </dl>
*/
- Class<? extends PojoTransform<?,?>> transform() default PojoTransform.NULL.class;
+ Class<? extends PojoSwap<?,?>> transform() default PojoSwap.NULL.class;
/**
* Used to limit which child properties are rendered by the serializers.
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/0ce0e663/juneau-core/src/main/java/org/apache/juneau/annotation/Pojo.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/annotation/Pojo.java b/juneau-core/src/main/java/org/apache/juneau/annotation/Pojo.java
index d4919ee..2027c55 100644
--- a/juneau-core/src/main/java/org/apache/juneau/annotation/Pojo.java
+++ b/juneau-core/src/main/java/org/apache/juneau/annotation/Pojo.java
@@ -25,7 +25,7 @@ import org.apache.juneau.transform.*;
* <p>
* Annotation that can be applied to POJOs to associate transforms with them.
* <p>
- * Typically used to associate {@link PojoTransform PojoTransforms} with classes using annotations
+ * Typically used to associate {@link PojoSwap PojoSwaps} with classes using annotations
* instead of programatically through a method such as {@link Serializer#addTransforms(Class...)}.
*
* <h6 class='topic'>Example</h6>
@@ -33,17 +33,17 @@ import org.apache.juneau.transform.*;
* In this case, a transform is being applied to a bean that will force it to be serialized as a <code>String</code>
* <p class='bcode'>
* <jc>// Our bean class</jc>
- * <ja>@Pojo</ja>(transform=BTransform.<jk>class</jk>)
+ * <ja>@Pojo</ja>(transform=BSwap.<jk>class</jk>)
* <jk>public class</jk> B {
* <jk>public</jk> String <jf>f1</jf>;
* }
*
* <jc>// Our transform to force the bean to be serialized as a String</jc>
- * <jk>public class</jk> BTransform <jk>extends</jk> PojoTransform<B,String> {
- * <jk>public</jk> String transform(B o) <jk>throws</jk> SerializeException {
+ * <jk>public class</jk> BSwap <jk>extends</jk> PojoSwap<B,String> {
+ * <jk>public</jk> String swap(B o) <jk>throws</jk> SerializeException {
* <jk>return</jk> o.f1;
* }
- * <jk>public</jk> B normalize(String f, ClassMeta<?> hint) <jk>throws</jk> ParseException {
+ * <jk>public</jk> B unswap(String f, ClassMeta<?> hint) <jk>throws</jk> ParseException {
* B b1 = <jk>new</jk> B();
* b1.<jf>f1</jf> = f;
* <jk>return</jk> b1;
@@ -65,11 +65,11 @@ import org.apache.juneau.transform.*;
* <p>
* Note that using this annotation is functionally equivalent to adding transforms to the serializers and parsers:
* <p class='bcode'>
- * WriterSerializer s = <jk>new</jk> JsonSerializer.addTransforms(BTransform.<jk>class</jk>);
- * ReaderParser p = <jk>new</jk> JsonParser.addTransforms(BTransform.<jk>class</jk>);
+ * WriterSerializer s = <jk>new</jk> JsonSerializer.addTransforms(BSwap.<jk>class</jk>);
+ * ReaderParser p = <jk>new</jk> JsonParser.addTransforms(BSwap.<jk>class</jk>);
* </p>
* <p>
- * It is technically possible to associate a {@link BeanTransform} with a bean class using this annotation.
+ * It is technically possible to associate a {@link BeanFilter} with a bean class using this annotation.
* However in practice, it's almost always less code to simply use the {@link Bean @Bean} annotation.
* </p>
*
@@ -82,7 +82,7 @@ import org.apache.juneau.transform.*;
public @interface Pojo {
/**
- * The transform class.
+ * Associate a {@link PojoSwap} or {@link SurrogateSwap} with this class type.
*/
Class<? extends Transform> transform() default Transform.NULL.class;
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/0ce0e663/juneau-core/src/main/java/org/apache/juneau/dto/atom/CommonEntry.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/dto/atom/CommonEntry.java b/juneau-core/src/main/java/org/apache/juneau/dto/atom/CommonEntry.java
index ea60789..821193a 100644
--- a/juneau-core/src/main/java/org/apache/juneau/dto/atom/CommonEntry.java
+++ b/juneau-core/src/main/java/org/apache/juneau/dto/atom/CommonEntry.java
@@ -262,7 +262,7 @@ public class CommonEntry extends Common {
*
* @return The update timestamp of this object.
*/
- @BeanProperty(transform=CalendarTransform.ISO8601DT.class)
+ @BeanProperty(transform=CalendarSwap.ISO8601DT.class)
public Calendar getUpdated() {
return updated;
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/0ce0e663/juneau-core/src/main/java/org/apache/juneau/dto/atom/Entry.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/dto/atom/Entry.java b/juneau-core/src/main/java/org/apache/juneau/dto/atom/Entry.java
index 9fc4111..2475372 100644
--- a/juneau-core/src/main/java/org/apache/juneau/dto/atom/Entry.java
+++ b/juneau-core/src/main/java/org/apache/juneau/dto/atom/Entry.java
@@ -100,7 +100,7 @@ public class Entry extends CommonEntry {
*
* @return The publish timestamp of this entry.
*/
- @BeanProperty(transform=CalendarTransform.ISO8601DT.class)
+ @BeanProperty(transform=CalendarSwap.ISO8601DT.class)
public Calendar getPublished() {
return published;
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/0ce0e663/juneau-core/src/main/java/org/apache/juneau/dto/cognos/Column.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/dto/cognos/Column.java b/juneau-core/src/main/java/org/apache/juneau/dto/cognos/Column.java
index 020a71b..8356f70 100644
--- a/juneau-core/src/main/java/org/apache/juneau/dto/cognos/Column.java
+++ b/juneau-core/src/main/java/org/apache/juneau/dto/cognos/Column.java
@@ -33,7 +33,7 @@ public class Column {
private String name, type;
private Integer length;
- PojoTransform transform;
+ PojoSwap transform;
/** Bean constructor. */
public Column() {}
@@ -62,7 +62,7 @@ public class Column {
}
/**
- * Associates a POJO transform with this column.
+ * Associates a POJO swap with this column.
* <p>
* Typically used to define columns that don't exist on the underlying beans being serialized.
* <p>
@@ -72,9 +72,9 @@ public class Column {
* <p class='bcode'>
* Column c = <jk>new</jk> Column(<js>"numAddresses"</js>, <js>"xs:int"</js>)
* .addTransform(
- * <jk>new</jk> PojoTransform<Person,Integer>() {
+ * <jk>new</jk> PojoSwap<Person,Integer>() {
* <ja>@Override</ja>
- * <jk>public</jk> Integer transform(Person p) {
+ * <jk>public</jk> Integer swap(Person p) {
* <jk>return</jk> p.<jf>addresses</jf>.size();
* }
* }
@@ -84,7 +84,7 @@ public class Column {
* @param transform The transform to associate with the column.
* @return This object (for method chaining).
*/
- public Column addTransform(PojoTransform transform) {
+ public Column addTransform(PojoSwap transform) {
this.transform = transform;
return this;
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/0ce0e663/juneau-core/src/main/java/org/apache/juneau/dto/cognos/DataSet.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/dto/cognos/DataSet.java b/juneau-core/src/main/java/org/apache/juneau/dto/cognos/DataSet.java
index d4a70f2..77c770f 100644
--- a/juneau-core/src/main/java/org/apache/juneau/dto/cognos/DataSet.java
+++ b/juneau-core/src/main/java/org/apache/juneau/dto/cognos/DataSet.java
@@ -58,9 +58,9 @@ import org.apache.juneau.xml.annotation.*;
* <jk>new</jk> Column(<js>"age"</js>, <js>"xs:int"</js>),
* <jk>new</jk> Column(<js>"numAddresses"</js>, <js>"xs:int"</js>)
* .addTransform(
- * <jk>new</jk> PojoTransform<Person,Integer>() {
+ * <jk>new</jk> PojoSwap<Person,Integer>() {
* <ja>@Override</ja>
- * <jk>public</jk> Integer transform(Person p) {
+ * <jk>public</jk> Integer swap(Person p) {
* <jk>return</jk> p.<jf>addresses</jf>.size();
* }
* }
@@ -112,7 +112,7 @@ public class DataSet {
for (Column col : columns) {
Object v;
if (col.transform != null)
- v = col.transform.transform(o2);
+ v = col.transform.swap(o2);
else
v = m.get(col.getName());
r.add(v == null ? null : v.toString());
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/0ce0e663/juneau-core/src/main/java/org/apache/juneau/dto/cognos/package.html
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/dto/cognos/package.html b/juneau-core/src/main/java/org/apache/juneau/dto/cognos/package.html
index 354fe8d..ed03606 100644
--- a/juneau-core/src/main/java/org/apache/juneau/dto/cognos/package.html
+++ b/juneau-core/src/main/java/org/apache/juneau/dto/cognos/package.html
@@ -108,9 +108,9 @@
<jk>new</jk> Column(<js>"age"</js>, <js>"xs:int"</js>),
<jk>new</jk> Column(<js>"numAddresses"</js>, <js>"xs:int"</js>)
.addTransform(
- <jk>new</jk> PojoTransform<Person,Integer>() {
+ <jk>new</jk> PojoSwap<Person,Integer>() {
<ja>@Override</ja>
- <jk>public</jk> Integer transform(Person p) {
+ <jk>public</jk> Integer swap(Person p) {
<jk>return</jk> p.<jf>addresses</jf>.size();
}
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/0ce0e663/juneau-core/src/main/java/org/apache/juneau/dto/jsonschema/Schema.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/dto/jsonschema/Schema.java b/juneau-core/src/main/java/org/apache/juneau/dto/jsonschema/Schema.java
index d63a245..2fbba1d 100644
--- a/juneau-core/src/main/java/org/apache/juneau/dto/jsonschema/Schema.java
+++ b/juneau-core/src/main/java/org/apache/juneau/dto/jsonschema/Schema.java
@@ -218,7 +218,7 @@ public class Schema {
* @return The value of the <property>type</property> property on this bean, or <jk>null</jk> if it is not set.
* Can be either a {@link JsonType} or {@link JsonTypeArray} depending on what value was used to set it.
*/
- @BeanProperty(transform=JsonTypeOrJsonTypeArrayTransform.class)
+ @BeanProperty(transform=JsonTypeOrJsonTypeArraySwap.class)
public Object getType() {
if (typeJsonType != null)
return typeJsonType;
@@ -292,15 +292,15 @@ public class Schema {
* </ul>
* Serialization method is a no-op.
*/
- public static class JsonTypeOrJsonTypeArrayTransform extends PojoTransform<Object,Object> {
+ public static class JsonTypeOrJsonTypeArraySwap extends PojoSwap<Object,Object> {
- @Override /* PojoTransform */
- public Object transform(Object o) throws SerializeException {
+ @Override /* PojoSwap */
+ public Object swap(Object o) throws SerializeException {
return o;
}
- @Override /* PojoTransform */
- public Object normalize(Object o, ClassMeta<?> hint) throws ParseException {
+ @Override /* PojoSwap */
+ public Object unswap(Object o, ClassMeta<?> hint) throws ParseException {
BeanContext bc = getBeanContext();
ClassMeta<?> cm = (o instanceof Collection ? bc.getClassMeta(JsonTypeArray.class) : bc.getClassMeta(JsonType.class));
return bc.convertToType(o, cm);
@@ -514,7 +514,7 @@ public class Schema {
* @return The value of the <property>items</property> property on this bean, or <jk>null</jk> if it is not set.
* Can be either a {@link Schema} or {@link SchemaArray} depending on what value was used to set it.
*/
- @BeanProperty(transform=SchemaOrSchemaArrayTransform.class)
+ @BeanProperty(transform=SchemaOrSchemaArraySwap.class)
public Object getItems() {
if (itemsSchema != null)
return itemsSchema;
@@ -553,15 +553,15 @@ public class Schema {
* </ul>
* Serialization method is a no-op.
*/
- public static class SchemaOrSchemaArrayTransform extends PojoTransform<Object,Object> {
+ public static class SchemaOrSchemaArraySwap extends PojoSwap<Object,Object> {
- @Override /* PojoTransform */
- public Object transform(Object o) throws SerializeException {
+ @Override /* PojoSwap */
+ public Object swap(Object o) throws SerializeException {
return o;
}
- @Override /* PojoTransform */
- public Object normalize(Object o, ClassMeta<?> hint) throws ParseException {
+ @Override /* PojoSwap */
+ public Object unswap(Object o, ClassMeta<?> hint) throws ParseException {
BeanContext bc = getBeanContext();
ClassMeta<?> cm = (o instanceof Collection ? bc.getClassMeta(SchemaArray.class) : bc.getClassMeta(Schema.class));
return bc.convertToType(o, cm);
@@ -772,7 +772,7 @@ public class Schema {
* @return The value of the <property>additionalItems</property> property on this bean, or <jk>null</jk> if it is not set.
* Can be either a {@link Boolean} or {@link SchemaArray} depending on what value was used to set it.
*/
- @BeanProperty(transform=BooleanOrSchemaArrayTransform.class)
+ @BeanProperty(transform=BooleanOrSchemaArraySwap.class)
public Object getAdditionalItems() {
if (additionalItemsBoolean != null)
return additionalItemsBoolean;
@@ -848,15 +848,15 @@ public class Schema {
* </ul>
* Serialization method is a no-op.
*/
- public static class BooleanOrSchemaArrayTransform extends PojoTransform<Object,Object> {
+ public static class BooleanOrSchemaArraySwap extends PojoSwap<Object,Object> {
- @Override /* PojoTransform */
- public Object transform(Object o) throws SerializeException {
+ @Override /* PojoSwap */
+ public Object swap(Object o) throws SerializeException {
return o;
}
- @Override /* PojoTransform */
- public Object normalize(Object o, ClassMeta<?> hint) throws ParseException {
+ @Override /* PojoSwap */
+ public Object unswap(Object o, ClassMeta<?> hint) throws ParseException {
BeanContext bc = getBeanContext();
ClassMeta<?> cm = (o instanceof Collection ? bc.getClassMeta(SchemaArray.class) : bc.getClassMeta(Boolean.class));
return bc.convertToType(o, cm);
@@ -1031,7 +1031,7 @@ public class Schema {
* @return The value of the <property>additionalProperties</property> property on this bean, or <jk>null</jk> if it is not set.
* Can be either a {@link Boolean} or {@link SchemaArray} depending on what value was used to set it.
*/
- @BeanProperty(transform=BooleanOrSchemaTransform.class)
+ @BeanProperty(transform=BooleanOrSchemaSwap.class)
public Object getAdditionalProperties() {
if (additionalPropertiesBoolean != null)
return additionalItemsBoolean;
@@ -1093,15 +1093,15 @@ public class Schema {
* </ul>
* Serialization method is a no-op.
*/
- public static class BooleanOrSchemaTransform extends PojoTransform<Object,Object> {
+ public static class BooleanOrSchemaSwap extends PojoSwap<Object,Object> {
- @Override /* PojoTransform */
- public Object transform(Object o) throws SerializeException {
+ @Override /* PojoSwap */
+ public Object swap(Object o) throws SerializeException {
return o;
}
- @Override /* PojoTransform */
- public Object normalize(Object o, ClassMeta<?> hint) throws ParseException {
+ @Override /* PojoSwap */
+ public Object unswap(Object o, ClassMeta<?> hint) throws ParseException {
BeanContext bc = getBeanContext();
ClassMeta<?> cm = (o instanceof Boolean ? bc.getClassMeta(Boolean.class) : bc.getClassMeta(Schema.class));
return bc.convertToType(o, cm);
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/0ce0e663/juneau-core/src/main/java/org/apache/juneau/html/HtmlParser.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/html/HtmlParser.java b/juneau-core/src/main/java/org/apache/juneau/html/HtmlParser.java
index c8423ce..6cdc4cd 100644
--- a/juneau-core/src/main/java/org/apache/juneau/html/HtmlParser.java
+++ b/juneau-core/src/main/java/org/apache/juneau/html/HtmlParser.java
@@ -72,7 +72,7 @@ public final class HtmlParser extends ReaderParser {
BeanContext bc = session.getBeanContext();
if (nt == null)
nt = (ClassMeta<T>)object();
- PojoTransform<T,Object> transform = (PojoTransform<T,Object>)nt.getPojoTransform();
+ PojoSwap<T,Object> transform = (PojoSwap<T,Object>)nt.getPojoSwap();
ClassMeta<?> ft = nt.getTransformedClassMeta();
session.setCurrentClass(ft);
@@ -195,7 +195,7 @@ public final class HtmlParser extends ReaderParser {
if (transform != null && o != null)
- o = transform.normalize(o, nt);
+ o = transform.unswap(o, nt);
if (outer != null)
setParent(nt, o, outer);
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/0ce0e663/juneau-core/src/main/java/org/apache/juneau/html/HtmlSchemaDocSerializer.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/html/HtmlSchemaDocSerializer.java b/juneau-core/src/main/java/org/apache/juneau/html/HtmlSchemaDocSerializer.java
index f30b0bb..0ba6005 100644
--- a/juneau-core/src/main/java/org/apache/juneau/html/HtmlSchemaDocSerializer.java
+++ b/juneau-core/src/main/java/org/apache/juneau/html/HtmlSchemaDocSerializer.java
@@ -116,7 +116,7 @@ public final class HtmlSchemaDocSerializer extends HtmlDocSerializer {
out.put("type", type);
out.put("class", eType.toString());
- PojoTransform t = eType.getPojoTransform();
+ PojoSwap t = eType.getPojoSwap();
if (t != null)
out.put("transform", t);
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/0ce0e663/juneau-core/src/main/java/org/apache/juneau/html/HtmlSerializer.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/html/HtmlSerializer.java b/juneau-core/src/main/java/org/apache/juneau/html/HtmlSerializer.java
index 47e40cc..664f266 100644
--- a/juneau-core/src/main/java/org/apache/juneau/html/HtmlSerializer.java
+++ b/juneau-core/src/main/java/org/apache/juneau/html/HtmlSerializer.java
@@ -222,9 +222,9 @@ public class HtmlSerializer extends XmlSerializer {
classAttr = aType.toString();
// Transform if necessary
- PojoTransform transform = aType.getPojoTransform();
+ PojoSwap transform = aType.getPojoSwap();
if (transform != null) {
- o = transform.transform(o);
+ o = transform.swap(o);
// If the transforms getTransformedClass() method returns Object, we need to figure out
// the actual type now.
@@ -409,9 +409,9 @@ public class HtmlSerializer extends XmlSerializer {
for (Object o : c) {
ClassMeta<?> cm = bc.getClassMetaForObject(o);
- if (cm != null && cm.getPojoTransform() != null) {
- PojoTransform f = cm.getPojoTransform();
- o = f.transform(o);
+ if (cm != null && cm.getPojoSwap() != null) {
+ PojoSwap f = cm.getPojoSwap();
+ o = f.swap(o);
cm = cm.getTransformedClassMeta();
}
@@ -487,9 +487,9 @@ public class HtmlSerializer extends XmlSerializer {
if (o1 == null)
return null;
ClassMeta<?> cm = bc.getClassMetaForObject(o1);
- if (cm.getPojoTransform() != null) {
- PojoTransform f = cm.getPojoTransform();
- o1 = f.transform(o1);
+ if (cm.getPojoSwap() != null) {
+ PojoSwap f = cm.getPojoSwap();
+ o1 = f.swap(o1);
cm = cm.getTransformedClassMeta();
}
if (cm == null || ! (cm.isMap() || cm.isBean()))
@@ -523,9 +523,9 @@ public class HtmlSerializer extends XmlSerializer {
if (o == null)
continue;
cm = bc.getClassMetaForObject(o);
- if (cm != null && cm.getPojoTransform() != null) {
- PojoTransform f = cm.getPojoTransform();
- o = f.transform(o);
+ if (cm != null && cm.getPojoSwap() != null) {
+ PojoSwap f = cm.getPojoSwap();
+ o = f.swap(o);
cm = cm.getTransformedClassMeta();
}
if (prevC.contains(cm))
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/0ce0e663/juneau-core/src/main/java/org/apache/juneau/internal/HashCode.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/internal/HashCode.java b/juneau-core/src/main/java/org/apache/juneau/internal/HashCode.java
index fc1e72b..f25fa09 100644
--- a/juneau-core/src/main/java/org/apache/juneau/internal/HashCode.java
+++ b/juneau-core/src/main/java/org/apache/juneau/internal/HashCode.java
@@ -42,7 +42,7 @@ public class HashCode {
* @return This object (for method chaining).
*/
public HashCode add(Object o) {
- o = normalize(o);
+ o = unswap(o);
add(o == null ? 1 : o.hashCode());
return this;
}
@@ -79,7 +79,7 @@ public class HashCode {
* @param o The object to normalize before getting it's hashcode.
* @return The normalized object.
*/
- protected Object normalize(Object o) {
+ protected Object unswap(Object o) {
return o;
}
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/0ce0e663/juneau-core/src/main/java/org/apache/juneau/internal/JuneauLogger.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/internal/JuneauLogger.java b/juneau-core/src/main/java/org/apache/juneau/internal/JuneauLogger.java
index 4bd90ef..d1c5ccf 100644
--- a/juneau-core/src/main/java/org/apache/juneau/internal/JuneauLogger.java
+++ b/juneau-core/src/main/java/org/apache/juneau/internal/JuneauLogger.java
@@ -32,10 +32,10 @@ public class JuneauLogger extends java.util.logging.Logger {
private static final WriterSerializer serializer = JsonSerializer.DEFAULT_LAX.clone()
.addTransforms(
- CalendarTransform.ISO8601DTZ.class,
- DateTransform.ISO8601DTZ.class,
- EnumerationTransform.class,
- IteratorTransform.class
+ CalendarSwap.ISO8601DTZ.class,
+ DateSwap.ISO8601DTZ.class,
+ EnumerationSwap.class,
+ IteratorSwap.class
);
private static final ConcurrentHashMap<Class<?>,String> rbMap = new ConcurrentHashMap<Class<?>,String>();
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/0ce0e663/juneau-core/src/main/java/org/apache/juneau/jena/RdfParser.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/jena/RdfParser.java b/juneau-core/src/main/java/org/apache/juneau/jena/RdfParser.java
index 6695b0b..3b7ae14 100644
--- a/juneau-core/src/main/java/org/apache/juneau/jena/RdfParser.java
+++ b/juneau-core/src/main/java/org/apache/juneau/jena/RdfParser.java
@@ -243,7 +243,7 @@ public class RdfParser extends ReaderParser {
if (nt == null)
nt = (ClassMeta<T>)object();
- PojoTransform<T,Object> transform = (PojoTransform<T,Object>)nt.getPojoTransform();
+ PojoSwap<T,Object> transform = (PojoSwap<T,Object>)nt.getPojoSwap();
ClassMeta<?> ft = nt.getTransformedClassMeta();
session.setCurrentClass(ft);
@@ -353,7 +353,7 @@ public class RdfParser extends ReaderParser {
}
if (transform != null && o != null)
- o = transform.normalize(o, nt);
+ o = transform.unswap(o, nt);
if (outer != null)
setParent(nt, o, outer);
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/0ce0e663/juneau-core/src/main/java/org/apache/juneau/jena/RdfSerializer.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/jena/RdfSerializer.java b/juneau-core/src/main/java/org/apache/juneau/jena/RdfSerializer.java
index dc6aa74..5f464e1 100644
--- a/juneau-core/src/main/java/org/apache/juneau/jena/RdfSerializer.java
+++ b/juneau-core/src/main/java/org/apache/juneau/jena/RdfSerializer.java
@@ -180,9 +180,9 @@ public class RdfSerializer extends WriterSerializer {
gType = aType.getTransformedClassMeta();
// Transform if necessary
- PojoTransform transform = aType.getPojoTransform();
+ PojoSwap transform = aType.getPojoSwap();
if (transform != null) {
- o = transform.transform(o);
+ o = transform.swap(o);
// If the transforms getTransformedClass() method returns Object, we need to figure out
// the actual type now.
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/0ce0e663/juneau-core/src/main/java/org/apache/juneau/jena/package.html
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/jena/package.html b/juneau-core/src/main/java/org/apache/juneau/jena/package.html
index 5cf96e4..0a25043 100644
--- a/juneau-core/src/main/java/org/apache/juneau/jena/package.html
+++ b/juneau-core/src/main/java/org/apache/juneau/jena/package.html
@@ -119,10 +119,10 @@
<code>fromString()</code>, <code>valueOf()</code>, <code>constructor(String)</code>).
</ul>
<p>
- In addition to the types shown above, Juneau includes the ability to define transforms to transform non-standard object and
+ In addition to the types shown above, Juneau includes the ability to define 'swaps' to transform non-standard object and
property types to serializable forms (e.g. to transform <code>Calendars</code> to and from <code>ISO8601</code> strings,
or <code>byte[]</code> arrays to and from base-64 encoded strings).<br>
- These transforms can be associated with serializers/parsers, or can be associated with classes or bean properties through type and method annotations.
+ These can be associated with serializers/parsers, or can be associated with classes or bean properties through type and method annotations.
</p>
<p>
Refer to <a href='../package-summary.html#PojoCategories' class='doclink'>POJO Categories</a> for a complete definition of supported POJOs.
@@ -469,16 +469,16 @@
<li>Associating transforms at both the class and property level (to convert non-serializable POJOs to serializable forms).
</ul>
<p>
- For example, we now add a <code>birthDate</code> property, and associate a transform with it to transform
+ For example, we now add a <code>birthDate</code> property, and associate a swap with it to transform
it to an ISO8601 date-time string in GMT time.<br>
By default, <code>Calendars</code> are treated as beans by the framework, which is usually not how you want them serialized.<br>
- Using transforms, we can convert them to standardized string forms.
+ Using swaps, we can convert them to standardized string forms.
</p>
<p class='bcode'>
<jk>public class</jk> Person {
<jc>// Bean properties</jc>
- <ja>@BeanProperty</ja>(transform=CalendarTransform.ISO8601DTZ.<jk>class</jk>) <jk>public</jk> Calendar birthDate;
+ <ja>@BeanProperty</ja>(transform=CalendarSwap.ISO8601DTZ.<jk>class</jk>) <jk>public</jk> Calendar birthDate;
...
<jc>// Normal constructor</jc>
@@ -898,9 +898,9 @@
<jc>// Get a value convertable from a String.</jc>
URI uri = m.get(URI.<jk>class</jk>, <js>"uri"</js>);
- <jc>// Get a value using a transform.</jc>
- CalendarTransform transform = <jk>new</jk> CalendarTransform.ISO8601DTZ();
- Calendar birthDate = m.get(transform, <js>"birthDate"</js>);
+ <jc>// Get a value using a swap.</jc>
+ CalendarSwap swap = <jk>new</jk> CalendarSwap.ISO8601DTZ();
+ Calendar birthDate = m.get(swap, <js>"birthDate"</js>);
<jc>// Get the addresses.</jc>
ObjectList addresses = m.getObjectList(<js>"addresses"</js>);
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/0ce0e663/juneau-core/src/main/java/org/apache/juneau/json/JsonParser.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/json/JsonParser.java b/juneau-core/src/main/java/org/apache/juneau/json/JsonParser.java
index 07d58ef..1930874 100644
--- a/juneau-core/src/main/java/org/apache/juneau/json/JsonParser.java
+++ b/juneau-core/src/main/java/org/apache/juneau/json/JsonParser.java
@@ -104,7 +104,7 @@ public final class JsonParser extends ReaderParser {
BeanContext bc = session.getBeanContext();
if (nt == null)
nt = (ClassMeta<T>)object();
- PojoTransform<T,Object> transform = (PojoTransform<T,Object>)nt.getPojoTransform();
+ PojoSwap<T,Object> transform = (PojoSwap<T,Object>)nt.getPojoSwap();
ClassMeta<?> ft = nt.getTransformedClassMeta();
session.setCurrentClass(ft);
String wrapperAttr = ft.getExtendedMeta(JsonClassMeta.class).getWrapperAttr();
@@ -202,7 +202,7 @@ public final class JsonParser extends ReaderParser {
skipWrapperAttrEnd(session, r);
if (transform != null && o != null)
- o = transform.normalize(o, nt);
+ o = transform.unswap(o, nt);
if (outer != null)
setParent(nt, o, outer);
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/0ce0e663/juneau-core/src/main/java/org/apache/juneau/json/JsonSchemaSerializer.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/json/JsonSchemaSerializer.java b/juneau-core/src/main/java/org/apache/juneau/json/JsonSchemaSerializer.java
index a384059..b264762 100644
--- a/juneau-core/src/main/java/org/apache/juneau/json/JsonSchemaSerializer.java
+++ b/juneau-core/src/main/java/org/apache/juneau/json/JsonSchemaSerializer.java
@@ -112,7 +112,7 @@ public final class JsonSchemaSerializer extends JsonSerializer {
out.put("type", type);
out.put("description", eType.toString());
- PojoTransform f = eType.getPojoTransform();
+ PojoSwap f = eType.getPojoSwap();
if (f != null)
out.put("transform", f);
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/0ce0e663/juneau-core/src/main/java/org/apache/juneau/json/JsonSerializer.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/json/JsonSerializer.java b/juneau-core/src/main/java/org/apache/juneau/json/JsonSerializer.java
index 2be051e..119c9e4 100644
--- a/juneau-core/src/main/java/org/apache/juneau/json/JsonSerializer.java
+++ b/juneau-core/src/main/java/org/apache/juneau/json/JsonSerializer.java
@@ -188,9 +188,9 @@ public class JsonSerializer extends WriterSerializer {
addClassAttr = (session.isAddClassAttrs() && ! eType.equals(aType));
// Transform if necessary
- PojoTransform transform = aType.getPojoTransform(); // The transform
+ PojoSwap transform = aType.getPojoSwap(); // The transform
if (transform != null) {
- o = transform.transform(o);
+ o = transform.swap(o);
// If the transform's getTransformedClass() method returns Object, we need to figure out
// the actual type now.
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/0ce0e663/juneau-core/src/main/java/org/apache/juneau/json/package.html
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/json/package.html b/juneau-core/src/main/java/org/apache/juneau/json/package.html
index 1c947cb..2012db3 100644
--- a/juneau-core/src/main/java/org/apache/juneau/json/package.html
+++ b/juneau-core/src/main/java/org/apache/juneau/json/package.html
@@ -107,7 +107,7 @@
<li>Multi-dimensional arrays of any type on this list.
<li>Java Beans with properties of any type on this list.
<li>Classes with standard transformations to and from <code>Strings</code> (e.g. classes containing <code>toString()</code>, <code>fromString()</code>, <code>valueOf()</code>, <code>constructor(String)</code>).
- <li>Non-serializable classes and properties with associated <code>PojoTransforms</code> that convert them to serializable forms.
+ <li>Non-serializable classes and properties with associated <code>PojoSwaps</code> that convert them to serializable forms.
</ul>
<p>
Refer to <a href='../package-summary.html#PojoCategories' class='doclink'>POJO Categories</a> for a complete definition of supported POJOs.
@@ -202,9 +202,9 @@
</tr>
</table>
<p>
- In addition, transforms can be used to convert non-serializable POJOs into serializable forms, such as converting
+ In addition, swaps can be used to convert non-serializable POJOs into serializable forms, such as converting
<code>Calendar</code> object to ISO8601 strings, or <code><jk>byte</jk>[]</code> arrays to Base-64 encoded strings.<br>
- These transforms can be associated at various levels:
+ These swaps can be associated at various levels:
</p>
<ul class='spaced-list'>
<li>On serializer and parser instances to handle all objects of the class type globally.
@@ -307,14 +307,14 @@
<li>Hiding bean properties.
<li>Specifying the ordering of bean properties.
<li>Overriding the names of bean properties.
- <li>Associating transforms at both the class and property level (to convert non-serializable POJOs to serializable forms).
+ <li>Associating swaps at both the class and property level (to convert non-serializable POJOs to serializable forms).
</ul>
<p>
- For example, we now add a <code>birthDate</code> property, and associate a transform with it to transform
+ For example, we now add a <code>birthDate</code> property, and associate a swap with it to transform
it to an ISO8601 date-time string in GMT time.<br>
We'll also add a couple of <code>URI</code> properties.<br>
By default, <code>Calendars</code> are treated as beans by the framework, which is usually not how you want them serialized.<br>
- Using transforms, we can convert them to standardized string forms.
+ Using swaps, we can convert them to standardized string forms.
</p>
<p class='bcode'>
<jk>public class</jk> Person {
@@ -324,7 +324,7 @@
<jk>public</jk> URI <jf>uri</jf>;
<jk>public</jk> URI <jf>addressBookUri</jf>;
- <ja>@BeanProperty</ja>(transform=CalendarTransform.ISO8601DTZ.<jk>class</jk>) <jk>public</jk> Calendar <jf>birthDate</jf>;
+ <ja>@BeanProperty</ja>(transform=CalendarSwap.ISO8601DTZ.<jk>class</jk>) <jk>public</jk> Calendar <jf>birthDate</jf>;
<jc>// Bean constructor (needed by parser)</jc>
@@ -487,7 +487,7 @@
<jk>public</jk> String <jf>name</jf>;
<jk>public</jk> URI <jf>uri</jf>;
<jk>public</jk> URI <jf>addressBookUri</jf>;
- <ja>@BeanProperty</ja>(transform=CalendarTransform.ISO8601DTZ.<jk>class</jk>) <jk>public</jk> Calendar <jf>birthDate</jf>;
+ <ja>@BeanProperty</ja>(transform=CalendarSwap.ISO8601DTZ.<jk>class</jk>) <jk>public</jk> Calendar <jf>birthDate</jf>;
<jk>public</jk> LinkedList<Address> <jf>addresses</jf> = <jk>new</jk> LinkedList<Address>();
<jc>// Bean constructor (needed by parser)</jc>
@@ -910,9 +910,9 @@
<jc>// Get a value convertable from a String.</jc>
URI uri = m.get(URI.<jk>class</jk>, <js>"uri"</js>);
- <jc>// Get a value using a transform.</jc>
- CalendarTransform transform = <jk>new</jk> CalendarTransform.ISO8601DTZ();
- Calendar birthDate = m.get(transform, <js>"birthDate"</js>);
+ <jc>// Get a value using a swap.</jc>
+ CalendarSwap swap = <jk>new</jk> CalendarSwap.ISO8601DTZ();
+ Calendar birthDate = m.get(swap, <js>"birthDate"</js>);
<jc>// Get the addresses.</jc>
ObjectList addresses = m.getObjectList(<js>"addresses"</js>);