This is an automated email from the ASF dual-hosted git repository.
jamesbognar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/juneau.git
The following commit(s) were added to refs/heads/master by this push:
new 1aea819 PropertyStore refactoring.
1aea819 is described below
commit 1aea819a48cc7d553f103550a3821fd06e972ebe
Author: JamesBognar <[email protected]>
AuthorDate: Sun Feb 7 17:39:01 2021 -0500
PropertyStore refactoring.
---
.../main/java/org/apache/juneau/BeanContext.java | 4 +--
.../main/java/org/apache/juneau/PropertyStore.java | 30 +++-------------------
2 files changed, 5 insertions(+), 29 deletions(-)
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanContext.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanContext.java
index dbac558..4d0d754 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanContext.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanContext.java
@@ -2133,7 +2133,7 @@ public class BeanContext extends Context implements
MetaProvider {
beanMethodVisibility = ps.get(BEAN_beanMethodVisibility,
Visibility.class).orElse(PUBLIC);
beanFieldVisibility = ps.get(BEAN_beanFieldVisibility,
Visibility.class).orElse(PUBLIC);
- notBeanClasses = ps.getClassArray(BEAN_notBeanClasses,
DEFAULT_NOTBEAN_CLASSES);
+ notBeanClasses =
ps.getClassArray(BEAN_notBeanClasses).orElse(DEFAULT_NOTBEAN_CLASSES);
propertyNamer = ps.getInstance(BEAN_propertyNamer,
PropertyNamer.class, BasicPropertyNamer.class);
@@ -2175,7 +2175,7 @@ public class BeanContext extends Context implements
MetaProvider {
cmObject = cmCache.get(Object.class);
cmClass = cmCache.get(Class.class);
- beanDictionaryClasses =
AList.unmodifiable(ps.getClassArray(BEAN_beanDictionary, new Class[0]));
+ beanDictionaryClasses =
AList.unmodifiable(ps.getClassArray(BEAN_beanDictionary).orElse(new Class[0]));
beanRegistry = new BeanRegistry(this, null);
}
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyStore.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyStore.java
index ac324cd..999da7c 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyStore.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyStore.java
@@ -428,35 +428,11 @@ public final class PropertyStore {
* Returns the class array property with the specified name.
*
* @param key The property name.
- * @return The property value, or an empty array if it doesn't exist.
- */
- public Class<?>[] getClass(String key) {
- Property p = findProperty(key);
- return p == null ? new Class[0] : p.as(Class[].class);
- }
-
- /**
- * Returns the class array property with the specified name.
- *
- * @param key The property name.
- * @param def The default value.
- * @return The property value, or an empty array if it doesn't exist.
- */
- public Class<?>[] getClassArray(String key, Class<?>[] def) {
- Property p = findProperty(key);
- return p == null ? def : p.as(Class[].class);
- }
-
- /**
- * Returns the class array property with the specified name.
- *
- * @param key The property name.
- * @param eType The class type of the elements in the property.
- * @return The property value, or an empty array if it doesn't exist.
+ * @return The property value, never <jk>null</jk>.
*/
- public <T> Class<T>[] getClassArray(String key, Class<T> eType) {
+ public Optional<Class<?>[]> getClassArray(String key) {
Property p = findProperty(key);
- return p == null ? new Class[0] : p.as(Class[].class);
+ return Optional.ofNullable(p == null ? null :
p.as(Class[].class));
}
/**