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/09/07 20:27:31 UTC
[4/4] incubator-juneau git commit: Rename classLexicon to
typeDictionary, and other minor field name changes.
Rename classLexicon to typeDictionary, and other minor field name
changes.
Project: http://git-wip-us.apache.org/repos/asf/incubator-juneau/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-juneau/commit/e1c60b10
Tree: http://git-wip-us.apache.org/repos/asf/incubator-juneau/tree/e1c60b10
Diff: http://git-wip-us.apache.org/repos/asf/incubator-juneau/diff/e1c60b10
Branch: refs/heads/master
Commit: e1c60b10142b4c45658a2c25ab6137246de990bf
Parents: 47b9ce6
Author: jamesbognar <ja...@gmail.com>
Authored: Wed Sep 7 16:27:11 2016 -0400
Committer: jamesbognar <ja...@gmail.com>
Committed: Wed Sep 7 16:27:11 2016 -0400
----------------------------------------------------------------------
.../java/org/apache/juneau/BeanContext.java | 26 ++--
.../main/java/org/apache/juneau/BeanMeta.java | 8 +-
.../org/apache/juneau/BeanPropertyMeta.java | 32 ++---
.../java/org/apache/juneau/ClassLexicon.java | 141 -------------------
.../main/java/org/apache/juneau/ClassMeta.java | 36 ++---
.../main/java/org/apache/juneau/ObjectMap.java | 18 +--
.../java/org/apache/juneau/TypeDictionary.java | 137 ++++++++++++++++++
.../java/org/apache/juneau/annotation/Bean.java | 33 +++--
.../apache/juneau/annotation/BeanProperty.java | 13 +-
.../java/org/apache/juneau/annotation/Pojo.java | 74 +---------
.../org/apache/juneau/dto/atom/Category.java | 2 +-
.../java/org/apache/juneau/dto/atom/Entry.java | 2 +-
.../java/org/apache/juneau/dto/atom/Feed.java | 2 +-
.../org/apache/juneau/dto/atom/Generator.java | 2 +-
.../java/org/apache/juneau/dto/atom/Icon.java | 2 +-
.../java/org/apache/juneau/dto/atom/Id.java | 2 +-
.../java/org/apache/juneau/dto/atom/Link.java | 2 +-
.../java/org/apache/juneau/dto/atom/Logo.java | 2 +-
.../org/apache/juneau/dto/cognos/Column.java | 2 +-
.../org/apache/juneau/dto/cognos/DataSet.java | 4 +-
.../apache/juneau/dto/jsonschema/Schema.java | 2 +-
.../java/org/apache/juneau/html/HtmlParser.java | 98 ++++++-------
.../juneau/html/HtmlSchemaDocSerializer.java | 30 ++--
.../org/apache/juneau/html/HtmlSerializer.java | 38 ++---
.../main/java/org/apache/juneau/html/dto/A.java | 2 +-
.../java/org/apache/juneau/html/dto/Abbr.java | 2 +-
.../org/apache/juneau/html/dto/Address.java | 2 +-
.../java/org/apache/juneau/html/dto/Area.java | 2 +-
.../org/apache/juneau/html/dto/Article.java | 2 +-
.../java/org/apache/juneau/html/dto/Aside.java | 2 +-
.../java/org/apache/juneau/html/dto/Audio.java | 2 +-
.../main/java/org/apache/juneau/html/dto/B.java | 2 +-
.../java/org/apache/juneau/html/dto/Base.java | 2 +-
.../java/org/apache/juneau/html/dto/Bdi.java | 2 +-
.../java/org/apache/juneau/html/dto/Bdo.java | 2 +-
.../org/apache/juneau/html/dto/Blockquote.java | 2 +-
.../java/org/apache/juneau/html/dto/Body.java | 2 +-
.../java/org/apache/juneau/html/dto/Br.java | 2 +-
.../java/org/apache/juneau/html/dto/Button.java | 2 +-
.../java/org/apache/juneau/html/dto/Canvas.java | 2 +-
.../org/apache/juneau/html/dto/Caption.java | 2 +-
.../java/org/apache/juneau/html/dto/Cite.java | 2 +-
.../java/org/apache/juneau/html/dto/Code.java | 2 +-
.../java/org/apache/juneau/html/dto/Col.java | 2 +-
.../org/apache/juneau/html/dto/Colgroup.java | 2 +-
.../org/apache/juneau/html/dto/Command.java | 2 +-
.../java/org/apache/juneau/html/dto/Data.java | 2 +-
.../org/apache/juneau/html/dto/Datalist.java | 2 +-
.../java/org/apache/juneau/html/dto/Dd.java | 2 +-
.../java/org/apache/juneau/html/dto/Del.java | 2 +-
.../org/apache/juneau/html/dto/Details.java | 2 +-
.../java/org/apache/juneau/html/dto/Dfn.java | 2 +-
.../java/org/apache/juneau/html/dto/Div.java | 2 +-
.../java/org/apache/juneau/html/dto/Dl.java | 2 +-
.../java/org/apache/juneau/html/dto/Dt.java | 2 +-
.../java/org/apache/juneau/html/dto/Em.java | 2 +-
.../java/org/apache/juneau/html/dto/Embed.java | 2 +-
.../org/apache/juneau/html/dto/Fieldset.java | 2 +-
.../org/apache/juneau/html/dto/Figcaption.java | 2 +-
.../java/org/apache/juneau/html/dto/Figure.java | 2 +-
.../java/org/apache/juneau/html/dto/Footer.java | 2 +-
.../java/org/apache/juneau/html/dto/Form.java | 2 +-
.../java/org/apache/juneau/html/dto/H1.java | 2 +-
.../java/org/apache/juneau/html/dto/H2.java | 2 +-
.../java/org/apache/juneau/html/dto/H3.java | 2 +-
.../java/org/apache/juneau/html/dto/H4.java | 2 +-
.../java/org/apache/juneau/html/dto/H5.java | 2 +-
.../java/org/apache/juneau/html/dto/H6.java | 2 +-
.../java/org/apache/juneau/html/dto/Head.java | 2 +-
.../java/org/apache/juneau/html/dto/Header.java | 2 +-
.../java/org/apache/juneau/html/dto/Hgroup.java | 2 +-
.../java/org/apache/juneau/html/dto/Hr.java | 2 +-
.../java/org/apache/juneau/html/dto/Html.java | 2 +-
.../main/java/org/apache/juneau/html/dto/I.java | 2 +-
.../java/org/apache/juneau/html/dto/IFrame.java | 2 +-
.../java/org/apache/juneau/html/dto/Img.java | 2 +-
.../java/org/apache/juneau/html/dto/Input.java | 2 +-
.../java/org/apache/juneau/html/dto/Ins.java | 2 +-
.../java/org/apache/juneau/html/dto/Kbd.java | 2 +-
.../java/org/apache/juneau/html/dto/Keygen.java | 2 +-
.../java/org/apache/juneau/html/dto/Label.java | 2 +-
.../java/org/apache/juneau/html/dto/Legend.java | 2 +-
.../java/org/apache/juneau/html/dto/Li.java | 2 +-
.../java/org/apache/juneau/html/dto/Link.java | 2 +-
.../java/org/apache/juneau/html/dto/Main.java | 2 +-
.../java/org/apache/juneau/html/dto/Map.java | 2 +-
.../java/org/apache/juneau/html/dto/Mark.java | 2 +-
.../java/org/apache/juneau/html/dto/Menu.java | 2 +-
.../java/org/apache/juneau/html/dto/Meta.java | 2 +-
.../java/org/apache/juneau/html/dto/Meter.java | 2 +-
.../java/org/apache/juneau/html/dto/Nav.java | 2 +-
.../org/apache/juneau/html/dto/Noscript.java | 2 +-
.../java/org/apache/juneau/html/dto/Object.java | 2 +-
.../java/org/apache/juneau/html/dto/Ol.java | 2 +-
.../org/apache/juneau/html/dto/Optgroup.java | 2 +-
.../java/org/apache/juneau/html/dto/Option.java | 2 +-
.../java/org/apache/juneau/html/dto/Output.java | 2 +-
.../main/java/org/apache/juneau/html/dto/P.java | 2 +-
.../java/org/apache/juneau/html/dto/Param.java | 2 +-
.../java/org/apache/juneau/html/dto/Pre.java | 2 +-
.../org/apache/juneau/html/dto/Progress.java | 2 +-
.../main/java/org/apache/juneau/html/dto/Q.java | 2 +-
.../java/org/apache/juneau/html/dto/Rb.java | 2 +-
.../java/org/apache/juneau/html/dto/Rp.java | 2 +-
.../java/org/apache/juneau/html/dto/Rt.java | 2 +-
.../java/org/apache/juneau/html/dto/Rtc.java | 2 +-
.../java/org/apache/juneau/html/dto/Ruby.java | 2 +-
.../main/java/org/apache/juneau/html/dto/S.java | 2 +-
.../java/org/apache/juneau/html/dto/Samp.java | 2 +-
.../java/org/apache/juneau/html/dto/Script.java | 2 +-
.../org/apache/juneau/html/dto/Section.java | 2 +-
.../java/org/apache/juneau/html/dto/Select.java | 2 +-
.../java/org/apache/juneau/html/dto/Small.java | 2 +-
.../java/org/apache/juneau/html/dto/Source.java | 2 +-
.../java/org/apache/juneau/html/dto/Span.java | 2 +-
.../java/org/apache/juneau/html/dto/Strong.java | 2 +-
.../java/org/apache/juneau/html/dto/Style.java | 2 +-
.../java/org/apache/juneau/html/dto/Sub.java | 2 +-
.../org/apache/juneau/html/dto/Summary.java | 2 +-
.../java/org/apache/juneau/html/dto/Sup.java | 2 +-
.../java/org/apache/juneau/html/dto/Table.java | 2 +-
.../java/org/apache/juneau/html/dto/Tbody.java | 2 +-
.../java/org/apache/juneau/html/dto/Td.java | 2 +-
.../org/apache/juneau/html/dto/Template.java | 2 +-
.../org/apache/juneau/html/dto/Textarea.java | 2 +-
.../java/org/apache/juneau/html/dto/Tfoot.java | 2 +-
.../java/org/apache/juneau/html/dto/Th.java | 2 +-
.../java/org/apache/juneau/html/dto/Thead.java | 2 +-
.../java/org/apache/juneau/html/dto/Time.java | 2 +-
.../java/org/apache/juneau/html/dto/Title.java | 2 +-
.../java/org/apache/juneau/html/dto/Tr.java | 2 +-
.../java/org/apache/juneau/html/dto/Track.java | 2 +-
.../main/java/org/apache/juneau/html/dto/U.java | 2 +-
.../java/org/apache/juneau/html/dto/Ul.java | 2 +-
.../java/org/apache/juneau/html/dto/Var.java | 2 +-
.../java/org/apache/juneau/html/dto/Video.java | 2 +-
.../java/org/apache/juneau/html/dto/Wbr.java | 2 +-
.../java/org/apache/juneau/jena/RdfParser.java | 84 +++++------
.../org/apache/juneau/jena/RdfSerializer.java | 50 +++----
.../java/org/apache/juneau/json/JsonParser.java | 76 +++++-----
.../juneau/json/JsonSchemaSerializer.java | 30 ++--
.../org/apache/juneau/json/JsonSerializer.java | 34 ++---
.../apache/juneau/msgpack/MsgPackParser.java | 76 +++++-----
.../juneau/msgpack/MsgPackSerializer.java | 36 ++---
.../java/org/apache/juneau/parser/Parser.java | 16 +--
.../juneau/serializer/SerializerSession.java | 16 +--
.../juneau/transform/AnnotationBeanFilter.java | 17 +--
.../org/apache/juneau/transform/BeanFilter.java | 20 +--
.../apache/juneau/urlencoding/UonParser.java | 86 +++++------
.../juneau/urlencoding/UonSerializer.java | 32 ++---
.../juneau/urlencoding/UrlEncodingParser.java | 44 +++---
.../urlencoding/UrlEncodingSerializer.java | 24 ++--
.../apache/juneau/xml/XmlBeanPropertyMeta.java | 4 +-
.../java/org/apache/juneau/xml/XmlParser.java | 74 +++++-----
.../apache/juneau/xml/XmlSchemaSerializer.java | 6 +-
.../org/apache/juneau/xml/XmlSerializer.java | 66 ++++-----
.../java/org/apache/juneau/BeanFilterTest.java | 8 +-
.../juneau/a/rttests/RoundTripBeanMapsTest.java | 10 +-
.../a/rttests/RoundTripTransformBeansTest.java | 2 +-
.../org/apache/juneau/xml/XmlCollapsedTest.java | 2 +-
.../org/apache/juneau/xml/XmlContentTest.java | 4 +-
.../java/org/apache/juneau/xml/XmlTest.java | 92 ++++++------
.../java/org/apache/juneau/xml/xml1a/T2.java | 2 +-
.../java/org/apache/juneau/xml/xml1b/T4.java | 2 +-
.../java/org/apache/juneau/xml/xml1b/T5.java | 2 +-
.../juneau/samples/addressbook/Address.java | 2 +-
.../juneau/samples/addressbook/AddressBook.java | 2 +-
.../samples/addressbook/CreateAddress.java | 2 +-
.../samples/addressbook/CreatePerson.java | 2 +-
.../juneau/samples/addressbook/Person.java | 2 +-
170 files changed, 886 insertions(+), 973 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e1c60b10/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 d8add3a..7067840 100644
--- a/juneau-core/src/main/java/org/apache/juneau/BeanContext.java
+++ b/juneau-core/src/main/java/org/apache/juneau/BeanContext.java
@@ -2,7 +2,7 @@
// * 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 *
+// * with the License. You may obtain a copy of the License at *
// * *
// * http://www.apache.org/licenses/LICENSE-2.0 *
// * *
@@ -447,19 +447,19 @@ public class BeanContext extends Context {
public static final String BEAN_implClasses_put = "BeanContext.implClasses.map.put";
/**
- * Specifies the list of classes that make up the class lexicon for this bean context (<code>List<Class></code>).
+ * Specifies the list of classes that make up the class dictionary for this bean context (<code>List<Class></code>).
*/
- public static final String BEAN_classLexicon = "BeanContext.classLexicon.list";
+ public static final String BEAN_typeDictionary = "BeanContext.typeDictionary.list";
/**
- * Add to the class lexicon list.
+ * Add to the class dictionary list.
*/
- public static final String BEAN_classLexicon_add = "BeanContext.classLexicon.list.add";
+ public static final String BEAN_typeDictionary_add = "BeanContext.typeDictionary.list.add";
/**
- * Remove from the class lexicon list.
+ * Remove from the class dictionary list.
*/
- public static final String BEAN_classLexicon_remove = "BeanContext.classLexicon.list.remove";
+ public static final String BEAN_typeDictionary_remove = "BeanContext.typeDictionary.list.remove";
/**
* Specifies the default parser to use when converting <code>Strings</code> to POJOs in the {@link BeanContext#convertToType(Object, Class)} method (<code>Class</code>).
@@ -540,7 +540,7 @@ public class BeanContext extends Context {
final String[] notBeanPackageNames, notBeanPackagePrefixes;
final BeanFilter<?>[] beanFilters;
final PojoSwap<?,?>[] pojoSwaps;
- final ClassLexicon classLexicon;
+ final TypeDictionary typeDictionary;
final Map<Class<?>,Class<?>> implClasses;
final Class<?>[] implKeyClasses, implValueClasses;
final ClassLoader classLoader;
@@ -631,7 +631,7 @@ public class BeanContext extends Context {
}
pojoSwaps = lpf.toArray(new PojoSwap[0]);
- classLexicon = new ClassLexicon(pm.get(BEAN_classLexicon, Class[].class, new Class[0]));
+ typeDictionary = new TypeDictionary(pm.get(BEAN_typeDictionary, Class[].class, new Class[0]));
implClasses = new TreeMap<Class<?>,Class<?>>(new ClassComparator());
Map<Class,Class> m = pm.getMap(BEAN_implClasses, Class.class, Class.class, null);
@@ -1475,12 +1475,12 @@ public class BeanContext extends Context {
}
/**
- * Returns the class lexicon defined in this bean context defined by {@link BeanContext#BEAN_classLexicon}.
+ * Returns the type dictionary defined in this bean context defined by {@link BeanContext#BEAN_typeDictionary}.
*
- * @return The class lexicon defined in this bean context. Never <jk>null</jk>.
+ * @return The type dictionary defined in this bean context. Never <jk>null</jk>.
*/
- protected ClassLexicon getClassLexicon() {
- return classLexicon;
+ protected TypeDictionary getTypeDictionary() {
+ return typeDictionary;
}
/**
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e1c60b10/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 fc65f54..41a8e88 100644
--- a/juneau-core/src/main/java/org/apache/juneau/BeanMeta.java
+++ b/juneau-core/src/main/java/org/apache/juneau/BeanMeta.java
@@ -141,7 +141,7 @@ public class BeanMeta<T> {
MetadataMap extMeta = new MetadataMap();
BeanPropertyMeta subTypeIdProperty;
PropertyNamer propertyNamer;
- ClassLexicon classLexicon;
+ TypeDictionary typeDictionary;
private Builder(ClassMeta<T> classMeta, BeanContext ctx, BeanFilter<? extends T> beanFilter, String[] pNames) {
this.classMeta = classMeta;
@@ -225,7 +225,7 @@ public class BeanMeta<T> {
if (beanFilter.getPropertyNamer() != null)
propertyNamer = beanFilter.getPropertyNamer();
- classLexicon = beanFilter.getClassLexicon();
+ typeDictionary = beanFilter.getTypeDictionary();
}
if (propertyNamer == null)
@@ -337,8 +337,8 @@ public class BeanMeta<T> {
properties.put(subTypeProperty, this.subTypeIdProperty);
}
- if (classLexicon == null)
- classLexicon = ctx.getClassLexicon();
+ if (typeDictionary == null)
+ typeDictionary = ctx.getTypeDictionary();
properties.putAll(normalProps);
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e1c60b10/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 6860b51..c5adea6 100644
--- a/juneau-core/src/main/java/org/apache/juneau/BeanPropertyMeta.java
+++ b/juneau-core/src/main/java/org/apache/juneau/BeanPropertyMeta.java
@@ -2,7 +2,7 @@
// * 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 *
+// * with the License. You may obtain a copy of the License at *
// * *
// * http://www.apache.org/licenses/LICENSE-2.0 *
// * *
@@ -58,7 +58,7 @@ public class BeanPropertyMeta {
private PojoSwap swap; // PojoSwap defined only via @BeanProperty annotation.
private MetadataMap extMeta = new MetadataMap(); // Extended metadata
- private ClassLexicon classLexicon;
+ private TypeDictionary typeDictionary;
/**
* Constructor.
@@ -144,18 +144,18 @@ public class BeanPropertyMeta {
}
/**
- * Returns the class lexicon in use for this bean property.
- * The order of lookup for the lexicon is as follows:
+ * Returns the class dictionary in use for this bean property.
+ * The order of lookup for the dictionary is as follows:
* <ol>
- * <li>Lexicon defined via {@link BeanProperty#classLexicon()}.
- * <li>Lexicon defined via {@link Bean#classLexicon()} or {@link Pojo#classLexicon()} (or {@link BeanFilter} equivalent).
- * <li>Lexicon defined via {@link BeanContext#BEAN_classLexicon} context property.
+ * <li>Dictionary defined via {@link BeanProperty#typeDictionary()}.
+ * <li>Dictionary defined via {@link Bean#typeDictionary()} (or {@link BeanFilter} equivalent).
+ * <li>Dictionary defined via {@link BeanContext#BEAN_typeDictionary} context property.
* </ol>
*
- * @return The class lexicon in use for this bean property. Never <jk>null</jk>.
+ * @return The class dictionary in use for this bean property. Never <jk>null</jk>.
*/
- public ClassLexicon getClassLexicon() {
- return classLexicon;
+ public TypeDictionary getTypeDictionary() {
+ return typeDictionary;
}
/**
@@ -256,8 +256,8 @@ public class BeanPropertyMeta {
swap = getPropertyPojoSwap(p);
if (p.properties().length != 0)
properties = p.properties();
- if (p.classLexicon().length > 0)
- this.classLexicon = new ClassLexicon(p.classLexicon());
+ if (p.typeDictionary().length > 0)
+ this.typeDictionary = new TypeDictionary(p.typeDictionary());
}
}
@@ -271,8 +271,8 @@ public class BeanPropertyMeta {
swap = getPropertyPojoSwap(p);
if (properties != null && p.properties().length != 0)
properties = p.properties();
- if (p.classLexicon().length > 0)
- this.classLexicon = new ClassLexicon(p.classLexicon());
+ if (p.typeDictionary().length > 0)
+ this.typeDictionary = new TypeDictionary(p.typeDictionary());
}
}
@@ -286,8 +286,8 @@ public class BeanPropertyMeta {
swap = getPropertyPojoSwap(p);
if (properties != null && p.properties().length != 0)
properties = p.properties();
- if (p.classLexicon().length > 0)
- this.classLexicon = new ClassLexicon(p.classLexicon());
+ if (p.typeDictionary().length > 0)
+ this.typeDictionary = new TypeDictionary(p.typeDictionary());
}
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e1c60b10/juneau-core/src/main/java/org/apache/juneau/ClassLexicon.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/ClassLexicon.java b/juneau-core/src/main/java/org/apache/juneau/ClassLexicon.java
deleted file mode 100644
index 8725c3e..0000000
--- a/juneau-core/src/main/java/org/apache/juneau/ClassLexicon.java
+++ /dev/null
@@ -1,141 +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;
-
-import java.util.*;
-
-import org.apache.juneau.annotation.*;
-import org.apache.juneau.internal.*;
-
-/**
- * A lookup table for resolving classes by name.
- * <p>
- * In a nutshell, provides a simple mapping of class objects to identifying names by implementing the following two methods:
- * <ul>
- * <li>{@link #getClassForName(String)}
- * <li>{@link #getNameForClass(Class)}
- * </ul>
- * <p>
- * Class names are defined through the {@link Bean#name()} or {@link Pojo#name()} annotations when using the {@link ClassLexicon#ClassLexicon(Class...)}
- * constructor, but can be defined programmatically by using the {@link ClassLexicon#ClassLexicon(Map)} constructor.
- * <p>
- * The lexicon is used by the framework in the following ways:
- * <ul>
- * <li>If a class type cannot be inferred through reflection during parsing, then a helper <js>"_class"</js> is added to the serialized output
- * using the name defined for that class in this lexicon. This helps determine the real class at parse time.
- * <li>The lexicon name is used as element names when serialized to XML.
- * </ul>
- *
- * @author james.bognar
- */
-public class ClassLexicon {
-
- private final Map<String,Class<?>> map;
- private final Map<Class<?>,String> reverseMap;
-
- /**
- * Constructor.
- *
- * @param classes
- * List of classes to add to this lexicon table.
- * Each class must be one of the following:
- * <ul>
- * <li>A bean class that specifies a value for {@link Bean#name() @Bean.name()}.
- * <li>A POJO class that specifies a value for {@link Pojo#name() @Pojo.name()}.
- * <li>A subclass of {@link ClassLexicon} whose contents will be added to this list.
- * Note that this subclass must implement a no-arg constructor.
- * </ul>
- */
- public ClassLexicon(Class<?>...classes) {
- this(null, classes);
- }
-
- /**
- * Constructor with optional copy-from lexicon.
- *
- * @param copyFrom The lexicon to initialize the contents of this lexicon with.
- * @param classes List of classes to add to this lexicon.
- */
- public ClassLexicon(ClassLexicon copyFrom, Class<?>...classes) {
- Map<String,Class<?>> m = new HashMap<String,Class<?>>();
- if (copyFrom != null)
- m.putAll(copyFrom.map);
- for (Class<?> c : classes) {
- if (c != null) {
- if (ClassUtils.isParentClass(ClassLexicon.class, c)) {
- try {
- ClassLexicon l2 = (ClassLexicon)c.newInstance();
- m.putAll(l2.map);
- } catch (Exception e) {
- throw new BeanRuntimeException(e);
- }
- } else {
- Pojo p = c.getAnnotation(Pojo.class);
- Bean b = c.getAnnotation(Bean.class);
- String name = null;
- if (p != null && ! p.name().isEmpty()) {
- name = p.name();
- } else if (b != null && ! b.name().isEmpty()) {
- name = b.name();
- } else {
- name = c.getName();
- }
- m.put(name, c);
- }
- }
- }
- this.map = Collections.unmodifiableMap(m);
- Map<Class<?>,String> m2 = new HashMap<Class<?>,String>();
- for (Map.Entry<String,Class<?>> e : map.entrySet())
- m2.put(e.getValue(), e.getKey());
- this.reverseMap = Collections.unmodifiableMap(m2);
- }
-
-
- /**
- * Alternate constructor for defining a lexicon through a user-defined name/class map.
- *
- * @param classMap
- * Contains the name/class pairs to add to this lookup table.
- */
- public ClassLexicon(Map<String,Class<?>> classMap) {
- if (classMap == null)
- throw new BeanRuntimeException("Null passed to ClassLexicon(Map) constructor.");
- Map<String,Class<?>> m = new HashMap<String,Class<?>>(classMap);
- this.map = Collections.unmodifiableMap(m);
- Map<Class<?>,String> m2 = new HashMap<Class<?>,String>();
- for (Map.Entry<String,Class<?>> e : map.entrySet())
- m2.put(e.getValue(), e.getKey());
- this.reverseMap = Collections.unmodifiableMap(m2);
- }
-
- /**
- * Returns the class associated with the specified name.
- *
- * @param name The name associated with the class.
- * @return The class associated with the specified name, or <jk>null</jk> if no association exists.
- */
- public Class<?> getClassForName(String name) {
- return map.get(name);
- }
-
- /**
- * Returns the name associated with the specified class.
- *
- * @param c The class associated with the name.
- * @return The name associated with the specified class, or <jk>null</jk> if no association exists.
- */
- public String getNameForClass(Class<?> c) {
- return reverseMap.get(c);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e1c60b10/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 2b7ce15..d531d0e 100644
--- a/juneau-core/src/main/java/org/apache/juneau/ClassMeta.java
+++ b/juneau-core/src/main/java/org/apache/juneau/ClassMeta.java
@@ -83,7 +83,7 @@ public final class ClassMeta<T> implements Type {
isMemberClass; // True if this is a non-static member class.
private MetadataMap extMeta = new MetadataMap(); // Extended metadata
- private ClassLexicon classLexicon; // The class lexicon defined on this bean or pojo.
+ private TypeDictionary typeDictionary; // The class dictionary defined on this bean or pojo.
private String name; // The lexical name associated with this bean or pojo.
private Throwable initException; // Any exceptions thrown in the init() method.
@@ -131,18 +131,12 @@ public final class ClassMeta<T> implements Type {
beanFilter = findBeanFilter(beanContext);
pojoSwap = findPojoSwap(beanContext);
- classLexicon = beanContext.getClassLexicon();
- for (Pojo p : ReflectionUtils.findAnnotationsParentFirst(Pojo.class, innerClass)) {
- if (p.classLexicon().length > 0)
- classLexicon = new ClassLexicon(p.classLexicon());
- if (! p.name().isEmpty())
- name = p.name();
- }
+ typeDictionary = beanContext.getTypeDictionary();
for (Bean b : ReflectionUtils.findAnnotationsParentFirst(Bean.class, innerClass)) {
- if (b.classLexicon().length > 0)
- classLexicon = new ClassLexicon(b.classLexicon());
- if (! b.name().isEmpty())
- name = b.name();
+ if (b.typeDictionary().length > 0)
+ typeDictionary = new TypeDictionary(b.typeDictionary());
+ if (! b.typeName().isEmpty())
+ name = b.typeName();
}
serializedClassMeta = (pojoSwap == null ? this : beanContext.getClassMeta(pojoSwap.getSwapClass()));
@@ -392,27 +386,27 @@ public final class ClassMeta<T> implements Type {
}
/**
- * Returns the class lexicon in use for this class.
- * The order of lookup for the lexicon is as follows:
+ * Returns the class dictionary in use for this class.
+ * The order of lookup for the dictionary is as follows:
* <ol>
- * <li>Lexicon defined via {@link Bean#classLexicon()} or {@link Pojo#classLexicon()} (or {@link BeanFilter} equivalent).
- * <li>Lexicon defined via {@link BeanContext#BEAN_classLexicon} context property.
+ * <li>Dictionary defined via {@link Bean#typeDictionary()} (or {@link BeanFilter} equivalent).
+ * <li>Dictionary defined via {@link BeanContext#BEAN_typeDictionary} context property.
* </ol>
*
- * @return The class lexicon in use for this class. Never <jk>null</jk>.
+ * @return The class dictionary in use for this class. Never <jk>null</jk>.
*/
- public ClassLexicon getClassLexicon() {
- return classLexicon;
+ public TypeDictionary getDictionary() {
+ return typeDictionary;
}
/**
* Returns the lexical name associated with this class.
* <p>
- * The lexical name is defined by either {@link Bean#name()} or {@link Pojo#name()}.
+ * The lexical name is defined by {@link Bean#typeName()}.
*
* @return The lexical name associated with this class, or <jk>null</jk> if there is no lexical name defined.
*/
- public String getLexiconName() {
+ public String getDictionaryName() {
return name;
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e1c60b10/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 a310a7d..5162895 100644
--- a/juneau-core/src/main/java/org/apache/juneau/ObjectMap.java
+++ b/juneau-core/src/main/java/org/apache/juneau/ObjectMap.java
@@ -2,7 +2,7 @@
// * 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 *
+// * with the License. You may obtain a copy of the License at *
// * *
// * http://www.apache.org/licenses/LICENSE-2.0 *
// * *
@@ -1150,26 +1150,26 @@ public class ObjectMap extends LinkedHashMap<String,Object> {
* same object if entry does not exist.
*/
public Object cast() {
- return cast((ClassLexicon)null);
+ return cast((TypeDictionary)null);
}
/**
- * Same as {@link #cast()}, but first do a lookup for the name in the specified lexicon.
+ * Same as {@link #cast()}, but first do a lookup for the name in the specified dictionary.
*
- * @param classLexicon
+ * @param typeDictionary
* The class lexicon to resolve the name. Can be <jk>null</jk>.
* @return The new Java object of type specified by the <js>"_class"</js> entry value, or this
* same object if entry does not exist.
*/
- public Object cast(ClassLexicon classLexicon) {
+ public Object cast(TypeDictionary typeDictionary) {
String c = (String)get("_class");
if (c == null) {
if (containsKey("_value"))
return get("_value");
return this;
}
- if (classLexicon != null) {
- Class<?> c2 = classLexicon.getClassForName(c);
+ if (typeDictionary != null) {
+ Class<?> c2 = typeDictionary.getClassForName(c);
if (c2 != null)
return cast2(beanContext.getClassMeta(c2));
}
@@ -1266,7 +1266,7 @@ public class ObjectMap extends LinkedHashMap<String,Object> {
// Attempt to recursively cast child maps.
if (v instanceof ObjectMap)
- v = ((ObjectMap)v).cast(beanContext.classLexicon);
+ v = ((ObjectMap)v).cast(beanContext.typeDictionary);
k = (kType.isString() ? k : beanContext.convertToType(k, kType));
v = (vType.isObject() ? v : beanContext.convertToType(v, vType));
@@ -1287,7 +1287,7 @@ public class ObjectMap extends LinkedHashMap<String,Object> {
// Attempt to recursively cast child maps.
if (v instanceof ObjectMap)
- v = ((ObjectMap)v).cast(beanContext.classLexicon);
+ v = ((ObjectMap)v).cast(beanContext.typeDictionary);
bm.put(k, v);
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e1c60b10/juneau-core/src/main/java/org/apache/juneau/TypeDictionary.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/TypeDictionary.java b/juneau-core/src/main/java/org/apache/juneau/TypeDictionary.java
new file mode 100644
index 0000000..0107267
--- /dev/null
+++ b/juneau-core/src/main/java/org/apache/juneau/TypeDictionary.java
@@ -0,0 +1,137 @@
+// ***************************************************************************************************************************
+// * 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;
+
+import java.util.*;
+
+import org.apache.juneau.annotation.*;
+import org.apache.juneau.internal.*;
+
+/**
+ * A lookup table for resolving classes by name.
+ * <p>
+ * In a nutshell, provides a simple mapping of class objects to identifying names by implementing the following two methods:
+ * <ul>
+ * <li>{@link #getClassForName(String)}
+ * <li>{@link #getNameForClass(Class)}
+ * </ul>
+ * <p>
+ * Class names are defined through the {@link Bean#typeName()} annotations when using the {@link TypeDictionary#TypeDictionary(Class...)}
+ * constructor, but can be defined programmatically by using the {@link TypeDictionary#TypeDictionary(Map)} constructor.
+ * <p>
+ * The dictionary is used by the framework in the following ways:
+ * <ul>
+ * <li>If a class type cannot be inferred through reflection during parsing, then a helper <js>"_class"</js> is added to the serialized output
+ * using the name defined for that class in this dictionary. This helps determine the real class at parse time.
+ * <li>The dictionary name is used as element names when serialized to XML.
+ * </ul>
+ *
+ * @author james.bognar
+ */
+public class TypeDictionary {
+
+ private final Map<String,Class<?>> map;
+ private final Map<Class<?>,String> reverseMap;
+
+ /**
+ * Constructor.
+ *
+ * @param classes
+ * List of classes to add to this dictionary table.
+ * Each class must be one of the following:
+ * <ul>
+ * <li>A bean class that specifies a value for {@link Bean#typeName() @Bean.name()}.
+ * <li>A subclass of {@link TypeDictionary} whose contents will be added to this list.
+ * Note that this subclass must implement a no-arg constructor.
+ * </ul>
+ */
+ public TypeDictionary(Class<?>...classes) {
+ this(null, classes);
+ }
+
+ /**
+ * Constructor with optional copy-from dictionary.
+ *
+ * @param copyFrom The dictionary to initialize the contents of this dictionary with.
+ * @param classes List of classes to add to this dictionary.
+ */
+ public TypeDictionary(TypeDictionary copyFrom, Class<?>...classes) {
+ Map<String,Class<?>> m = new HashMap<String,Class<?>>();
+ if (copyFrom != null)
+ m.putAll(copyFrom.map);
+ for (Class<?> c : classes) {
+ if (c != null) {
+ if (ClassUtils.isParentClass(TypeDictionary.class, c)) {
+ try {
+ TypeDictionary l2 = (TypeDictionary)c.newInstance();
+ m.putAll(l2.map);
+ } catch (Exception e) {
+ throw new BeanRuntimeException(e);
+ }
+ } else {
+ Bean b = c.getAnnotation(Bean.class);
+ String name = null;
+ if (b != null && ! b.typeName().isEmpty()) {
+ name = b.typeName();
+ } else {
+ name = c.getName();
+ }
+ m.put(name, c);
+ }
+ }
+ }
+ this.map = Collections.unmodifiableMap(m);
+ Map<Class<?>,String> m2 = new HashMap<Class<?>,String>();
+ for (Map.Entry<String,Class<?>> e : map.entrySet())
+ m2.put(e.getValue(), e.getKey());
+ this.reverseMap = Collections.unmodifiableMap(m2);
+ }
+
+
+ /**
+ * Alternate constructor for defining a dictionary through a user-defined name/class map.
+ *
+ * @param classMap
+ * Contains the name/class pairs to add to this lookup table.
+ */
+ public TypeDictionary(Map<String,Class<?>> classMap) {
+ if (classMap == null)
+ throw new BeanRuntimeException("Null passed to TypeDictionary(Map) constructor.");
+ Map<String,Class<?>> m = new HashMap<String,Class<?>>(classMap);
+ this.map = Collections.unmodifiableMap(m);
+ Map<Class<?>,String> m2 = new HashMap<Class<?>,String>();
+ for (Map.Entry<String,Class<?>> e : map.entrySet())
+ m2.put(e.getValue(), e.getKey());
+ this.reverseMap = Collections.unmodifiableMap(m2);
+ }
+
+ /**
+ * Returns the class associated with the specified name.
+ *
+ * @param name The name associated with the class.
+ * @return The class associated with the specified name, or <jk>null</jk> if no association exists.
+ */
+ public Class<?> getClassForName(String name) {
+ return map.get(name);
+ }
+
+ /**
+ * Returns the name associated with the specified class.
+ *
+ * @param c The class associated with the name.
+ * @return The name associated with the specified class, or <jk>null</jk> if no association exists.
+ */
+ public String getNameForClass(Class<?> c) {
+ return reverseMap.get(c);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e1c60b10/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 388c01f..f2859f1 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
@@ -2,7 +2,7 @@
// * 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 *
+// * with the License. You may obtain a copy of the License at *
// * *
// * http://www.apache.org/licenses/LICENSE-2.0 *
// * *
@@ -49,25 +49,25 @@ public @interface Bean {
* output so that the class can be determined during parsing.
* It is also used to specify element names in XML.
* <p>
- * The name is used in combination with the lexicon defined through {@link #classLexicon()}. Together, they make up
+ * The name is used in combination with the class dictionary defined through {@link #typeDictionary()}. Together, they make up
* a simple name/value mapping of names to classes.
- * Names do not need to be universally unique. However, they must be unique within a lexicon.
+ * Names do not need to be universally unique. However, they must be unique within a dictionary.
*
* <dl>
* <dt>Example:</dt>
* <dd>
* <p class='bcode'>
- * <ja>@Bean</ja>(name=<js>"foo"</js>)
+ * <ja>@Bean</ja>(typeName=<js>"foo"</js>)
* <jk>public class</jk> Foo {
* <jc>// A bean property where the object types cannot be inferred since it's an Object[].</jc>
- * <ja>@BeanProperty</ja>(lexicon={Bar.<jk>class</jk>,Baz.<jk>class</jk>})
+ * <ja>@BeanProperty</ja>(typeDictionary={Bar.<jk>class</jk>,Baz.<jk>class</jk>})
* <jk>public</jk> Object[] x = <jk>new</jk> Object[]{<jk>new</jk> Bar(), <jk>new</jk> Baz()};
* }
*
- * <ja>@Bean</ja>(name=<js>"bar"</js>)
+ * <ja>@Bean</ja>(typeName=<js>"bar"</js>)
* <jk>public class</jk> Bar {}
*
- * <ja>@Bean</ja>(name=<js>"baz"</js>)
+ * <ja>@Bean</ja>(typeName=<js>"baz"</js>)
* <jk>public class</jk> Baz {}
* </p>
* <p>
@@ -87,30 +87,29 @@ public @interface Bean {
* <p class='bcode'>
* {
* <jsa>x</jsa>: [
- * {<jsa>n</jsa>:<jss>'bar'</jss>},
- * {<jsa>n</jsa>:<jss>'baz'</jss>}
+ * {<jsa>_type</jsa>:<jss>'bar'</jss>},
+ * {<jsa>_type</jsa>:<jss>'baz'</jss>}
* ]
* } *
* </dd>
* </dl>
*/
- String name() default "";
+ String typeName() default "";
/**
- * The list of classes that make up the class lexicon for this class.
+ * The list of classes that make up the class dictionary for this class.
* <p>
- * The lexicon is a name/class mapping used to find class types during parsing when they cannot be inferred through reflection.
- * The names are defined through the {@link #name()} annotation defined on the bean or POJO classes.
+ * The dictionary is a name/class mapping used to find class types during parsing when they cannot be inferred through reflection.
+ * The names are defined through the {@link #typeName()} annotation defined on the bean or POJO classes.
* <p>
* This list can consist of the following class types:
* <ul>
- * <li>Any bean class that specifies a value for {@link Bean#name() @Bean.name()};
- * <li>Any POJO class that specifies a value for {@link Pojo#name() @Pojo.name()};
- * <li>Any subclass of {@link ClassLexicon} that defines an entire set of mappings.
+ * <li>Any bean class that specifies a value for {@link Bean#typeName() @Bean.name()};
+ * <li>Any subclass of {@link TypeDictionary} that defines an entire set of mappings.
* Note that the subclass MUST implement a no-arg constructor so that it can be instantiated.
* </ul>
*/
- Class<?>[] classLexicon() default {};
+ Class<?>[] typeDictionary() default {};
/**
* The set and order of names of properties associated with a bean class.
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e1c60b10/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 8e8ef8b..2db87ca 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
@@ -2,7 +2,7 @@
// * 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 *
+// * with the License. You may obtain a copy of the License at *
// * *
// * http://www.apache.org/licenses/LICENSE-2.0 *
// * *
@@ -169,19 +169,18 @@ public @interface BeanProperty {
String[] properties() default {};
/**
- * The list of classes that make up the class lexicon for this bean proeprty.
+ * The list of classes that make up the class dictionary for this bean proeprty.
* <p>
- * The lexicon is a name/class mapping used to find class types during parsing when they cannot be inferred through reflection.
+ * The dictionary is a name/class mapping used to find class types during parsing when they cannot be inferred through reflection.
* The names are defined through the {@link #name()} annotation defined on the bean or POJO classes.
* <p>
* This list can consist of the following class types:
* <ul>
- * <li>Any bean class that specifies a value for {@link Bean#name() @Bean.name()};
- * <li>Any POJO class that specifies a value for {@link Pojo#name() @Pojo.name()};
- * <li>Any subclass of {@link ClassLexicon} that defines an entire set of mappings.
+ * <li>Any bean class that specifies a value for {@link Bean#typeName() @Bean.name()};
+ * <li>Any subclass of {@link TypeDictionary} that defines an entire set of mappings.
* Note that the subclass MUST implement a no-arg constructor so that it can be instantiated.
* </ul>
*/
- Class<?>[] classLexicon() default {};
+ Class<?>[] typeDictionary() default {};
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e1c60b10/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 49eb259..baaac26 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
@@ -2,7 +2,7 @@
// * 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 *
+// * with the License. You may obtain a copy of the License at *
// * *
// * http://www.apache.org/licenses/LICENSE-2.0 *
// * *
@@ -17,7 +17,6 @@ import static java.lang.annotation.RetentionPolicy.*;
import java.lang.annotation.*;
-import org.apache.juneau.*;
import org.apache.juneau.internal.*;
import org.apache.juneau.transform.*;
@@ -33,77 +32,6 @@ import org.apache.juneau.transform.*;
public @interface Pojo {
/**
- * An identifying name for this class.
- * <p>
- * The name is used to identify the class type during parsing when it cannot be inferred through reflection.
- * For example, if a bean property is of type <code>Object</code>, then the serializer will add the name to the
- * output so that the class can be determined during parsing.
- * It is also used to specify element names in XML.
- * <p>
- * The name is used in combination with the lexicon defined through {@link #classLexicon()}. Together, they make up
- * a simple name/value mapping of names to classes.
- * Names do not need to be universally unique. However, they must be unique within a lexicon.
- *
- * <dl>
- * <dt>Example:</dt>
- * <dd>
- * <p class='bcode'>
- * <ja>@Bean</ja>(name=<js>"foo"</js>)
- * <jk>public class</jk> Foo {
- * <jc>// A bean property where the object types cannot be inferred since it's an Object[].</jc>
- * <ja>@BeanProperty</ja>(lexicon={Bar.<jk>class</jk>,Baz.<jk>class</jk>})
- * <jk>public</jk> Object[] x = <jk>new</jk> Object[]{<jk>new</jk> Bar(), <jk>new</jk> Baz()};
- * }
- *
- * <ja>@Pojo</ja>(name=<js>"bar"</js>)
- * <jk>public class</jk> Bar <jk>extends</jk> HashMap {}
- *
- * <ja>@Pojo</ja>(name=<js>"baz"</js>)
- * <jk>public class</jk> Baz <jk>extends</jk> HashMap {}
- * </p>
- * <p>
- * When serialized as XML, the bean is rendered as:
- * </p>
- * <p class='bcode'>
- * <xt><foo></xt>
- * <xt><x></xt>
- * <xt><bar/>v
- * <xt><baz/></xt>
- * <xt></x></xt>
- * <xt></foo></xt>
- * </p>
- * <p>
- * When serialized as JSON, <js>'n'</js> attributes would be added when needed to infer the type during parsing:
- * </p>
- * <p class='bcode'>
- * {
- * <jsa>x</jsa>: [
- * {<jsa>n</jsa>:<jss>'bar'</jss>},
- * {<jsa>n</jsa>:<jss>'baz'</jss>}
- * ]
- * } *
- * </dd>
- * </dl>
- */
- String name() default "";
-
- /**
- * The list of classes that make up the class lexicon for this class.
- * <p>
- * The lexicon is a name/class mapping used to find class types during parsing when they cannot be inferred through reflection.
- * The names are defined through the {@link #name()} annotation defined on the bean or POJO classes.
- * <p>
- * This list can consist of the following class types:
- * <ul>
- * <li>Any bean class that specifies a value for {@link Bean#name() @Bean.name()};
- * <li>Any POJO class that specifies a value for {@link Pojo#name() @Pojo.name()};
- * <li>Any subclass of {@link ClassLexicon} that defines an entire set of mappings.
- * Note that the subclass MUST implement a no-arg constructor so that it can be instantiated.
- * </ul>
- */
- Class<?>[] classLexicon() default {};
-
- /**
* Associate a {@link PojoSwap} or {@link SurrogateSwap} with this class type.
*
* <p>
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e1c60b10/juneau-core/src/main/java/org/apache/juneau/dto/atom/Category.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/dto/atom/Category.java b/juneau-core/src/main/java/org/apache/juneau/dto/atom/Category.java
index 0f6cbdb..cc1b612 100644
--- a/juneau-core/src/main/java/org/apache/juneau/dto/atom/Category.java
+++ b/juneau-core/src/main/java/org/apache/juneau/dto/atom/Category.java
@@ -39,7 +39,7 @@ import org.apache.juneau.xml.annotation.*;
*
* @author James Bognar (james.bognar@salesforce.com)
*/
-@Bean(name="category")
+@Bean(typeName="category")
public class Category extends Common {
private String term;
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e1c60b10/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 051d449..f5bf32d 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
@@ -47,7 +47,7 @@ import org.apache.juneau.transforms.*;
*
* @author James Bognar (james.bognar@salesforce.com)
*/
-@Bean(name="entry")
+@Bean(typeName="entry")
public class Entry extends CommonEntry {
private Content content;
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e1c60b10/juneau-core/src/main/java/org/apache/juneau/dto/atom/Feed.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/dto/atom/Feed.java b/juneau-core/src/main/java/org/apache/juneau/dto/atom/Feed.java
index a12c8d8..527df26 100644
--- a/juneau-core/src/main/java/org/apache/juneau/dto/atom/Feed.java
+++ b/juneau-core/src/main/java/org/apache/juneau/dto/atom/Feed.java
@@ -52,7 +52,7 @@ import org.apache.juneau.xml.annotation.*;
*
* @author James Bognar (james.bognar@salesforce.com)
*/
-@Bean(name="feed")
+@Bean(typeName="feed")
@SuppressWarnings("hiding")
public class Feed extends CommonEntry {
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e1c60b10/juneau-core/src/main/java/org/apache/juneau/dto/atom/Generator.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/dto/atom/Generator.java b/juneau-core/src/main/java/org/apache/juneau/dto/atom/Generator.java
index 65be218..32b146c 100644
--- a/juneau-core/src/main/java/org/apache/juneau/dto/atom/Generator.java
+++ b/juneau-core/src/main/java/org/apache/juneau/dto/atom/Generator.java
@@ -37,7 +37,7 @@ import org.apache.juneau.xml.annotation.*;
*
* @author James Bognar (james.bognar@salesforce.com)
*/
-@Bean(name="generator")
+@Bean(typeName="generator")
public class Generator extends Common {
private URI uri;
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e1c60b10/juneau-core/src/main/java/org/apache/juneau/dto/atom/Icon.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/dto/atom/Icon.java b/juneau-core/src/main/java/org/apache/juneau/dto/atom/Icon.java
index 4736728..00b901a 100644
--- a/juneau-core/src/main/java/org/apache/juneau/dto/atom/Icon.java
+++ b/juneau-core/src/main/java/org/apache/juneau/dto/atom/Icon.java
@@ -35,7 +35,7 @@ import org.apache.juneau.xml.annotation.*;
*
* @author James Bognar (james.bognar@salesforce.com)
*/
-@Bean(name="icon")
+@Bean(typeName="icon")
public class Icon extends Common {
private URI uri;
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e1c60b10/juneau-core/src/main/java/org/apache/juneau/dto/atom/Id.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/dto/atom/Id.java b/juneau-core/src/main/java/org/apache/juneau/dto/atom/Id.java
index 54950cf..f63f729 100644
--- a/juneau-core/src/main/java/org/apache/juneau/dto/atom/Id.java
+++ b/juneau-core/src/main/java/org/apache/juneau/dto/atom/Id.java
@@ -35,7 +35,7 @@ import org.apache.juneau.xml.annotation.*;
*
* @author James Bognar (james.bognar@salesforce.com)
*/
-@Bean(name="id")
+@Bean(typeName="id")
public class Id extends Common {
private String text;
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e1c60b10/juneau-core/src/main/java/org/apache/juneau/dto/atom/Link.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/dto/atom/Link.java b/juneau-core/src/main/java/org/apache/juneau/dto/atom/Link.java
index 45d8e9f..f70f5ca 100644
--- a/juneau-core/src/main/java/org/apache/juneau/dto/atom/Link.java
+++ b/juneau-core/src/main/java/org/apache/juneau/dto/atom/Link.java
@@ -42,7 +42,7 @@ import org.apache.juneau.xml.annotation.*;
*
* @author James Bognar (james.bognar@salesforce.com)
*/
-@Bean(name="link")
+@Bean(typeName="link")
public class Link extends Common {
private String href;
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e1c60b10/juneau-core/src/main/java/org/apache/juneau/dto/atom/Logo.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/dto/atom/Logo.java b/juneau-core/src/main/java/org/apache/juneau/dto/atom/Logo.java
index 2866d53..b2b11f4 100644
--- a/juneau-core/src/main/java/org/apache/juneau/dto/atom/Logo.java
+++ b/juneau-core/src/main/java/org/apache/juneau/dto/atom/Logo.java
@@ -35,7 +35,7 @@ import org.apache.juneau.xml.annotation.*;
*
* @author James Bognar (james.bognar@salesforce.com)
*/
-@Bean(name="logo")
+@Bean(typeName="logo")
public class Logo extends Common {
private URI uri;
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e1c60b10/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 2b8802b..0f21ab7 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
@@ -27,7 +27,7 @@ import org.apache.juneau.xml.annotation.*;
* @author James Bognar (james.bognar@salesforce.com)
*/
@SuppressWarnings({"rawtypes","hiding"})
-@Bean(name="item",properties={"name","type","length"})
+@Bean(typeName="item",properties={"name","type","length"})
public class Column {
private String name, type;
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e1c60b10/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 6932e58..0176bcf 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
@@ -75,7 +75,7 @@ import org.apache.juneau.xml.annotation.*;
* @author James Bognar (james.bognar@salesforce.com)
*/
@SuppressWarnings("unchecked")
-@Bean(name="dataset", properties={"metadata","data"})
+@Bean(typeName="dataset", properties={"metadata","data"})
public class DataSet {
private Column[] metaData;
@@ -136,7 +136,7 @@ public class DataSet {
*
* @author James Bognar (james.bognar@salesforce.com)
*/
- @Bean(name="row")
+ @Bean(typeName="row")
@Xml(childName="value")
public static class Row extends LinkedList<String> {
private static final long serialVersionUID = 1L;
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e1c60b10/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 f135bc3..9196f1e 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
@@ -29,7 +29,7 @@ import org.apache.juneau.transform.*;
* @author James Bognar (james.bognar@salesforce.com)
*/
@SuppressWarnings("hiding")
-@Bean(name="schema",
+@Bean(typeName="schema",
properties={"id","$schema","$ref", "title","description","type","definitions","properties",
"patternProperties","dependencies","items","multipleOf","maximum","exclusiveMaximum",
"minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems",
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e1c60b10/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 de5638f..4fefe0e 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
@@ -67,14 +67,14 @@ public final class HtmlParser extends ReaderParser {
* Precondition: Must be pointing at START_ELEMENT or CHARACTERS event.
* Postcondition: Pointing at next event to be processed.
*/
- private <T> T parseAnything(HtmlParserSession session, ClassMeta<T> nt, XMLEventReader r, Object outer) throws Exception {
+ private <T> T parseAnything(HtmlParserSession session, ClassMeta<T> eType, XMLEventReader r, Object outer) throws Exception {
BeanContext bc = session.getBeanContext();
- if (nt == null)
- nt = (ClassMeta<T>)object();
- PojoSwap<T,Object> transform = (PojoSwap<T,Object>)nt.getPojoSwap();
- ClassMeta<?> ft = nt.getSerializedClassMeta();
- session.setCurrentClass(ft);
+ if (eType == null)
+ eType = (ClassMeta<T>)object();
+ PojoSwap<T,Object> transform = (PojoSwap<T,Object>)eType.getPojoSwap();
+ ClassMeta<?> sType = eType.getSerializedClassMeta();
+ session.setCurrentClass(sType);
Object o = null;
@@ -83,26 +83,26 @@ public final class HtmlParser extends ReaderParser {
event = r.nextEvent();
if (event.isEndDocument())
- throw new XMLStreamException("Unexpected end of stream in parseAnything for type '"+nt+"'", event.getLocation());
+ throw new XMLStreamException("Unexpected end of stream in parseAnything for type '"+eType+"'", event.getLocation());
if (event.isCharacters()) {
String text = parseCharacters(event, r);
- if (ft.isObject())
+ if (sType.isObject())
o = text;
- else if (ft.isCharSequence())
+ else if (sType.isCharSequence())
o = text;
- else if (ft.isNumber())
- o = parseNumber(text, (Class<? extends Number>)nt.getInnerClass());
- else if (ft.isChar())
+ else if (sType.isNumber())
+ o = parseNumber(text, (Class<? extends Number>)eType.getInnerClass());
+ else if (sType.isChar())
o = text.charAt(0);
- else if (ft.isBoolean())
+ else if (sType.isBoolean())
o = Boolean.parseBoolean(text);
- else if (ft.canCreateNewInstanceFromString(outer))
- o = ft.newInstanceFromString(outer, text);
- else if (ft.canCreateNewInstanceFromNumber(outer))
- o = ft.newInstanceFromNumber(outer, parseNumber(text, ft.getNewInstanceFromNumberClass()));
+ else if (sType.canCreateNewInstanceFromString(outer))
+ o = sType.newInstanceFromString(outer, text);
+ else if (sType.canCreateNewInstanceFromNumber(outer))
+ o = sType.newInstanceFromNumber(outer, parseNumber(text, sType.getNewInstanceFromNumberClass()));
else
- throw new XMLStreamException("Unexpected characters '"+event.asCharacters().getData()+"' for type '"+nt+"'", event.getLocation());
+ throw new XMLStreamException("Unexpected characters '"+event.asCharacters().getData()+"' for type '"+eType+"'", event.getLocation());
} else {
Tag tag = Tag.forString(event.asStartElement().getName().getLocalPart(), false);
@@ -117,7 +117,7 @@ public final class HtmlParser extends ReaderParser {
tableType = attrs.get("type");
String c = attrs.get("_class");
if (c != null)
- ft = nt = (ClassMeta<T>)bc.getClassMetaFromString(c);
+ sType = eType = (ClassMeta<T>)bc.getClassMetaFromString(c);
}
boolean isValid = true;
@@ -125,8 +125,8 @@ public final class HtmlParser extends ReaderParser {
if (tag == NULL)
nextTag(r, xNULL);
else if (tag == A)
- o = parseAnchor(session, event, r, nt);
- else if (ft.isObject()) {
+ o = parseAnchor(session, event, r, eType);
+ else if (sType.isObject()) {
if (tag == STRING)
o = text;
else if (tag == NUMBER)
@@ -135,70 +135,70 @@ public final class HtmlParser extends ReaderParser {
o = Boolean.parseBoolean(text);
else if (tag == TABLE) {
if (tableType.equals("object")) {
- o = parseIntoMap(session, r, (Map)new ObjectMap(bc), ft.getKeyType(), ft.getValueType());
+ o = parseIntoMap(session, r, (Map)new ObjectMap(bc), sType.getKeyType(), sType.getValueType());
} else if (tableType.equals("array")) {
- o = parseTableIntoCollection(session, r, (Collection)new ObjectList(bc), ft.getElementType());
+ o = parseTableIntoCollection(session, r, (Collection)new ObjectList(bc), sType.getElementType());
} else
isValid = false;
}
else if (tag == UL)
o = parseIntoCollection(session, r, new ObjectList(bc), null);
}
- else if (tag == STRING && ft.isCharSequence())
+ else if (tag == STRING && sType.isCharSequence())
o = text;
- else if (tag == STRING && ft.isChar())
+ else if (tag == STRING && sType.isChar())
o = text.charAt(0);
- else if (tag == STRING && ft.canCreateNewInstanceFromString(outer))
- o = ft.newInstanceFromString(outer, text);
- else if (tag == NUMBER && ft.isNumber())
- o = parseNumber(text, (Class<? extends Number>)ft.getInnerClass());
- else if (tag == NUMBER && ft.canCreateNewInstanceFromNumber(outer))
- o = ft.newInstanceFromNumber(outer, parseNumber(text, ft.getNewInstanceFromNumberClass()));
- else if (tag == BOOLEAN && ft.isBoolean())
+ else if (tag == STRING && sType.canCreateNewInstanceFromString(outer))
+ o = sType.newInstanceFromString(outer, text);
+ else if (tag == NUMBER && sType.isNumber())
+ o = parseNumber(text, (Class<? extends Number>)sType.getInnerClass());
+ else if (tag == NUMBER && sType.canCreateNewInstanceFromNumber(outer))
+ o = sType.newInstanceFromNumber(outer, parseNumber(text, sType.getNewInstanceFromNumberClass()));
+ else if (tag == BOOLEAN && sType.isBoolean())
o = Boolean.parseBoolean(text);
else if (tag == TABLE) {
if (tableType.equals("object")) {
- if (ft.isMap()) {
- o = parseIntoMap(session, r, (Map)(ft.canCreateNewInstance(outer) ? ft.newInstance(outer) : new ObjectMap(bc)), ft.getKeyType(), ft.getValueType());
- } else if (ft.canCreateNewInstanceFromObjectMap(outer)) {
+ if (sType.isMap()) {
+ o = parseIntoMap(session, r, (Map)(sType.canCreateNewInstance(outer) ? sType.newInstance(outer) : new ObjectMap(bc)), sType.getKeyType(), sType.getValueType());
+ } else if (sType.canCreateNewInstanceFromObjectMap(outer)) {
ObjectMap m = new ObjectMap(bc);
parseIntoMap(session, r, m, string(), object());
- o = ft.newInstanceFromObjectMap(outer, m);
- } else if (ft.canCreateNewBean(outer)) {
- BeanMap m = bc.newBeanMap(outer, ft.getInnerClass());
+ o = sType.newInstanceFromObjectMap(outer, m);
+ } else if (sType.canCreateNewBean(outer)) {
+ BeanMap m = bc.newBeanMap(outer, sType.getInnerClass());
o = parseIntoBean(session, r, m).getBean();
}
else
isValid = false;
} else if (tableType.equals("array")) {
- if (ft.isCollection())
- o = parseTableIntoCollection(session, r, (Collection)(ft.canCreateNewInstance(outer) ? ft.newInstance(outer) : new ObjectList(bc)), ft.getElementType());
- else if (ft.isArray())
- o = bc.toArray(ft, parseTableIntoCollection(session, r, new ArrayList(), ft.getElementType()));
+ if (sType.isCollection())
+ o = parseTableIntoCollection(session, r, (Collection)(sType.canCreateNewInstance(outer) ? sType.newInstance(outer) : new ObjectList(bc)), sType.getElementType());
+ else if (sType.isArray())
+ o = bc.toArray(sType, parseTableIntoCollection(session, r, new ArrayList(), sType.getElementType()));
else
isValid = false;
} else
isValid = false;
} else if (tag == UL) {
- if (ft.isCollection())
- o = parseIntoCollection(session, r, (Collection)(ft.canCreateNewInstance(outer) ? ft.newInstance(outer) : new ObjectList(bc)), ft.getElementType());
- else if (ft.isArray())
- o = bc.toArray(ft, parseIntoCollection(session, r, new ArrayList(), ft.getElementType()));
+ if (sType.isCollection())
+ o = parseIntoCollection(session, r, (Collection)(sType.canCreateNewInstance(outer) ? sType.newInstance(outer) : new ObjectList(bc)), sType.getElementType());
+ else if (sType.isArray())
+ o = bc.toArray(sType, parseIntoCollection(session, r, new ArrayList(), sType.getElementType()));
else
isValid = false;
} else
isValid = false;
if (! isValid)
- throw new XMLStreamException("Unexpected tag '"+tag+"' for type '"+nt+"'", event.getLocation());
+ throw new XMLStreamException("Unexpected tag '"+tag+"' for type '"+eType+"'", event.getLocation());
}
if (transform != null && o != null)
- o = transform.unswap(o, nt, bc);
+ o = transform.unswap(o, eType, bc);
if (outer != null)
- setParent(nt, o, outer);
+ setParent(eType, o, outer);
return (T)o;
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e1c60b10/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 a4f4bbe..d0dc0a5 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
@@ -2,7 +2,7 @@
// * 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 *
+// * with the License. You may obtain a copy of the License at *
// * *
// * http://www.apache.org/licenses/LICENSE-2.0 *
// * *
@@ -94,22 +94,22 @@ public final class HtmlSchemaDocSerializer extends HtmlDocSerializer {
ObjectMap out = new ObjectMap();
ClassMeta<?> aType; // The actual type (will be null if recursion occurs)
- ClassMeta<?> gType; // The generic type
+ ClassMeta<?> sType; // The serialized type
aType = session.push(attrName, eType, null);
- gType = eType.getSerializedClassMeta();
+ sType = eType.getSerializedClassMeta();
String type = null;
- if (gType.isEnum() || gType.isCharSequence() || gType.isChar())
+ if (sType.isEnum() || sType.isCharSequence() || sType.isChar())
type = "string";
- else if (gType.isNumber())
+ else if (sType.isNumber())
type = "number";
- else if (gType.isBoolean())
+ else if (sType.isBoolean())
type = "boolean";
- else if (gType.isBean() || gType.isMap())
+ else if (sType.isBean() || sType.isMap())
type = "object";
- else if (gType.isCollection() || gType.isArray())
+ else if (sType.isCollection() || sType.isArray())
type = "array";
else
type = "any";
@@ -121,16 +121,16 @@ public final class HtmlSchemaDocSerializer extends HtmlDocSerializer {
out.put("transform", t);
if (aType != null) {
- if (gType.isEnum())
- out.put("enum", getEnumStrings((Class<Enum<?>>)gType.getInnerClass()));
- else if (gType.isCollection() || gType.isArray()) {
- ClassMeta componentType = gType.getElementType();
- if (gType.isCollection() && isParentClass(Set.class, gType.getInnerClass()))
+ if (sType.isEnum())
+ out.put("enum", getEnumStrings((Class<Enum<?>>)sType.getInnerClass()));
+ else if (sType.isCollection() || sType.isArray()) {
+ ClassMeta componentType = sType.getElementType();
+ if (sType.isCollection() && isParentClass(Set.class, sType.getInnerClass()))
out.put("uniqueItems", true);
out.put("items", getSchema(session, componentType, "items", pNames));
- } else if (gType.isBean()) {
+ } else if (sType.isBean()) {
ObjectMap properties = new ObjectMap();
- BeanMeta bm = session.getBeanContext().getBeanMeta(gType.getInnerClass());
+ BeanMeta bm = session.getBeanContext().getBeanMeta(sType.getInnerClass());
if (pNames != null)
bm = new BeanMetaFiltered(bm, pNames);
for (Iterator<BeanPropertyMeta> i = bm.getPropertyMetas().iterator(); i.hasNext();) {
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e1c60b10/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 869498a..4cfaf89 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
@@ -2,7 +2,7 @@
// * 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 *
+// * with the License. You may obtain a copy of the License at *
// * *
// * http://www.apache.org/licenses/LICENSE-2.0 *
// * *
@@ -195,7 +195,7 @@ public class HtmlSerializer extends XmlSerializer {
BeanContext bc = session.getBeanContext();
ClassMeta<?> aType = null; // The actual type
- ClassMeta<?> gType = object(); // The generic type
+ ClassMeta<?> sType = object(); // The serialized type
if (eType == null)
eType = object();
@@ -216,7 +216,7 @@ public class HtmlSerializer extends XmlSerializer {
out.tag(i, "null").nl();
else {
- gType = aType.getSerializedClassMeta();
+ sType = aType.getSerializedClassMeta();
String classAttr = null;
if (session.isAddClassAttrs() && ! eType.equals(aType))
classAttr = aType.toString();
@@ -228,45 +228,45 @@ public class HtmlSerializer extends XmlSerializer {
// If the getSwapClass() method returns Object, we need to figure out
// the actual type now.
- if (gType.isObject())
- gType = bc.getClassMetaForObject(o);
+ if (sType.isObject())
+ sType = bc.getClassMetaForObject(o);
}
- HtmlClassMeta html = gType.getExtendedMeta(HtmlClassMeta.class);
+ HtmlClassMeta html = sType.getExtendedMeta(HtmlClassMeta.class);
if (html.isAsXml() || (pMeta != null && pMeta.getExtendedMeta(HtmlBeanPropertyMeta.class).isAsXml()))
super.serializeAnything(session, out, o, null, null, null, false, XmlFormat.NORMAL, null);
else if (html.isAsPlainText() || (pMeta != null && pMeta.getExtendedMeta(HtmlBeanPropertyMeta.class).isAsPlainText()))
out.write(o == null ? "null" : o.toString());
- else if (o == null || (gType.isChar() && ((Character)o).charValue() == 0))
+ else if (o == null || (sType.isChar() && ((Character)o).charValue() == 0))
out.tag(i, "null").nl();
- else if (gType.hasToObjectMapMethod())
- serializeMap(session, out, gType.toObjectMap(o), eType, classAttr, pMeta);
- else if (gType.isBean())
+ else if (sType.hasToObjectMapMethod())
+ serializeMap(session, out, sType.toObjectMap(o), eType, classAttr, pMeta);
+ else if (sType.isBean())
serializeBeanMap(session, out, bc.forBean(o), classAttr, pMeta);
- else if (gType.isNumber())
+ else if (sType.isNumber())
out.sTag(i, "number").append(o).eTag("number").nl();
- else if (gType.isBoolean())
+ else if (sType.isBoolean())
out.sTag(i, "boolean").append(o).eTag("boolean").nl();
- else if (gType.isMap()) {
+ else if (sType.isMap()) {
if (o instanceof BeanMap)
serializeBeanMap(session, out, (BeanMap)o, classAttr, pMeta);
else
serializeMap(session, out, (Map)o, eType, classAttr, pMeta);
}
- else if (gType.isCollection()) {
+ else if (sType.isCollection()) {
if (classAttr != null)
- serializeCollection(session, out, (Collection)o, gType, name, classAttr, pMeta);
+ serializeCollection(session, out, (Collection)o, sType, name, classAttr, pMeta);
else
serializeCollection(session, out, (Collection)o, eType, name, null, pMeta);
}
- else if (gType.isArray()) {
+ else if (sType.isArray()) {
if (classAttr != null)
- serializeCollection(session, out, toList(gType.getInnerClass(), o), gType, name, classAttr, pMeta);
+ serializeCollection(session, out, toList(sType.getInnerClass(), o), sType, name, classAttr, pMeta);
else
- serializeCollection(session, out, toList(gType.getInnerClass(), o), eType, name, null, pMeta);
+ serializeCollection(session, out, toList(sType.getInnerClass(), o), eType, name, null, pMeta);
}
- else if (session.isUri(gType, pMeta, o)) {
+ else if (session.isUri(sType, pMeta, o)) {
String label = session.getAnchorText(pMeta, o);
out.oTag(i, "a").attrUri("href", o).append('>');
out.append(label);
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e1c60b10/juneau-core/src/main/java/org/apache/juneau/html/dto/A.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/html/dto/A.java b/juneau-core/src/main/java/org/apache/juneau/html/dto/A.java
index 5e3ffc1..0ea319a 100644
--- a/juneau-core/src/main/java/org/apache/juneau/html/dto/A.java
+++ b/juneau-core/src/main/java/org/apache/juneau/html/dto/A.java
@@ -23,7 +23,7 @@ import org.apache.juneau.xml.annotation.*;
*
* @author James Bognar (james.bognar@salesforce.com)
*/
-@Bean(name="a")
+@Bean(typeName="a")
@SuppressWarnings("javadoc")
public class A extends HtmlElement {
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e1c60b10/juneau-core/src/main/java/org/apache/juneau/html/dto/Abbr.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/html/dto/Abbr.java b/juneau-core/src/main/java/org/apache/juneau/html/dto/Abbr.java
index 5a3b6c5..dc81fea 100644
--- a/juneau-core/src/main/java/org/apache/juneau/html/dto/Abbr.java
+++ b/juneau-core/src/main/java/org/apache/juneau/html/dto/Abbr.java
@@ -20,6 +20,6 @@ import org.apache.juneau.annotation.*;
*
* @author James Bognar (james.bognar@salesforce.com)
*/
-@Bean(name="abbr")
+@Bean(typeName="abbr")
public class Abbr extends HtmlElement {
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e1c60b10/juneau-core/src/main/java/org/apache/juneau/html/dto/Address.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/html/dto/Address.java b/juneau-core/src/main/java/org/apache/juneau/html/dto/Address.java
index db14434..2844a3c 100644
--- a/juneau-core/src/main/java/org/apache/juneau/html/dto/Address.java
+++ b/juneau-core/src/main/java/org/apache/juneau/html/dto/Address.java
@@ -20,6 +20,6 @@ import org.apache.juneau.annotation.*;
*
* @author James Bognar (james.bognar@salesforce.com)
*/
-@Bean(name="address")
+@Bean(typeName="address")
public class Address extends HtmlElement {
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e1c60b10/juneau-core/src/main/java/org/apache/juneau/html/dto/Area.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/html/dto/Area.java b/juneau-core/src/main/java/org/apache/juneau/html/dto/Area.java
index a139618..66e82d6 100644
--- a/juneau-core/src/main/java/org/apache/juneau/html/dto/Area.java
+++ b/juneau-core/src/main/java/org/apache/juneau/html/dto/Area.java
@@ -20,6 +20,6 @@ import org.apache.juneau.annotation.*;
*
* @author James Bognar (james.bognar@salesforce.com)
*/
-@Bean(name="area")
+@Bean(typeName="area")
public class Area extends HtmlElement {
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e1c60b10/juneau-core/src/main/java/org/apache/juneau/html/dto/Article.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/html/dto/Article.java b/juneau-core/src/main/java/org/apache/juneau/html/dto/Article.java
index 6b56e46..2f87aa2 100644
--- a/juneau-core/src/main/java/org/apache/juneau/html/dto/Article.java
+++ b/juneau-core/src/main/java/org/apache/juneau/html/dto/Article.java
@@ -20,6 +20,6 @@ import org.apache.juneau.annotation.*;
*
* @author James Bognar (james.bognar@salesforce.com)
*/
-@Bean(name="article")
+@Bean(typeName="article")
public class Article extends HtmlElement {
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e1c60b10/juneau-core/src/main/java/org/apache/juneau/html/dto/Aside.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/html/dto/Aside.java b/juneau-core/src/main/java/org/apache/juneau/html/dto/Aside.java
index 7105b99..23ffa64 100644
--- a/juneau-core/src/main/java/org/apache/juneau/html/dto/Aside.java
+++ b/juneau-core/src/main/java/org/apache/juneau/html/dto/Aside.java
@@ -20,6 +20,6 @@ import org.apache.juneau.annotation.*;
*
* @author James Bognar (james.bognar@salesforce.com)
*/
-@Bean(name="aside")
+@Bean(typeName="aside")
public class Aside extends HtmlElement {
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e1c60b10/juneau-core/src/main/java/org/apache/juneau/html/dto/Audio.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/html/dto/Audio.java b/juneau-core/src/main/java/org/apache/juneau/html/dto/Audio.java
index 0172838..1ef40c2 100644
--- a/juneau-core/src/main/java/org/apache/juneau/html/dto/Audio.java
+++ b/juneau-core/src/main/java/org/apache/juneau/html/dto/Audio.java
@@ -20,6 +20,6 @@ import org.apache.juneau.annotation.*;
*
* @author James Bognar (james.bognar@salesforce.com)
*/
-@Bean(name="audio")
+@Bean(typeName="audio")
public class Audio extends HtmlElement {
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e1c60b10/juneau-core/src/main/java/org/apache/juneau/html/dto/B.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/html/dto/B.java b/juneau-core/src/main/java/org/apache/juneau/html/dto/B.java
index de10358..449eefe 100644
--- a/juneau-core/src/main/java/org/apache/juneau/html/dto/B.java
+++ b/juneau-core/src/main/java/org/apache/juneau/html/dto/B.java
@@ -20,6 +20,6 @@ import org.apache.juneau.annotation.*;
*
* @author James Bognar (james.bognar@salesforce.com)
*/
-@Bean(name="b")
+@Bean(typeName="b")
public class B extends HtmlElement {
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e1c60b10/juneau-core/src/main/java/org/apache/juneau/html/dto/Base.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/html/dto/Base.java b/juneau-core/src/main/java/org/apache/juneau/html/dto/Base.java
index d31fda0..4a92761 100644
--- a/juneau-core/src/main/java/org/apache/juneau/html/dto/Base.java
+++ b/juneau-core/src/main/java/org/apache/juneau/html/dto/Base.java
@@ -20,6 +20,6 @@ import org.apache.juneau.annotation.*;
*
* @author James Bognar (james.bognar@salesforce.com)
*/
-@Bean(name="base")
+@Bean(typeName="base")
public class Base extends HtmlElement {
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e1c60b10/juneau-core/src/main/java/org/apache/juneau/html/dto/Bdi.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/html/dto/Bdi.java b/juneau-core/src/main/java/org/apache/juneau/html/dto/Bdi.java
index c76c47a..ce9796a 100644
--- a/juneau-core/src/main/java/org/apache/juneau/html/dto/Bdi.java
+++ b/juneau-core/src/main/java/org/apache/juneau/html/dto/Bdi.java
@@ -20,6 +20,6 @@ import org.apache.juneau.annotation.*;
*
* @author James Bognar (james.bognar@salesforce.com)
*/
-@Bean(name="bdi")
+@Bean(typeName="bdi")
public class Bdi extends HtmlElement {
}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e1c60b10/juneau-core/src/main/java/org/apache/juneau/html/dto/Bdo.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/html/dto/Bdo.java b/juneau-core/src/main/java/org/apache/juneau/html/dto/Bdo.java
index 4415f76..0b3417d 100644
--- a/juneau-core/src/main/java/org/apache/juneau/html/dto/Bdo.java
+++ b/juneau-core/src/main/java/org/apache/juneau/html/dto/Bdo.java
@@ -20,6 +20,6 @@ import org.apache.juneau.annotation.*;
*
* @author James Bognar (james.bognar@salesforce.com)
*/
-@Bean(name="bdo")
+@Bean(typeName="bdo")
public class Bdo extends HtmlElement {
}