* @throws RequestConfigurationException
*/
private static UnionAttributes getUnionAttributes(Class<?> forClass) throws RequestConfigurationException {
UnionAttributes attributes = new UnionAttributes();
for (int i = 0; i < forClass.getDeclaredFields().length; i++) {
CorbaUnionElement note = forClass.getDeclaredFields()[i].getAnnotation(CorbaUnionElement.class);
if (note != null) {
if (note.type().equals(CorbaUnionElementType.discriminator)) {
attributes.setDiscriminatorName(forClass.getDeclaredFields()[i].getName());
} else if (note.type().equals(CorbaUnionElementType.defaultOption)) {
attributes.setDefaultOptionName(forClass.getDeclaredFields()[i].getName());
} else if (note.type().equals(CorbaUnionElementType.option)) {
if (attributes.getOptionsMapping().containsKey(note.optionNumber())) {
throw new RequestConfigurationException("In " + forClass
+ ": field \""
+ forClass.getDeclaredFields()[i].getName()
+ "\" uses already used option id: "
+ note.optionNumber());
} else {
attributes.getOptionsMapping().put(note.optionNumber(),
forClass.getDeclaredFields()[i].getName());
}
}
}
}