class NamedResourceDecorator<T> extends Decorator<VisitableBuilder> {

  /**
   * For resource name null acts as a wildcards.
   * Let's use a constant instead, for clarity's shake
   */
  public static final String ANY = null;

  protected final String kind;
  protected final String name;

  private final ResourceVisitor visitor = new ResourceVisitor(null, null);

  public NamedResourceDecorator() {
    this(ANY, ANY);
  }

  public NamedResourceDecorator(String name) {
    this(ANY, name);
  }

  public NamedResourceDecorator(String kind, String name) {
    this.kind = kind;
    this.name = name;
  }

  public String getKind() {
    return kind;
  }

  public String getName() {
    return name;
  }

  @Override
  public void visit(VisitableBuilder builder) {<FILL_FUNCTION_BODY>}

  /**
   * Visit a part of a Resource.
   *
   * @param item the visited item
   * @param resourceMeta the {@link ObjectMeta} of the current resource.
   */
  public abstract void andThenVisit(T item, ObjectMeta resourceMeta);

  /**
   * Visit a part of a Resource.
   *
   * @param item the visited item
   * @param kind the resource kind
   * @param resourceMeta the {@link ObjectMeta} of the current resource.
   */
  public void andThenVisit(T item, String kind, ObjectMeta resourceMeta) {
    andThenVisit(item, resourceMeta);
  }

  private class ResourceVisitor extends TypedVisitor<T> {

    private final String kind;
    private final ObjectMeta metadata;

    public ResourceVisitor(String kind, ObjectMeta metadata) {
      this.kind = kind;
      this.metadata = metadata;
    }

    @Override
    public void visit(T item) {
      andThenVisit(item, kind, metadata);
    }

    public ResourceVisitor withKind(String kind) {
      return new ResourceVisitor(kind, this.metadata);
    }

    public ResourceVisitor withMetadata(ObjectMeta metadata) {
      return new ResourceVisitor(this.kind, metadata);
    }

    public Class<T> getType() {
      return (Class) Generics
          .getTypeArguments(NamedResourceDecorator.class, NamedResourceDecorator.this.getClass())
          .get(0);
    }
  }

  @Override
  public Class<? extends Decorator>[] after() {
    return new Class[] { ResourceProvidingDecorator.class };
  }
}

    Optional<String> resourceKind = Metadata.getKind(builder);
    Optional<ObjectMeta> objectMeta = Metadata.getMetadata(builder);
    if (!resourceKind.isPresent() || !objectMeta.isPresent()) {
      return;
    }
    if (Utils.isNullOrEmpty(kind)) {
      if (Utils.isNullOrEmpty(name)) {
        builder.accept(visitor.withKind(resourceKind.get()).withMetadata(objectMeta.get()));
      } else if (objectMeta.map(ObjectMeta::getName).filter(s -> s.equals(name)).isPresent()) {
        builder.accept(visitor.withKind(resourceKind.get()).withMetadata(objectMeta.get()));
      }
    } else if (resourceKind.filter(k -> k.equals(kind)).isPresent()) {
      if (Utils.isNullOrEmpty(name)) {
        builder.accept(visitor.withKind(resourceKind.get()).withMetadata(objectMeta.get()));
      } else if (objectMeta.map(ObjectMeta::getName).filter(s -> s.equals(name)).isPresent()) {
        builder.accept(visitor.withKind(resourceKind.get()).withMetadata(objectMeta.get()));
      }
    }
  
<methods>public non-sealed void <init>() ,public Class<? extends Decorator#RAW>[] after() ,public Class<? extends Decorator#RAW>[] before() ,public int compareTo(Decorator#RAW) <variables>