[Design of JBossXB] - Re: Extending EnumValueAdapter
by adrian@jboss.org
"alesj" wrote : "adrian(a)jboss.org" wrote :
| | It doesn't. The "1" gets used if you do this:
| |
| |
| | | @XmlEnum(Integer.class)
| | | public enum Numbers
| | | {
| | | ONE(1)
| | | }
| | |
| |
| | i.e. a "1" in the xml maps to the ONE enum value.
| So in this case it would be illegal to use @JBossXmlEnum(ignoreCase=true) or just ignored?
|
Yes. Obviously, you can't ignore case on an integer. ;-)
anonymous wrote :
| Who makes sure "1" is passed into EVA::cast as an Integer?
Its the xsd:type (or technically its parent type) of the attribute/element.
>From JBossXBNoSchemaBuilder
| // Determine the enum type
| Class<?> xmlEnumValue = String.class;
| XmlEnum xmlEnum = typeInfo.getUnderlyingAnnotation(XmlEnum.class);
| if (xmlEnum != null)
| xmlEnumValue = xmlEnum.value();
| TypeInfo enumType = typeInfo.getTypeInfoFactory().getTypeInfo(xmlEnumValue);
|
| // Resolve the enum type as the parent (must be simple)
| TypeBinding parent = getSimpleType(enumType);
|
| // Create the enum type
| QName qName = null;
| TypeBinding typeBinding = null;
| if (root)
| {
| qName = generateXmlName(typeInfo, XmlNsForm.QUALIFIED, overrideNamespace, overrideName);
| typeBinding = new TypeBinding(qName, parent);
| }
| else
| {
| typeBinding = new TypeBinding(null, parent);
| }
|
Please, either read the spec, read the code, read the tests or "suck it and see".
Don't keep expecting me to explain the finest points of every implementation detail
ad infinitum in the forums (unless you want to post in the user forums
where I can ignore you :-).
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4137392#4137392
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4137392
18 years
[Design the new POJO MicroContainer] - Re: Moving to CR1 releases of the MC projects
by alesj
"adrian(a)jboss.org" wrote :
| I was still seeing FileNotFoundException from getChild() when I was testing
| yesterday.
|
Perhaps the same problem as Scott was having?
- http://www.jboss.org/index.html?module=bb&op=viewtopic&t=131032
Since the only place that FNFE gets thrown is in FileHandler constructor.
| public FileHandler(FileSystemContext context, VirtualFileHandler parent, File file, URL url) throws IOException
| {
| super(context, parent, url, file.getName());
|
| this.file = file;
| if (file.exists() == false)
| throw new FileNotFoundException("File does not exist: " + file.getCanonicalPath());
| setVfsUrl(new URL("vfs" + url));
| }
|
And the only usage of this constructor has a check before:
| else if (file.exists())
| {
| handler = new FileHandler(this, parent, file, uri);
| }
|
OK, in theory if you looked at the code few mins before, there were more FNFE usages, but they were never used.
I now removed them, doing a bit of cleanup.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4137379#4137379
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4137379
18 years