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

The following examples show how to use io.fabric8.kubernetes.api.builder.VisitableBuilder#build() . 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: Metadata.java    From dekorate with Apache License 2.0 5 votes vote down vote up
/**
 * Create a {@link Predicate} that checks that a resource builder doesn't match the name and kind.
 * @param kind The specified kind.
 * @param name The specified name.
 * @return The predicate.
 */
public static Predicate<VisitableBuilder<? extends HasMetadata, ?>> matching(String apiVersion, String kind, String name) {
  return new Predicate<VisitableBuilder<? extends HasMetadata, ?>>() {
    @Override
    public Boolean apply(VisitableBuilder<? extends HasMetadata, ?> builder) {
      HasMetadata item = builder.build();
      ObjectMeta metadata = item.getMetadata();
      return apiVersion.equals(item.getApiVersion()) &&
        kind != null && kind.equals(item.getKind()) &&
        name != null && name.equals(metadata.getName());
    }
  };
}
 
Example 2
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();
}