@Test public void removesShapesThatMatchPredicate() { ShapeId aId = ShapeId.from("ns.foo#A"); StringShape a = StringShape.builder() .id(aId) .addTrait(new SensitiveTrait()) .build(); ShapeId bId = ShapeId.from("ns.foo#B"); StringShape b = StringShape.builder().id(bId).build(); Model model = Model.builder().addShapes(a, b).build(); Model result = ModelTransformer.create() .filterShapes(model, shape -> !shape.getTrait(SensitiveTrait.class).isPresent()); assertThat(result.shapes().count(), Matchers.is(1L)); assertThat(result.getShape(bId), Matchers.not(Optional.empty())); }
FilterShapes(Predicate<Shape> predicate) { this.predicate = predicate .or(shape -> Prelude.isPreludeShape(shape.getId())); }
FilterShapes { FilterShapes(Predicate<Shape> predicate) { this.predicate = predicate .or(shape -> Prelude.isPreludeShape(shape.getId())); } }
FilterShapes { FilterShapes(Predicate<Shape> predicate) { this.predicate = predicate .or(shape -> Prelude.isPreludeShape(shape.getId())); } FilterShapes(Predicate<Shape> predicate); }
FilterShapes { FilterShapes(Predicate<Shape> predicate) { this.predicate = predicate .or(shape -> Prelude.isPreludeShape(shape.getId())); } FilterShapes(Predicate<Shape> predicate);  }
FilterShapes { FilterShapes(Predicate<Shape> predicate) { this.predicate = predicate .or(shape -> Prelude.isPreludeShape(shape.getId())); } FilterShapes(Predicate<Shape> predicate);   }