Return-Path: X-Original-To: apmail-camel-commits-archive@www.apache.org Delivered-To: apmail-camel-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1E0E5185BB for ; Fri, 7 Aug 2015 09:14:28 +0000 (UTC) Received: (qmail 79078 invoked by uid 500); 7 Aug 2015 09:14:28 -0000 Delivered-To: apmail-camel-commits-archive@camel.apache.org Received: (qmail 78971 invoked by uid 500); 7 Aug 2015 09:14:28 -0000 Mailing-List: contact commits-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list commits@camel.apache.org Received: (qmail 78742 invoked by uid 99); 7 Aug 2015 09:14:27 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 07 Aug 2015 09:14:27 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id D53D6E6828; Fri, 7 Aug 2015 09:14:27 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: davsclaus@apache.org To: commits@camel.apache.org Date: Fri, 07 Aug 2015 09:14:33 -0000 Message-Id: <335be4f8911540ed9da81d0b967910b5@git.apache.org> In-Reply-To: <23b652a6c13f4373b2d182a2ffebea26@git.apache.org> References: <23b652a6c13f4373b2d182a2ffebea26@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [07/12] camel git commit: CAMEL-5958: Bindy ignores bean class type: load models recursively CAMEL-5958: Bindy ignores bean class type: load models recursively Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/222f5fda Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/222f5fda Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/222f5fda Branch: refs/heads/master Commit: 222f5fdaea783002161333502aadf1b7a38ea8f4 Parents: a052c1c Author: lburgazzoli Authored: Fri Nov 29 22:46:27 2013 +0100 Committer: Claus Ibsen Committed: Fri Aug 7 11:05:47 2015 +0200 ---------------------------------------------------------------------- .../dataformat/bindy/BindyAbstractFactory.java | 25 ++++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/222f5fda/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractFactory.java ---------------------------------------------------------------------- diff --git a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractFactory.java b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractFactory.java index 43bca89..a23383a 100644 --- a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractFactory.java +++ b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractFactory.java @@ -64,23 +64,34 @@ public abstract class BindyAbstractFactory implements BindyFactory { */ public void initModel() throws Exception { models = new HashSet>(); - models.add(type); + modelClassNames = new HashSet(); - for (Field field : type.getDeclaredFields()) { + loadModels(type); + } + + /** + * Recursively load model. + * + * @param root + */ + private void loadModels(Class root) { + models.add(root); + modelClassNames.add(root.getName()); + + for (Field field : root.getDeclaredFields()) { Link linkField = field.getAnnotation(Link.class); if (linkField != null) { if (LOG.isDebugEnabled()) { LOG.debug("Class linked: {}, Field: {}", field.getType(), field); } + models.add(field.getType()); + modelClassNames.add(field.getType().getName()); + + loadModels(field.getType()); } } - - modelClassNames = new HashSet(); - for (Class clazz : models) { - modelClassNames.add(clazz.getName()); - } } /**