class UnionFeatureCollection implements VectorProcess {

    @DescribeResult(name = "result", description = "Output feature collection")
    public SimpleFeatureCollection execute(
            @DescribeParameter(name = "first", description = "First input feature collection") SimpleFeatureCollection firstFeatures,
            @DescribeParameter(name = "second", description = "Second feature collection") SimpleFeatureCollection secondFeatures)
            throws ClassNotFoundException {
        if (!(firstFeatures.features().next().getDefaultGeometry().getClass().equals(secondFeatures
                .features().next().getDefaultGeometry().getClass()))) {
            throw new ProcessException("Different default geometries, cannot perform union");
        } else {
            return new UnitedFeatureCollection(firstFeatures, secondFeatures);
        }
    }

}