Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions samples/episode/a/src/main/java/a/Factory.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package a;

public class Factory {

public void checkEnumValues(){
// doesn't matter what we put here, we just want to make sure the enums are being constructed correctly
if(A2EnumType.ABC == A2EnumType.DEF){
System.exit(1);
}
if(A3EnumType.START == A3EnumType.FINISH){
System.exit(1);
}
if(A4EnumType.START == A4EnumType.FINISH){
System.exit(1);
}
}
}
62 changes: 56 additions & 6 deletions samples/episode/a/src/main/resources/a.xsd
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,67 @@
</xsd:complexType>

<xsd:simpleType name="A2EnumType">
<xsd:annotation>
<xsd:appinfo>
<jaxb:typesafeEnumClass/>
</xsd:appinfo>
</xsd:annotation>
<!-- This shouldn't really be necessary should it? -->
<!--<xsd:annotation>-->
<!--<xsd:appinfo>-->
<!--<jaxb:typesafeEnumClass/>-->
<!--</xsd:appinfo>-->
<!--</xsd:annotation>-->
<xsd:restriction base="xsd:string">
<xsd:enumeration value="ABC" />
<xsd:enumeration value="DEF" />
<xsd:enumeration value="GHI" />
</xsd:restriction>
</xsd:simpleType>

<xsd:simpleType name="A3EnumType">
<!-- if base type is an xsd:string then including this annotation would fail the import -->
<!--<xsd:annotation>-->
<!--<xsd:appinfo>-->
<!--<jaxb:typesafeEnumClass/>-->
<!--</xsd:appinfo>-->
<!--</xsd:annotation>-->
<xsd:restriction base="xsd:string">
<xsd:enumeration value="0" >
<xsd:annotation>
<xsd:appinfo>
<jaxb:typesafeEnumMember name="START"/>
</xsd:appinfo>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="1">
<xsd:annotation>
<xsd:appinfo>
<jaxb:typesafeEnumMember name="FINISH"/>
</xsd:appinfo>
</xsd:annotation>
</xsd:enumeration>
</xsd:restriction>
</xsd:simpleType>

<xsd:simpleType name="A4EnumType">
<!-- if base type is an xsd:int we don't actually bind the clas correctly unless we include the typesafeEnumClass -->
<xsd:annotation>
<xsd:appinfo>
<jaxb:typesafeEnumClass/>
</xsd:appinfo>
</xsd:annotation>
<xsd:restriction base="xsd:int">
<xsd:enumeration value="0" >
<xsd:annotation>
<xsd:appinfo>
<jaxb:typesafeEnumMember name="START"/>
</xsd:appinfo>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="1">
<xsd:annotation>
<xsd:appinfo>
<jaxb:typesafeEnumMember name="FINISH"/>
</xsd:appinfo>
</xsd:annotation>
</xsd:enumeration>
</xsd:restriction>
</xsd:simpleType>

</xsd:schema>
</xsd:schema>