@Override public RuntimeEnumConstantImpl createEnumConstant(String name, String literal, Field constant, EnumConstantImpl<Type,Class,Field,Method> last) { T t; try { try { constant.setAccessible(true); } catch (SecurityException e) { // in case the constant is already accessible, swallow this error. // if the constant is indeed not accessible, we will get IllegalAccessException // in the following line, and that is not too late. } t = (T)constant.get(null); } catch (IllegalAccessException e) { // impossible, because this is an enum constant throw new IllegalAccessError(e.getMessage()); } B b = null; try { b = baseXducer.parse(literal); } catch (Exception e) { builder.reportError(new IllegalAnnotationException( Messages.INVALID_XML_ENUM_VALUE.format(literal,baseType.getType().toString()), e, new FieldLocatable<Field>(this,constant,nav()) )); } parseMap.put(b,t); printMap.put(t,b); return new RuntimeEnumConstantImpl(this, name, literal, last); }
@Override public RuntimeEnumConstantImpl createEnumConstant(String name, String literal, Field constant, EnumConstantImpl<Type,Class,Field,Method> last) { T t; try { try { constant.setAccessible(true); } catch (SecurityException e) { // in case the constant is already accessible, swallow this error. // if the constant is indeed not accessible, we will get IllegalAccessException // in the following line, and that is not too late. } t = (T)constant.get(null); } catch (IllegalAccessException e) { // impossible, because this is an enum constant throw new IllegalAccessError(e.getMessage()); } B b = null; try { b = baseXducer.parse(literal); } catch (Exception e) { builder.reportError(new IllegalAnnotationException( Messages.INVALID_XML_ENUM_VALUE.format(literal,baseType.getType().toString()), e, new FieldLocatable<Field>(this,constant,nav()) )); } parseMap.put(b,t); printMap.put(t,b); return new RuntimeEnumConstantImpl(this, name, literal, last); }
@Override public RuntimeEnumConstantImpl createEnumConstant(String name, String literal, Field constant, EnumConstantImpl<Type,Class,Field,Method> last) { T t; try { try { constant.setAccessible(true); } catch (SecurityException e) { // in case the constant is already accessible, swallow this error. // if the constant is indeed not accessible, we will get IllegalAccessException // in the following line, and that is not too late. } t = (T)constant.get(null); } catch (IllegalAccessException e) { // impossible, because this is an enum constant throw new IllegalAccessError(e.getMessage()); } B b = null; try { b = baseXducer.parse(literal); } catch (Exception e) { builder.reportError(new IllegalAnnotationException( Messages.INVALID_XML_ENUM_VALUE.format(literal,baseType.getType().toString()), e, new FieldLocatable<Field>(this,constant,nav()) )); } parseMap.put(b,t); printMap.put(t,b); return new RuntimeEnumConstantImpl(this, name, literal, last); }
@Override public RuntimeEnumConstantImpl createEnumConstant(String name, String literal, Field constant, EnumConstantImpl<Type,Class,Field,Method> last) { T t; try { try { constant.setAccessible(true); } catch (SecurityException e) { // in case the constant is already accessible, swallow this error. // if the constant is indeed not accessible, we will get IllegalAccessException // in the following line, and that is not too late. } t = (T)constant.get(null); } catch (IllegalAccessException e) { // impossible, because this is an enum constant throw new IllegalAccessError(e.getMessage()); } B b = null; try { b = baseXducer.parse(literal); } catch (Exception e) { builder.reportError(new IllegalAnnotationException( Messages.INVALID_XML_ENUM_VALUE.format(literal,baseType.getType().toString()), e, new FieldLocatable<Field>(this,constant,nav()) )); } parseMap.put(b,t); printMap.put(t,b); return new RuntimeEnumConstantImpl(this, name, literal, last); }