| 1 |
|
package uk.co.badgersinfoil.asxsd.components; |
| 2 |
|
|
| 3 |
|
import org.eclipse.xsd.XSDConcreteComponent; |
| 4 |
|
import org.eclipse.xsd.XSDSimpleTypeDefinition; |
| 5 |
|
import org.eclipse.xsd.XSDVariety; |
| 6 |
|
import uk.co.badgersinfoil.asxsd.CodegenContext; |
| 7 |
|
import uk.co.badgersinfoil.asxsd.MappingFunction; |
| 8 |
|
import uk.co.badgersinfoil.asxsd.TypeDescriptor; |
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
15 |
public class UnionSimpleTypeComponent extends AbstractSimpleTypeComponent { |
| 14 |
|
|
| 15 |
|
protected TypeDescriptor createTypeDescriptor(CodegenContext context, |
| 16 |
|
XSDSimpleTypeDefinition simpleType) |
| 17 |
|
{ |
| 18 |
2 |
return new TypeDescriptor("String", false, null, simpleType); |
| 19 |
|
} |
| 20 |
|
|
| 21 |
|
public MappingFunction functionFor(CodegenContext context, XSDConcreteComponent component) { |
| 22 |
3 |
return IdentityMappingFunction.INSTANCE; |
| 23 |
|
} |
| 24 |
|
|
| 25 |
|
protected boolean willAcceptType(XSDSimpleTypeDefinition simpleType) { |
| 26 |
11 |
return simpleType.getVariety() == XSDVariety.UNION_LITERAL; |
| 27 |
|
} |
| 28 |
|
} |