continue;
}
if (!containsConfigProperty(configProperties, name)) {
if (type != null) {
final ConfigProperty configProperty = new ConfigProperty();
configProperties.add(configProperty);
Object value = null;
try {
value = propertyDescriptor.getReadMethod().invoke(o);
} catch (final Exception e) {
// no-op
}
javax.resource.spi.ConfigProperty annotation = propertyDescriptor.getWriteMethod().getAnnotation(javax.resource.spi.ConfigProperty.class);
if (annotation == null) {
try {
// if there's no annotation on the setter, we'll try and scrape one off the field itself (assuming the same name)
annotation = clazz.getDeclaredField(name).getAnnotation(javax.resource.spi.ConfigProperty.class);
} catch (final Exception ignored) {
// no-op : getDeclaredField() throws exceptions and does not return null
}
}
configProperty.setConfigPropertyName(name);
configProperty.setConfigPropertyType(getConfigPropertyType(annotation, type));
if (value != null) {
configProperty.setConfigPropertyValue(value.toString());
}
if (annotation != null) {
if (annotation.defaultValue() != null && annotation.defaultValue().length() > 0) {
configProperty.setConfigPropertyValue(annotation.defaultValue());
}
configProperty.setConfigPropertyConfidential(annotation.confidential());
configProperty.setConfigPropertyIgnore(annotation.ignore());
configProperty.setConfigPropertySupportsDynamicUpdates(annotation.supportsDynamicUpdates());
configProperty.setDescriptions(stringsToTexts(annotation.description()));
}
}
}
}
// add any annotated fields we haven't already picked up
final Field[] declaredFields = clazz.getDeclaredFields();
for (final Field field : declaredFields) {
final javax.resource.spi.ConfigProperty annotation = field.getAnnotation(javax.resource.spi.ConfigProperty.class);
final String name = field.getName();
Object value = null;
try {
value = field.get(o);
} catch (final Exception e) {
// no-op
}
if (!containsConfigProperty(configProperties, name)) {
final String type = getConfigPropertyType(annotation, field.getType());
if (type != null) {
final ConfigProperty configProperty = new ConfigProperty();
configProperties.add(configProperty);
configProperty.setConfigPropertyName(name);
configProperty.setConfigPropertyType(type);
if (value != null) {
configProperty.setConfigPropertyValue(value.toString());
}
if (annotation != null) {
if (annotation.defaultValue() != null) {
configProperty.setConfigPropertyValue(annotation.defaultValue());
}
configProperty.setConfigPropertyConfidential(annotation.confidential());
configProperty.setConfigPropertyIgnore(annotation.ignore());
configProperty.setConfigPropertySupportsDynamicUpdates(annotation.supportsDynamicUpdates());
}
}
}
}
} catch (final Exception e) {