blob: bd1938445cab0d25c76664d149be82af20dc959d [file] [log] [blame]
/**
* Copyright (c) 2020 Robert Bosch GmbH.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Robert Bosch GmbH - initial API and implementation
*/
package org.eclipse.app4mc.slg.commons.m2t;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.stream.Collectors;
import org.eclipse.app4mc.slg.commons.m2t.generators.TranslationUnit;
import com.google.inject.Inject;
public abstract class SLGBaseTransformer {
@Inject Properties properties;
protected String getProperty(final String propKey) {
final Object value = this.properties.get(propKey);
if ((value == null)) {
throw new NullPointerException(
(("Request input key : \"" + propKey) + "\" not supplied in the input properties file"));
}
return value.toString();
}
public Map<ArrayList<?>, ? extends TranslationUnit> getCache() {
return new HashMap<>();
}
public List<String> getSrcFiles() {
return getCache().values().stream()
.map(TranslationUnit::getSrcFile)
.sorted()
.distinct()
.collect(Collectors.toList());
}
}