src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/RuntimeBuiltinLeafInfoImpl.java

changeset 721
06807f9a6835
parent 514
29a761eaff0d
child 760
e530533619ec
equal deleted inserted replaced
718:246d7e4f3c9f 721:06807f9a6835
41 import java.math.BigInteger; 41 import java.math.BigInteger;
42 import java.net.MalformedURLException; 42 import java.net.MalformedURLException;
43 import java.net.URI; 43 import java.net.URI;
44 import java.net.URISyntaxException; 44 import java.net.URISyntaxException;
45 import java.net.URL; 45 import java.net.URL;
46 import java.security.AccessController;
47 import java.security.PrivilegedAction;
46 import java.util.ArrayList; 48 import java.util.ArrayList;
47 import java.util.Calendar; 49 import java.util.Calendar;
48 import java.util.Collections; 50 import java.util.Collections;
49 import java.util.Date; 51 import java.util.Date;
50 import java.util.GregorianCalendar; 52 import java.util.GregorianCalendar;
195 197
196 public static final String MAP_ANYURI_TO_URI = "mapAnyUriToUri"; 198 public static final String MAP_ANYURI_TO_URI = "mapAnyUriToUri";
197 199
198 static { 200 static {
199 201
200 QName[] qnames = (System.getProperty(MAP_ANYURI_TO_URI) == null) ? new QName[] { 202 String MAP_ANYURI_TO_URI_VALUE = AccessController.doPrivileged(
203 new PrivilegedAction<String>() {
204 @Override
205 public String run() {
206 return System.getProperty(MAP_ANYURI_TO_URI);
207 }
208 }
209 );
210 QName[] qnames = (MAP_ANYURI_TO_URI_VALUE == null) ? new QName[] {
201 createXS("string"), 211 createXS("string"),
202 createXS("anySimpleType"), 212 createXS("anySimpleType"),
203 createXS("normalizedString"), 213 createXS("normalizedString"),
204 createXS("anyURI"), 214 createXS("anyURI"),
205 createXS("token"), 215 createXS("token"),
308 } 318 }
309 public String print(URL v) { 319 public String print(URL v) {
310 return v.toExternalForm(); 320 return v.toExternalForm();
311 } 321 }
312 }); 322 });
313 if (System.getProperty(MAP_ANYURI_TO_URI) == null) { 323 if (MAP_ANYURI_TO_URI_VALUE == null) {
314 secondaryList.add( 324 secondaryList.add(
315 new StringImpl<URI>(URI.class, createXS("string")) { 325 new StringImpl<URI>(URI.class, createXS("string")) {
316 public URI parse(CharSequence text) throws SAXException { 326 public URI parse(CharSequence text) throws SAXException {
317 try { 327 try {
318 return new URI(text.toString()); 328 return new URI(text.toString());
772 public String print(BigInteger v) { 782 public String print(BigInteger v) {
773 return DatatypeConverterImpl._printInteger(v); 783 return DatatypeConverterImpl._printInteger(v);
774 } 784 }
775 }); 785 });
776 primaryList.add( 786 primaryList.add(
777 new StringImpl<BigDecimal>(BigDecimal.class, 787 new StringImpl<BigDecimal>(BigDecimal.class,
778 createXS("decimal") 788 createXS("decimal")
779 ) { 789 ) {
780 public BigDecimal parse(CharSequence text) { 790 public BigDecimal parse(CharSequence text) {
781 return DatatypeConverterImpl._parseDecimal(text.toString()); 791 return DatatypeConverterImpl._parseDecimal(text.toString());
782 } 792 }
783 793
784 public String print(BigDecimal v) { 794 public String print(BigDecimal v) {
785 return DatatypeConverterImpl._printDecimal(v); 795 return DatatypeConverterImpl._printDecimal(v);
786 } 796 }
787 }); 797 }
798 );
788 primaryList.add( 799 primaryList.add(
789 new StringImpl<QName>(QName.class, 800 new StringImpl<QName>(QName.class,
790 createXS("QName") 801 createXS("QName")
791 ) { 802 ) {
792 public QName parse(CharSequence text) throws SAXException { 803 public QName parse(CharSequence text) throws SAXException {
810 @Override 821 @Override
811 public void declareNamespace(QName v, XMLSerializer w) { 822 public void declareNamespace(QName v, XMLSerializer w) {
812 w.getNamespaceContext().declareNamespace(v.getNamespaceURI(),v.getPrefix(),false); 823 w.getNamespaceContext().declareNamespace(v.getNamespaceURI(),v.getPrefix(),false);
813 } 824 }
814 }); 825 });
815 if (System.getProperty(MAP_ANYURI_TO_URI) != null) { 826 if (MAP_ANYURI_TO_URI_VALUE != null) {
816 primaryList.add( 827 primaryList.add(
817 new StringImpl<URI>(URI.class, createXS("anyURI")) { 828 new StringImpl<URI>(URI.class, createXS("anyURI")) {
818 public URI parse(CharSequence text) throws SAXException { 829 public URI parse(CharSequence text) throws SAXException {
819 try { 830 try {
820 return new URI(text.toString()); 831 return new URI(text.toString());
828 return v.toString(); 839 return v.toString();
829 } 840 }
830 }); 841 });
831 } 842 }
832 primaryList.add( 843 primaryList.add(
833 new StringImpl<Duration>(Duration.class, createXS("duration")) { 844 new StringImpl<Duration>(Duration.class, createXS("duration")) {
834 public String print(Duration duration) { 845 public String print(Duration duration) {
835 return duration.toString(); 846 return duration.toString();
836 } 847 }
837 848
838 public Duration parse(CharSequence lexical) { 849 public Duration parse(CharSequence lexical) {
839 TODO.checkSpec("JSR222 Issue #42"); 850 TODO.checkSpec("JSR222 Issue #42");
840 return DatatypeConverterImpl.getDatatypeFactory().newDuration(lexical.toString()); 851 return DatatypeConverterImpl.getDatatypeFactory().newDuration(lexical.toString());
841 } 852 }
842 }); 853 }
854 );
843 primaryList.add( 855 primaryList.add(
844 new StringImpl<Void>(Void.class) { 856 new StringImpl<Void>(Void.class) {
845 // 'void' binding isn't defined by the spec, but when the JAX-RPC processes user-defined 857 // 'void' binding isn't defined by the spec, but when the JAX-RPC processes user-defined
846 // methods like "int actionFoo()", they need this pseudo-void property. 858 // methods like "int actionFoo()", they need this pseudo-void property.
847 859

mercurial