private static <T extends BundleDestinationSpecification> T from(PropertyMap map, Class<T> expectedClass) {
String name = map.getSimpleValue(BUNDLE_DEST_NAME_NAME, null);
String valueContext = map.getSimpleValue(BUNDLE_DEST_BASE_DIR_VALUE_CONTEXT_NAME, null);
String description = map.getSimpleValue(BUNDLE_DEST_DESCRIPTION_NAME, null);
String connection = map.getSimpleValue(BUNDLE_DEST_DEFINITION_CONNECTION_NAME, null);
PropertyList refs = map.getList(BUNDLE_DEST_DEFINITION_REF_LIST_NAME);
PropertyList acceptProps = map.getList(BUNDLE_DEST_ACCEPTS_LIST_NAME);
Class<?> determinedClass = Object.class;
if (valueContext == null) {
if (connection != null || refs != null) {
determinedClass = BundleDestinationDefinition.class;
}
} else {
if (connection == null && refs == null) {
determinedClass = BundleDestinationBaseDirectory.class;
}
}
//first convert accepts into a List<String>
List<String> accepts = new ArrayList<String>();
if (acceptProps != null) {
for (Property p : acceptProps.getList()) {
PropertySimple bundleType = (PropertySimple) p;
accepts.add(bundleType.getStringValue());
}
}