private static <U> void applyConfig(Field field, U instance, SmooksResourceConfiguration config) { try { ClassUtil.setField(field, instance, config); } catch (IllegalAccessException e) { throw new SmooksConfigurationException("Failed to set paramater configuration value on '" + getLongMemberName(field) + "'.", e); } }
private static <U> void applyConfig(Field field, U instance, SmooksResourceConfiguration config) { try { ClassUtil.setField(field, instance, config); } catch (IllegalAccessException e) { throw new SmooksConfigurationException("Failed to set paramater configuration value on '" + getLongMemberName(field) + "'.", e); } }
private static <U> void applyConfig(Field field, U instance, SmooksResourceConfiguration config) { try { ClassUtil.setField(field, instance, config); } catch (IllegalAccessException e) { throw new SmooksConfigurationException("Failed to set paramater configuration value on '" + getLongMemberName(field) + "'.", e); } }
private static <U> void applyConfig(Field field, U instance, SmooksResourceConfiguration config) { try { ClassUtil.setField(field, instance, config); } catch (IllegalAccessException e) { throw new SmooksConfigurationException("Failed to set paramater configuration value on '" + getLongMemberName(field) + "'.", e); } }
private static <U> void processFieldContextAnnotation(Class contentHandlerClass, U instance, ApplicationContext appContext) { Field[] fields = contentHandlerClass.getDeclaredFields(); // Work back up the Inheritance tree first... Class superClass = contentHandlerClass.getSuperclass(); if(superClass != null && ContentHandler.class.isAssignableFrom(superClass)) { processFieldContextAnnotation(superClass, instance, appContext); } for (Field field : fields) { AppContext appContextAnnotation = field.getAnnotation(AppContext.class); if(appContextAnnotation != null) { try { ClassUtil.setField(field, instance, appContext); } catch (IllegalAccessException e) { throw new SmooksConfigurationException("Failed to set ApplicationContext value on '" + getLongMemberName(field) + "'.", e); } } } }
private static <U> void processFieldContextAnnotation(Class contentHandlerClass, U instance, ApplicationContext appContext) { Field[] fields = contentHandlerClass.getDeclaredFields(); // Work back up the Inheritance tree first... Class superClass = contentHandlerClass.getSuperclass(); if(superClass != null && ContentHandler.class.isAssignableFrom(superClass)) { processFieldContextAnnotation(superClass, instance, appContext); } for (Field field : fields) { AppContext appContextAnnotation = field.getAnnotation(AppContext.class); if(appContextAnnotation != null) { try { ClassUtil.setField(field, instance, appContext); } catch (IllegalAccessException e) { throw new SmooksConfigurationException("Failed to set ApplicationContext value on '" + getLongMemberName(field) + "'.", e); } } } }
private static <U> void processFieldContextAnnotation(Class contentHandlerClass, U instance, ApplicationContext appContext) { Field[] fields = contentHandlerClass.getDeclaredFields(); // Work back up the Inheritance tree first... Class superClass = contentHandlerClass.getSuperclass(); if(superClass != null && ContentHandler.class.isAssignableFrom(superClass)) { processFieldContextAnnotation(superClass, instance, appContext); } for (Field field : fields) { AppContext appContextAnnotation = field.getAnnotation(AppContext.class); if(appContextAnnotation != null) { try { ClassUtil.setField(field, instance, appContext); } catch (IllegalAccessException e) { throw new SmooksConfigurationException("Failed to set ApplicationContext value on '" + getLongMemberName(field) + "'.", e); } } } }
private static <U> void processFieldContextAnnotation(Class contentHandlerClass, U instance, ApplicationContext appContext) { Field[] fields = contentHandlerClass.getDeclaredFields(); // Work back up the Inheritance tree first... Class superClass = contentHandlerClass.getSuperclass(); if(superClass != null && ContentHandler.class.isAssignableFrom(superClass)) { processFieldContextAnnotation(superClass, instance, appContext); } for (Field field : fields) { AppContext appContextAnnotation = field.getAnnotation(AppContext.class); if(appContextAnnotation != null) { try { ClassUtil.setField(field, instance, appContext); } catch (IllegalAccessException e) { throw new SmooksConfigurationException("Failed to set ApplicationContext value on '" + getLongMemberName(field) + "'.", e); } } } }
private static <U> void setMember(Member member, U instance, Object value) { try { if(member instanceof Field) { ClassUtil.setField((Field)member, instance, value); } else { try { setMethod((Method)member, instance, value); } catch (InvocationTargetException e) { throw new SmooksConfigurationException("Failed to set paramater configuration value on '" + getLongMemberName(member) + "'.", e.getTargetException()); } } } catch (IllegalAccessException e) { throw new SmooksConfigurationException("Failed to set paramater configuration value on '" + getLongMemberName(member) + "'.", e); } }
private static <U> void setMember(Member member, U instance, Object value) { try { if(member instanceof Field) { ClassUtil.setField((Field)member, instance, value); } else { try { setMethod((Method)member, instance, value); } catch (InvocationTargetException e) { throw new SmooksConfigurationException("Failed to set paramater configuration value on '" + getLongMemberName(member) + "'.", e.getTargetException()); } } } catch (IllegalAccessException e) { throw new SmooksConfigurationException("Failed to set paramater configuration value on '" + getLongMemberName(member) + "'.", e); } }
private static <U> void setMember(Member member, U instance, Object value) { try { if(member instanceof Field) { ClassUtil.setField((Field)member, instance, value); } else { try { setMethod((Method)member, instance, value); } catch (InvocationTargetException e) { throw new SmooksConfigurationException("Failed to set paramater configuration value on '" + getLongMemberName(member) + "'.", e.getTargetException()); } } } catch (IllegalAccessException e) { throw new SmooksConfigurationException("Failed to set paramater configuration value on '" + getLongMemberName(member) + "'.", e); } }
private static <U> void setMember(Member member, U instance, Object value) { try { if(member instanceof Field) { ClassUtil.setField((Field)member, instance, value); } else { try { setMethod((Method)member, instance, value); } catch (InvocationTargetException e) { throw new SmooksConfigurationException("Failed to set paramater configuration value on '" + getLongMemberName(member) + "'.", e.getTargetException()); } } } catch (IllegalAccessException e) { throw new SmooksConfigurationException("Failed to set paramater configuration value on '" + getLongMemberName(member) + "'.", e); } }
ClassUtil.setField(field, instance, decoder.decode(defaultVal)); } catch (IllegalAccessException e) { throw new SmooksConfigurationException("Unable to set property field value for '" + getLongMemberName(field) + "'.", e);
ClassUtil.setField(field, instance, decoder.decode(defaultVal)); } catch (IllegalAccessException e) { throw new SmooksConfigurationException("Unable to set property field value for '" + getLongMemberName(field) + "'.", e);
ClassUtil.setField(field, instance, decoder.decode(defaultVal)); } catch (IllegalAccessException e) { throw new SmooksConfigurationException("Unable to set property field value for '" + getLongMemberName(field) + "'.", e);
ClassUtil.setField(field, instance, decoder.decode(defaultVal)); } catch (IllegalAccessException e) { throw new SmooksConfigurationException("Unable to set property field value for '" + getLongMemberName(field) + "'.", e);
private static <U> void processStreamResultWriterAnnotations(U instance, SmooksResourceConfiguration config) { if(!(instance instanceof SAXVisitor)) { return; } List<Field> streamResFields = ClassUtil.getAnnotatedFields(instance.getClass(), StreamResultWriter.class); boolean encodeSpecialCharacters = config.getBoolParameter(Filter.ENTITIES_REWRITE, true); for(Field streamResField : streamResFields) { // If already initialized, ignore... try { if(ClassUtil.getField(streamResField, instance) != null) { continue; } } catch (IllegalAccessException e) { throw new SmooksConfigurationException("Unable to get property field value for '" + getLongMemberName(streamResField) + "'.", e); } Class<?> type = streamResField.getType(); if(type == SAXToXMLWriter.class) { SAXToXMLWriter xmlWriter = new SAXToXMLWriter((SAXVisitor) instance, encodeSpecialCharacters); try { ClassUtil.setField(streamResField, instance, xmlWriter); } catch (IllegalAccessException e) { throw new SmooksConfigurationException("Unable to inject SAXToXMLWriter property field value for '" + getLongMemberName(streamResField) + "'.", e); } } } }
private static <U> void processStreamResultWriterAnnotations(U instance, SmooksResourceConfiguration config) { if(!(instance instanceof SAXVisitor)) { return; } List<Field> streamResFields = ClassUtil.getAnnotatedFields(instance.getClass(), StreamResultWriter.class); boolean encodeSpecialCharacters = config.getBoolParameter(Filter.ENTITIES_REWRITE, true); for(Field streamResField : streamResFields) { // If already initialized, ignore... try { if(ClassUtil.getField(streamResField, instance) != null) { continue; } } catch (IllegalAccessException e) { throw new SmooksConfigurationException("Unable to get property field value for '" + getLongMemberName(streamResField) + "'.", e); } Class<?> type = streamResField.getType(); if(type == SAXToXMLWriter.class) { SAXToXMLWriter xmlWriter = new SAXToXMLWriter((SAXVisitor) instance, encodeSpecialCharacters); try { ClassUtil.setField(streamResField, instance, xmlWriter); } catch (IllegalAccessException e) { throw new SmooksConfigurationException("Unable to inject SAXToXMLWriter property field value for '" + getLongMemberName(streamResField) + "'.", e); } } } }
private static <U> void processStreamResultWriterAnnotations(U instance, SmooksResourceConfiguration config) { if(!(instance instanceof SAXVisitor)) { return; } List<Field> streamResFields = ClassUtil.getAnnotatedFields(instance.getClass(), StreamResultWriter.class); boolean encodeSpecialCharacters = config.getBoolParameter(Filter.ENTITIES_REWRITE, true); for(Field streamResField : streamResFields) { // If already initialized, ignore... try { if(ClassUtil.getField(streamResField, instance) != null) { continue; } } catch (IllegalAccessException e) { throw new SmooksConfigurationException("Unable to get property field value for '" + getLongMemberName(streamResField) + "'.", e); } Class<?> type = streamResField.getType(); if(type == SAXToXMLWriter.class) { SAXToXMLWriter xmlWriter = new SAXToXMLWriter((SAXVisitor) instance, encodeSpecialCharacters); try { ClassUtil.setField(streamResField, instance, xmlWriter); } catch (IllegalAccessException e) { throw new SmooksConfigurationException("Unable to inject SAXToXMLWriter property field value for '" + getLongMemberName(streamResField) + "'.", e); } } } }
private static <U> void processStreamResultWriterAnnotations(U instance, SmooksResourceConfiguration config) { if(!(instance instanceof SAXVisitor)) { return; } List<Field> streamResFields = ClassUtil.getAnnotatedFields(instance.getClass(), StreamResultWriter.class); boolean encodeSpecialCharacters = config.getBoolParameter(Filter.ENTITIES_REWRITE, true); for(Field streamResField : streamResFields) { // If already initialized, ignore... try { if(ClassUtil.getField(streamResField, instance) != null) { continue; } } catch (IllegalAccessException e) { throw new SmooksConfigurationException("Unable to get property field value for '" + getLongMemberName(streamResField) + "'.", e); } Class<?> type = streamResField.getType(); if(type == SAXToXMLWriter.class) { SAXToXMLWriter xmlWriter = new SAXToXMLWriter((SAXVisitor) instance, encodeSpecialCharacters); try { ClassUtil.setField(streamResField, instance, xmlWriter); } catch (IllegalAccessException e) { throw new SmooksConfigurationException("Unable to inject SAXToXMLWriter property field value for '" + getLongMemberName(streamResField) + "'.", e); } } } }