juneau-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jamesbog...@apache.org
Subject juneau git commit: Remove BeanContext dependency in BeanFilter.
Date Sun, 07 Jan 2018 20:33:58 GMT
Repository: juneau
Updated Branches:
  refs/heads/master d2509348f -> 13af2b9d2


Remove BeanContext dependency in BeanFilter.

Project: http://git-wip-us.apache.org/repos/asf/juneau/repo
Commit: http://git-wip-us.apache.org/repos/asf/juneau/commit/13af2b9d
Tree: http://git-wip-us.apache.org/repos/asf/juneau/tree/13af2b9d
Diff: http://git-wip-us.apache.org/repos/asf/juneau/diff/13af2b9d

Branch: refs/heads/master
Commit: 13af2b9d29b1d5357ca54ff38b819b3b15d61b9d
Parents: d250934
Author: JamesBognar <jamesbognar@apache.org>
Authored: Sun Jan 7 15:33:54 2018 -0500
Committer: JamesBognar <jamesbognar@apache.org>
Committed: Sun Jan 7 15:33:54 2018 -0500

----------------------------------------------------------------------
 .../org/apache/juneau/a/rttests/RoundTripBeanMapsTest.java  | 4 ++--
 .../src/main/java/org/apache/juneau/BeanContext.java        | 2 +-
 .../src/main/java/org/apache/juneau/ClassMeta.java          | 2 +-
 .../juneau/transform/AnnotationBeanFilterBuilder.java       | 7 ++-----
 .../main/java/org/apache/juneau/transform/BeanFilter.java   | 3 ++-
 .../java/org/apache/juneau/transform/BeanFilterBuilder.java | 9 +++------
 .../apache/juneau/transform/InterfaceBeanFilterBuilder.java | 5 ++---
 7 files changed, 13 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/juneau/blob/13af2b9d/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripBeanMapsTest.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripBeanMapsTest.java
b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripBeanMapsTest.java
index 9fc3671..3ae522b 100755
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripBeanMapsTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripBeanMapsTest.java
@@ -678,12 +678,12 @@ public class RoundTripBeanMapsTest extends RoundTripTest {
 	}
 	public static class FB1Filter extends InterfaceBeanFilterBuilder {
 		public FB1Filter() {
-			super(BeanContext.DEFAULT, FB1.class);
+			super(FB1.class);
 		}
 	}
 	public static class FB2Filter extends InterfaceBeanFilterBuilder {
 		public FB2Filter() {
-			super(BeanContext.DEFAULT, FB1.class);
+			super(FB1.class);
 		}
 	}
 

http://git-wip-us.apache.org/repos/asf/juneau/blob/13af2b9d/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanContext.java
----------------------------------------------------------------------
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 0e9ea1f..03e9f4e 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
@@ -1274,7 +1274,7 @@ public class BeanContext extends Context {
 			else if (isParentClass(BeanFilterBuilder.class, c))
 				lbf.add(newInstance(BeanFilterBuilder.class, c).build());
 			else
-				lbf.add(new InterfaceBeanFilterBuilder(this, c).build());
+				lbf.add(new InterfaceBeanFilterBuilder(c).build());
 		}
 		beanFilters = lbf.toArray(new BeanFilter[0]);
 

http://git-wip-us.apache.org/repos/asf/juneau/blob/13af2b9d/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ClassMeta.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ClassMeta.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ClassMeta.java
index c515962..fe389ba 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ClassMeta.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ClassMeta.java
@@ -661,7 +661,7 @@ public final class ClassMeta<T> implements Type {
 			try {
 				Map<Class<?>,Bean> ba = findAnnotationsMap(Bean.class, innerClass);
 				if (! ba.isEmpty())
-					return new AnnotationBeanFilterBuilder(beanContext, innerClass, ba).build();
+					return new AnnotationBeanFilterBuilder(innerClass, ba).build();
 			} catch (Exception e) {
 				throw new RuntimeException(e);
 			}

http://git-wip-us.apache.org/repos/asf/juneau/blob/13af2b9d/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/transform/AnnotationBeanFilterBuilder.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/transform/AnnotationBeanFilterBuilder.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/transform/AnnotationBeanFilterBuilder.java
index b99409b..f13ee99 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/transform/AnnotationBeanFilterBuilder.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/transform/AnnotationBeanFilterBuilder.java
@@ -30,15 +30,12 @@ public final class AnnotationBeanFilterBuilder extends BeanFilterBuilder
{
 	/**
 	 * Constructor.
 	 * 
-	 * @param bc 
-	 * 	The bean context creating this builder.  
-	 * 	Used to instantiate {@link PropertyNamer PropertyNamers}. 
 	 * @param annotatedClass The class found to have a {@link Bean @Bean} annotation.
 	 * @param annotations
 	 * 	The {@link Bean @Bean} annotations found on the class and all parent classes in child-to-parent
order.
 	 * @throws Exception Thrown from property namer constructor.
 	 */
-	public AnnotationBeanFilterBuilder(BeanContext bc, Class<?> annotatedClass, Map<Class<?>,Bean>
annotations) throws Exception {
+	public AnnotationBeanFilterBuilder(Class<?> annotatedClass, Map<Class<?>,Bean>
annotations) throws Exception {
 		super(annotatedClass);
 
 		ListIterator<Bean> li = new ArrayList<>(annotations.values()).listIterator(annotations.size());
@@ -58,7 +55,7 @@ public final class AnnotationBeanFilterBuilder extends BeanFilterBuilder
{
 				excludeProperties(split(b.excludeProperties()));
 
 			if (b.propertyNamer() != PropertyNamerDefault.class)
-				propertyNamer(bc, b.propertyNamer());
+				propertyNamer(b.propertyNamer());
 
 			if (b.interfaceClass() != Object.class)
 				interfaceClass(b.interfaceClass());

http://git-wip-us.apache.org/repos/asf/juneau/blob/13af2b9d/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/transform/BeanFilter.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/transform/BeanFilter.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/transform/BeanFilter.java
index 9a354f0..2b2671a 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/transform/BeanFilter.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/transform/BeanFilter.java
@@ -16,6 +16,7 @@ import static org.apache.juneau.internal.StringUtils.*;
 
 import org.apache.juneau.*;
 import org.apache.juneau.annotation.*;
+import org.apache.juneau.internal.*;
 
 /**
  * Parent class for all bean filters.
@@ -49,7 +50,7 @@ public class BeanFilter {
 		this.interfaceClass = builder.interfaceClass;
 		this.stopClass = builder.stopClass;
 		this.sortProperties = builder.sortProperties;
-		this.propertyNamer = builder.propertyNamer;
+		this.propertyNamer = ClassUtils.newInstance(PropertyNamer.class, builder.propertyNamer);
 		this.beanDictionary =
 			builder.beanDictionary == null
 			? null

http://git-wip-us.apache.org/repos/asf/juneau/blob/13af2b9d/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/transform/BeanFilterBuilder.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/transform/BeanFilterBuilder.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/transform/BeanFilterBuilder.java
index d663acf..0464582 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/transform/BeanFilterBuilder.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/transform/BeanFilterBuilder.java
@@ -46,14 +46,12 @@ import org.apache.juneau.*;
  */
 public abstract class BeanFilterBuilder {
 
-	private String TODO = "Need to convert to property builder";
-	
 	Class<?> beanClass;
 	String typeName;
 	String[] properties, excludeProperties;
 	Class<?> interfaceClass, stopClass;
 	boolean sortProperties;
-	PropertyNamer propertyNamer;
+	Object propertyNamer;
 	List<Class<?>> beanDictionary;
 
 	/**
@@ -206,13 +204,12 @@ public abstract class BeanFilterBuilder {
 	/**
 	 * The property namer to use to name bean properties.
 	 * 
-	 * @param bc The bean context used to instantiate the property namer. 
 	 * @param c The property namer class.  Must have a public no-arg constructor.
 	 * @return This object (for method chaining).
 	 * @throws Exception Thrown from constructor method.
 	 */
-	public BeanFilterBuilder propertyNamer(BeanContext bc, Class<? extends PropertyNamer>
c) throws Exception {
-		this.propertyNamer = bc.newInstance(PropertyNamer.class, c);
+	public BeanFilterBuilder propertyNamer(Class<? extends PropertyNamer> c) throws Exception
{
+		this.propertyNamer = c;
 		return this;
 	}
 

http://git-wip-us.apache.org/repos/asf/juneau/blob/13af2b9d/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/transform/InterfaceBeanFilterBuilder.java
----------------------------------------------------------------------
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/transform/InterfaceBeanFilterBuilder.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/transform/InterfaceBeanFilterBuilder.java
index f83f210..de293cc 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/transform/InterfaceBeanFilterBuilder.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/transform/InterfaceBeanFilterBuilder.java
@@ -33,10 +33,9 @@ public class InterfaceBeanFilterBuilder extends BeanFilterBuilder {
 	/**
 	 * Constructor.
 	 * 
-	 * @param bc Bean context used for instantiating {@link PropertyNamer} instances. 
 	 * @param interfaceClass The class to use as an interface on all child classes.
 	 */
-	public InterfaceBeanFilterBuilder(BeanContext bc, Class<?> interfaceClass) {
+	public InterfaceBeanFilterBuilder(Class<?> interfaceClass) {
 		super(interfaceClass);
 		interfaceClass(interfaceClass);
 		Map<Class<?>,Bean> annotations = ReflectionUtils.findAnnotationsMap(Bean.class,
interfaceClass);
@@ -59,7 +58,7 @@ public class InterfaceBeanFilterBuilder extends BeanFilterBuilder {
 
 			try {
 				if (b.propertyNamer() != PropertyNamerDefault.class)
-					propertyNamer(bc, b.propertyNamer());
+					propertyNamer(b.propertyNamer());
 			} catch (Exception e) {
 				throw new RuntimeException(e);
 			}


Mime
View raw message