Java Code Examples for io.fabric8.kubernetes.api.builder.VisitableBuilder#accept()

The following examples show how to use io.fabric8.kubernetes.api.builder.VisitableBuilder#accept() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NamedPipelineDecorator.java    From dekorate with Apache License 2.0 5 votes vote down vote up
@Override
public void visit(VisitableBuilder builder) {
  Optional<ObjectMeta> objectMeta = getMetadata(builder);
  if (!objectMeta.isPresent()) {
    return;
  }
  if (Strings.isNullOrEmpty(pipelineName)
      || objectMeta.map(m -> m.getName()).filter(s -> s.equals(pipelineName)).isPresent()) {
    builder.accept(pipelineVisitor);
  }
}
 
Example 2
Source File: NamedTaskDecorator.java    From dekorate with Apache License 2.0 5 votes vote down vote up
@Override
public void visit(VisitableBuilder builder) {
  Optional<ObjectMeta> objectMeta = getMetadata(builder);
  if (!objectMeta.isPresent()) {
    return;
  }
  if (Strings.isNullOrEmpty(taskName)
      || objectMeta.map(m -> m.getName()).filter(s -> s.equals(taskName)).isPresent()) {
    builder.accept(taskVisitor);
  }
}
 
Example 3
Source File: TektonStepDecorator.java    From dekorate with Apache License 2.0 5 votes vote down vote up
@Override
public void visit(VisitableBuilder builder) {
  Optional<ObjectMeta> objectMeta = getMetadata(builder);
  if (!objectMeta.isPresent()) {
    return;
  }
  if (Strings.isNullOrEmpty(taskName) || objectMeta.map(m -> m.getName()).filter(s -> s.equals(taskName)).isPresent()) {
    builder.accept(deploymentVisitor);
  }
}
 
Example 4
Source File: ApplicationContainerDecorator.java    From dekorate with Apache License 2.0 5 votes vote down vote up
@Override
public void visit(VisitableBuilder builder) {
  Optional<ObjectMeta> objectMeta = getMetadata(builder);
  if (!objectMeta.isPresent()) {
    return;
  }
  if (Strings.isNullOrEmpty(deploymentName) || objectMeta.map(m -> m.getName()).filter(s -> s.equals(deploymentName)).isPresent()) {
    builder.accept(deploymentVisitor);
  }
}
 
Example 5
Source File: NamedResourceDecorator.java    From dekorate with Apache License 2.0 5 votes vote down vote up
@Override
public void visit(VisitableBuilder builder) {
  Optional<ObjectMeta> objectMeta = getMetadata(builder);
  if (!objectMeta.isPresent()) {
    return;
  }
  if (Strings.isNullOrEmpty(name)) {
    builder.accept(visitor.withMetadata(objectMeta.get()));
  } else if (objectMeta.map(m -> m.getName()).filter(s -> s.equals(name)).isPresent()) {
    builder.accept(visitor.withMetadata(objectMeta.get()));
  }
}
 
Example 6
Source File: NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableImpl.java    From kubernetes-client with Apache License 2.0 5 votes vote down vote up
private static HasMetadata acceptVisitors(HasMetadata item, List<Visitor> visitors) {
  ResourceHandler<HasMetadata, HasMetadataVisitiableBuilder> h = handlerOf(item);
  VisitableBuilder<HasMetadata, ?> builder = h.edit(item);

  //Let's apply any visitor that might have been specified.
  for (Visitor v : visitors) {
    builder.accept(v);
  }
  return builder.build();
}
 
Example 7
Source File: NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableImpl.java    From kubernetes-client with Apache License 2.0 5 votes vote down vote up
private static List<HasMetadata> acceptVisitors(List<HasMetadata> list, List<Visitor> visitors) {
  List<HasMetadata> result = new ArrayList<>();
  for (HasMetadata item : list) {
    ResourceHandler<HasMetadata, HasMetadataVisitiableBuilder> h = handlerOf(item);
    VisitableBuilder<HasMetadata, ?> builder = h.edit(item);

    //Let's apply any visitor that might have been specified.
    for (Visitor v : visitors) {
      builder.accept(v);
    }
    result.add(builder.build());
  }
  return result;
}
 
Example 8
Source File: NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableListImpl.java    From kubernetes-client with Apache License 2.0 5 votes vote down vote up
private static List<HasMetadata> acceptVisitors(List<HasMetadata> list, List<Visitor> visitors) {
    List<HasMetadata> result = new ArrayList<>();
    for (HasMetadata item : list) {
        ResourceHandler<HasMetadata, HasMetadataVisitiableBuilder> h = handlerOf(item);
        VisitableBuilder<HasMetadata, ?> builder = h.edit(item);

        //Let's apply any visitor that might have been specified.
        for (Visitor v : visitors) {
            builder.accept(v);
        }
        result.add(builder.build());
    }
    return result;
}