private static void copyBooleanAttribute(AnnotationDescriptor descriptor, Element element, String attribute) { String attributeValue = element.attributeValue( attribute ); if ( StringHelper.isNotEmpty( attributeValue ) ) { String javaAttribute = getJavaAttributeNameFromXMLOne( attribute ); descriptor.setValue( javaAttribute, Boolean.parseBoolean( attributeValue ) ); } }
/** * Copy a string attribute from an XML element to an annotation descriptor. The name of the annotation attribute is * computed from the name of the XML attribute by {@link #getJavaAttributeNameFromXMLOne(String)}. * * @param annotation annotation descriptor where to copy to the attribute. * @param element XML element from where to copy the attribute. * @param attributeName name of the XML attribute to copy. * @param mandatory whether the attribute is mandatory. */ private static void copyStringAttribute( final AnnotationDescriptor annotation, final Element element, final String attributeName, final boolean mandatory) { copyStringAttribute( annotation, element, getJavaAttributeNameFromXMLOne( attributeName ), attributeName, mandatory ); }
private static void copyIntegerAttribute(AnnotationDescriptor annotation, Element element, String attributeName) { String attribute = element.attributeValue( attributeName ); if ( attribute != null ) { String annotationAttributeName = getJavaAttributeNameFromXMLOne( attributeName ); annotation.setValue( annotationAttributeName, attribute ); try { int length = Integer.parseInt( attribute ); annotation.setValue( annotationAttributeName, length ); } catch ( NumberFormatException e ) { throw new AnnotationException( element.getPath() + attributeName + " not parseable: " + attribute + " (" + SCHEMA_VALIDATION + ")" ); } } }
private void addTargetClass(Element element, AnnotationDescriptor ad, String nodeName, XMLContext.Default defaults) { String className = element.attributeValue( nodeName ); if ( className != null ) { Class clazz; try { clazz = classLoaderAccess.classForName( XMLContext.buildSafeClassName( className, defaults ) ); } catch ( ClassLoadingException e ) { throw new AnnotationException( "Unable to find " + element.getPath() + " " + nodeName + ": " + className, e ); } ad.setValue( getJavaAttributeNameFromXMLOne( nodeName ), clazz ); } }
private static void copyBooleanAttribute(AnnotationDescriptor descriptor, Element element, String attribute) { String attributeValue = element.attributeValue( attribute ); if ( StringHelper.isNotEmpty( attributeValue ) ) { String javaAttribute = getJavaAttributeNameFromXMLOne( attribute ); descriptor.setValue( javaAttribute, Boolean.parseBoolean( attributeValue ) ); } }
/** * Copy a string attribute from an XML element to an annotation descriptor. The name of the annotation attribute is * computed from the name of the XML attribute by {@link #getJavaAttributeNameFromXMLOne(String)}. * * @param annotation annotation descriptor where to copy to the attribute. * @param element XML element from where to copy the attribute. * @param attributeName name of the XML attribute to copy. * @param mandatory whether the attribute is mandatory. */ private static void copyStringAttribute( final AnnotationDescriptor annotation, final Element element, final String attributeName, final boolean mandatory) { copyStringAttribute( annotation, element, getJavaAttributeNameFromXMLOne( attributeName ), attributeName, mandatory ); }
private static void copyIntegerAttribute(AnnotationDescriptor annotation, Element element, String attributeName) { String attribute = element.attributeValue( attributeName ); if ( attribute != null ) { String annotationAttributeName = getJavaAttributeNameFromXMLOne( attributeName ); annotation.setValue( annotationAttributeName, attribute ); try { int length = Integer.parseInt( attribute ); annotation.setValue( annotationAttributeName, length ); } catch ( NumberFormatException e ) { throw new AnnotationException( element.getPath() + attributeName + " not parseable: " + attribute + " (" + SCHEMA_VALIDATION + ")" ); } } }
private void addTargetClass(Element element, AnnotationDescriptor ad, String nodeName, XMLContext.Default defaults) { String className = element.attributeValue( nodeName ); if ( className != null ) { Class clazz; try { clazz = bootstrapContext.getClassLoaderAccess().classForName( XMLContext.buildSafeClassName( className, defaults ) ); } catch ( ClassLoadingException e ) { throw new AnnotationException( "Unable to find " + element.getPath() + " " + nodeName + ": " + className, e ); } ad.setValue( getJavaAttributeNameFromXMLOne( nodeName ), clazz ); } }