Java Code Examples for org.apache.ws.commons.schema.constants.Constants#URI_2001_SCHEMA_XSD
The following examples show how to use
org.apache.ws.commons.schema.constants.Constants#URI_2001_SCHEMA_XSD .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SourceGenerator.java From cxf with Apache License 2.0 | 6 votes |
private String getPrimitiveType(Element paramEl, ContextInfo info, Set<String> imports) { final String defaultValue = "String"; String type = paramEl.getAttribute("type"); if (type.isEmpty()) { return defaultValue; } String[] pair = type.split(":"); if (pair.length == 2) { if (XSD_SPECIFIC_TYPE_MAP.containsKey(pair[1])) { String expandedName = "{" + Constants.URI_2001_SCHEMA_XSD + "}" + pair[1]; if (schemaTypeMap.containsKey(expandedName)) { return addImportsAndGetSimpleName(imports, schemaTypeMap.get(expandedName)); } String xsdType = XSD_SPECIFIC_TYPE_MAP.get(pair[1]); return addImportsAndGetSimpleName(imports, xsdType); } String value = pair[1].replaceAll("[\\-\\_]", ""); return convertRefToClassName(pair[0], value, defaultValue, info, imports); } return addImportsAndGetSimpleName(imports, type); }
Example 2
Source File: CollectionTest.java From cxf with Apache License 2.0 | 6 votes |
@Test public void testCollectionDTO() { tm = new DefaultTypeMapping(Constants.URI_2001_SCHEMA_XSD); creator = new Java5TypeCreator(); creator.setConfiguration(new TypeCreationOptions()); tm.setTypeCreator(creator); AegisType dto = creator.createType(CollectionDTO.class); Set<AegisType> deps = dto.getDependencies(); AegisType type = deps.iterator().next(); assertTrue(type instanceof CollectionType); CollectionType colType = (CollectionType)type; deps = dto.getDependencies(); assertEquals(1, deps.size()); AegisType comType = colType.getComponentType(); assertEquals(String.class, comType.getTypeClass()); }
Example 3
Source File: CollectionTest.java From cxf with Apache License 2.0 | 6 votes |
@Test public void testObjectDTO() { tm = new DefaultTypeMapping(Constants.URI_2001_SCHEMA_XSD); creator = new Java5TypeCreator(); creator.setConfiguration(new TypeCreationOptions()); tm.setTypeCreator(creator); AegisType dto = creator.createType(ObjectDTO.class); Set<AegisType> deps = dto.getDependencies(); assertFalse(deps.isEmpty()); AegisType type = deps.iterator().next(); assertTrue(type instanceof CollectionType); CollectionType colType = (CollectionType)type; deps = dto.getDependencies(); assertEquals(1, deps.size()); AegisType comType = colType.getComponentType(); assertEquals(Object.class, comType.getTypeClass()); }
Example 4
Source File: XMLStreamReaderMappingTest.java From cxf with Apache License 2.0 | 6 votes |
@Before public void setUp() throws Exception { super.setUp(); addNamespace("b", "urn:beanz"); addNamespace("xsi", Constants.URI_2001_SCHEMA_XSI); context = new AegisContext(); // create a different mapping than the context creates. TypeMapping baseMapping = DefaultTypeMapping.createSoap11TypeMapping(true, false, false); mapping = new DefaultTypeMapping(Constants.URI_2001_SCHEMA_XSD, baseMapping); mapping.register(XMLStreamReader.class, new QName("urn:Bean", "SimpleBean"), new XMLStreamReaderType()); mapping.setTypeCreator(context.createTypeCreator()); context.setTypeMapping(mapping); context.initialize(); }
Example 5
Source File: AbstractEncodedTest.java From cxf with Apache License 2.0 | 6 votes |
@Before public void setUp() throws Exception { super.setUp(); addNamespace("b", "urn:Bean"); addNamespace("a", "urn:anotherns"); addNamespace("xsi", Constants.URI_2001_SCHEMA_XSI); addNamespace("soapenc", Soap11.getInstance().getSoapEncodingStyle()); AegisContext context = new AegisContext(); // create a different mapping than the context creates. TypeMapping baseMapping = DefaultTypeMapping.createSoap11TypeMapping(true, false, false); mapping = new DefaultTypeMapping(Constants.URI_2001_SCHEMA_XSD, baseMapping); mapping.setTypeCreator(context.createTypeCreator()); context.setTypeMapping(mapping); context.initialize(); // serialization root type trailingBlocks = new TrailingBlocks(); }
Example 6
Source File: NoNamespaceAegisElementProvider.java From cxf with Apache License 2.0 | 6 votes |
@Override protected AegisContext getAegisContext(Class<?> plainClass, Type genericType) { AegisContext context = new AegisContext(); context.setWriteXsiTypes(writeXsiType); context.setReadXsiTypes(readXsiType); TypeCreationOptions tco = new TypeCreationOptions(); tco.setQualifyElements(false); Set<java.lang.reflect.Type> rootClasses = new HashSet<>(); rootClasses.add(genericType); context.setTypeCreationOptions(tco); context.setRootClasses(rootClasses); TypeMapping baseMapping = DefaultTypeMapping.createSoap11TypeMapping(true, false, false); DefaultTypeMapping mapping = new DefaultTypeMapping(Constants.URI_2001_SCHEMA_XSD, baseMapping); TypeCreator stockTypeCreator = createTypeCreator(tco); mapping.setTypeCreator(stockTypeCreator); context.setTypeMapping(mapping); context.initialize(); return context; }
Example 7
Source File: CollectionTest.java From cxf with Apache License 2.0 | 5 votes |
@Before public void setUp() throws Exception { super.setUp(); tm = new DefaultTypeMapping(Constants.URI_2001_SCHEMA_XSD); creator = new Java5TypeCreator(); creator.setConfiguration(new TypeCreationOptions()); tm.setTypeCreator(creator); }
Example 8
Source File: DefaultTypeMapping.java From cxf with Apache License 2.0 | 4 votes |
/** * Create a set of default type mappings. * @param defaultNillable whether elements are nillable by default. * @param enableMtomXmime whether to enable XMIME annotations on MTOM. * @param enableJDOM whether to map JDOM types. * @return */ public static DefaultTypeMapping createDefaultTypeMapping(boolean defaultNillable, boolean enableMtomXmime, boolean enableJDOM) { // by convention, the default mapping is against the XML schema URI. DefaultTypeMapping tm = new DefaultTypeMapping(Constants.URI_2001_SCHEMA_XSD); fillStandardMappings(tm, defaultNillable, enableMtomXmime, enableJDOM); defaultRegister(tm, defaultNillable, Character.class, CharacterAsStringType.CHARACTER_AS_STRING_TYPE_QNAME, new CharacterAsStringType()); defaultRegister(tm, defaultNillable, char.class, CharacterAsStringType.CHARACTER_AS_STRING_TYPE_QNAME, new CharacterAsStringType()); defaultRegister(tm, defaultNillable, javax.xml.datatype.Duration.class, Constants.XSD_DURATION, new org.apache.cxf.aegis.type.java5.DurationType()); defaultRegister(tm, defaultNillable, javax.xml.datatype.XMLGregorianCalendar.class, Constants.XSD_DATE, new org.apache.cxf.aegis.type.java5.XMLGregorianCalendarType()); defaultRegister(tm, defaultNillable, javax.xml.datatype.XMLGregorianCalendar.class, Constants.XSD_TIME, new org.apache.cxf.aegis.type.java5.XMLGregorianCalendarType()); defaultRegister(tm, defaultNillable, javax.xml.datatype.XMLGregorianCalendar.class, Constants.XSD_DAY, new org.apache.cxf.aegis.type.java5.XMLGregorianCalendarType()); defaultRegister(tm, defaultNillable, javax.xml.datatype.XMLGregorianCalendar.class, Constants.XSD_MONTH, new org.apache.cxf.aegis.type.java5.XMLGregorianCalendarType()); defaultRegister(tm, defaultNillable, javax.xml.datatype.XMLGregorianCalendar.class, Constants.XSD_MONTHDAY, new org.apache.cxf.aegis.type.java5.XMLGregorianCalendarType()); defaultRegister(tm, defaultNillable, javax.xml.datatype.XMLGregorianCalendar.class, Constants.XSD_YEAR, new org.apache.cxf.aegis.type.java5.XMLGregorianCalendarType()); defaultRegister(tm, defaultNillable, javax.xml.datatype.XMLGregorianCalendar.class, Constants.XSD_YEARMONTH, new org.apache.cxf.aegis.type.java5.XMLGregorianCalendarType()); defaultRegister(tm, defaultNillable, javax.xml.datatype.XMLGregorianCalendar.class, Constants.XSD_DATETIME, new org.apache.cxf.aegis.type.java5.XMLGregorianCalendarType()); return tm; }