jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/reader/xmlschema/bindinfo/BIProperty.java
equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
466 if(prop.isCollection()) { |
466 if(prop.isCollection()) { |
467 CollectionTypeAttribute ct = getCollectionType(); |
467 CollectionTypeAttribute ct = getCollectionType(); |
468 r = ct.get(getBuilder().model); |
468 r = ct.get(getBuilder().model); |
469 } else { |
469 } else { |
470 FieldRendererFactory frf = getBuilder().fieldRendererFactory; |
470 FieldRendererFactory frf = getBuilder().fieldRendererFactory; |
471 |
471 // according to the spec we should bahave as in jaxb1. So we ignore possiblity that property could be nullable |
472 if(prop.isOptionalPrimitive()) { |
472 switch(opm) { |
473 // the property type can be primitive type if we are to ignore absence |
473 // the property type can be primitive type if we are to ignore absence |
474 switch(opm) { |
|
475 case PRIMITIVE: |
474 case PRIMITIVE: |
476 r = frf.getRequiredUnboxed(); |
475 r = frf.getRequiredUnboxed(); |
477 break; |
476 break; |
478 case WRAPPER: |
477 case WRAPPER: |
479 // force the wrapper type |
478 // force the wrapper type |
480 r = frf.getSingle(); |
479 r = prop.isOptionalPrimitive() ? frf.getSingle() : frf.getDefault(); |
481 break; |
480 break; |
482 case ISSET: |
481 case ISSET: |
483 r = frf.getSinglePrimitiveAccess(); |
482 r = prop.isOptionalPrimitive() ? frf.getSinglePrimitiveAccess() : frf.getDefault(); |
484 break; |
483 break; |
485 default: |
484 default: |
486 throw new Error(); |
485 throw new Error(); |
487 } |
486 |
488 } else { |
|
489 r = frf.getDefault(); |
|
490 } |
487 } |
491 } |
488 } |
492 if(opm==OptionalPropertyMode.ISSET) { |
489 if(opm==OptionalPropertyMode.ISSET) { |
493 // only isSet is allowed on a collection. these 3 modes aren't really symmetric. |
490 // only isSet is allowed on a collection. these 3 modes aren't really symmetric. |
494 |
491 |