public void setAttributes()

in src/main/java/org/apache/sling/scripting/xproc/xpl/impl/AbstractXplElementImpl.java [75:106]


	public void setAttributes(Map<String, String> attributes) {
		if (attributes == null || attributes.isEmpty()) {
            // nothing to do
            return;
        }

        // check for special attribute fields
        Map<String, Field> attributeFields = this.getAttributeFields();
        for (Entry<String, String> entry : attributes.entrySet()) {
            String key = entry.getKey();
            String value = entry.getValue();

            Field attributeField = attributeFields.get(key);
            if (attributeField != null) {
            	attributeField.setAccessible(true);
                try {
                	attributeField.set(this, value);
                } catch (IllegalArgumentException e) {
                    String message = "Failed to set attribute field " + key;
                    this.log.error(message, e);
                    throw new RuntimeException(message, e);
                } catch (IllegalAccessException e) {
                    String message = "Failed to set attribute field " + key;
                    this.log.error(message, e);
                    throw new RuntimeException(message, e);
                }
             }

            // default attribute processing
            this.processAttribute(key, value);
        }
	}