Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 7062920049D for ; Wed, 9 Aug 2017 20:47:44 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 6EC89169D32; Wed, 9 Aug 2017 18:47:44 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id B22C9169D30 for ; Wed, 9 Aug 2017 20:47:43 +0200 (CEST) Received: (qmail 95217 invoked by uid 500); 9 Aug 2017 18:47:42 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 95208 invoked by uid 99); 9 Aug 2017 18:47:42 -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; Wed, 09 Aug 2017 18:47:42 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id C97E1E10F8; Wed, 9 Aug 2017 18:47:42 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: dkulp@apache.org To: commits@cxf.apache.org Message-Id: <854e41f9622d4d9bbbb9c83a3385f873@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: cxf-xjc-utils git commit: Revert a couple of changes and fix them a different way Date: Wed, 9 Aug 2017 18:47:42 +0000 (UTC) archived-at: Wed, 09 Aug 2017 18:47:44 -0000 Repository: cxf-xjc-utils Updated Branches: refs/heads/master 1eebd55a5 -> 695eb0093 Revert a couple of changes and fix them a different way Project: http://git-wip-us.apache.org/repos/asf/cxf-xjc-utils/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf-xjc-utils/commit/695eb009 Tree: http://git-wip-us.apache.org/repos/asf/cxf-xjc-utils/tree/695eb009 Diff: http://git-wip-us.apache.org/repos/asf/cxf-xjc-utils/diff/695eb009 Branch: refs/heads/master Commit: 695eb009363effd8964dc6879f73a037beacb04a Parents: 1eebd55 Author: Daniel Kulp Authored: Wed Aug 9 14:47:23 2017 -0400 Committer: Daniel Kulp Committed: Wed Aug 9 14:47:23 2017 -0400 ---------------------------------------------------------------------- .../apache/cxf/xjc/dv/DefaultValuePlugin.java | 24 ++++++++------------ 1 file changed, 9 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf-xjc-utils/blob/695eb009/dv/src/main/java/org/apache/cxf/xjc/dv/DefaultValuePlugin.java ---------------------------------------------------------------------- diff --git a/dv/src/main/java/org/apache/cxf/xjc/dv/DefaultValuePlugin.java b/dv/src/main/java/org/apache/cxf/xjc/dv/DefaultValuePlugin.java index 28b7b9b..9ff6dc8 100644 --- a/dv/src/main/java/org/apache/cxf/xjc/dv/DefaultValuePlugin.java +++ b/dv/src/main/java/org/apache/cxf/xjc/dv/DefaultValuePlugin.java @@ -68,7 +68,6 @@ public class DefaultValuePlugin { private static final Logger LOG = Logger.getLogger(DefaultValuePlugin.class.getName()); //NOPMD private boolean complexTypes; private boolean active; - private boolean attributes; public DefaultValuePlugin() { } @@ -79,7 +78,6 @@ public class DefaultValuePlugin { public String getUsage() { return " -Xdv : Initialize fields mapped from elements with their default values\n" - + " -Xdv:attributes : Also initialize fields mapped from attributes with their default values\n" + " -Xdv:optional : Initialize fields mapped from elements with their default values\n" + " for elements with minOccurs=0 but with complexTypes containing \n" + " fields with default values."; @@ -94,9 +92,6 @@ public class DefaultValuePlugin { if (args[index].indexOf(":optional") != -1) { complexTypes = true; } - if (args[index].indexOf(":attributes") != -1) { - attributes = true; - } if (!opt.activePlugins.contains(plugin)) { opt.activePlugins.add(plugin); } @@ -210,27 +205,26 @@ public class DefaultValuePlugin { JExpression dvExpr = null; if (null != xmlDefaultValue && null != xmlDefaultValue.value) { - dvExpr = getDefaultValueExpression(f, co, outline, xsType, isElement | attributes, + dvExpr = getDefaultValueExpression(f, co, outline, xsType, isElement, xmlDefaultValue, false); } if (null == dvExpr - && !isElement && !isRequiredAttr - && xsType != null && xsType.getOwnerSchema() != null - && !"http://www.w3.org/2001/XMLSchema" - .equals(xsType.getOwnerSchema().getTargetNamespace())) { - //non-primitive attribute, may still be able to convert it, but need to do + && !isElement + && !isRequiredAttr + && xsType != null && xsType.getOwnerSchema() != null) { + //attribute, may still be able to convert it, but need to do //a bunch more checks and changes to setters and isSet and such - + dvExpr = - getDefaultValueExpression(f, co, outline, xsType, isElement | attributes, + getDefaultValueExpression(f, co, outline, xsType, false, xmlDefaultValue, true); if (dvExpr != null) { updateSetter(co, f, co.implClass); updateGetter(co, f, co.implClass, dvExpr, true); } - } else if (null == dvExpr) { + } else if (null == dvExpr) { JType type = f.getRawType(); String typeName = type.fullName(); if ("javax.xml.datatype.Duration".equals(typeName)) { @@ -238,6 +232,7 @@ public class DefaultValuePlugin { } continue; } else { + System.out.println("UPDATE 3!!!!!"); updateGetter(co, f, co.implClass, dvExpr, false); } } @@ -378,7 +373,6 @@ public class DefaultValuePlugin { false); } } - // TODO: GregorianCalendar, ... return dv; }