Пример #1
0
 public SampleBuilderSpec<P> blanks(Collection<BlankBuilderSpec<?>> blanks) {
   verifyMutable();
   if (this.blanks == null) {
     this.blanks = new ArrayList<BlankBuilderSpec<?>>();
   }
   if (blanks != null) {
     for (BlankBuilderSpec<?> e : blanks) {
       CollectionUtils.addItem(this.blanks, e);
     }
   }
   return this;
 }
Пример #2
0
 public SampleBuilderSpec<P> otherClasses(Collection<Class<?>> otherClasses) {
   verifyMutable();
   if (this.otherClasses == null) {
     this.otherClasses = new TreeSet<Class<?>>();
   }
   if (otherClasses != null) {
     for (Class<?> e : otherClasses) {
       CollectionUtils.addItem(this.otherClasses, e);
     }
   }
   return this;
 }
Пример #3
0
 public SampleBuilderSpec<P> keywords(Collection<String> keywords) {
   verifyMutable();
   if (this.keywords == null) {
     this.keywords = new HashSet<String>();
   }
   if (keywords != null) {
     for (String e : keywords) {
       CollectionUtils.addItem(this.keywords, e);
     }
   }
   return this;
 }
Пример #4
0
 public SampleBuilderSpec<P> names(Collection<String> names) {
   verifyMutable();
   if (this.names == null) {
     this.names = new ArrayList<String>();
   }
   if (names != null) {
     for (String e : names) {
       CollectionUtils.addItem(this.names, e);
     }
   }
   return this;
 }
Пример #5
0
  public SampleBuilderSpec<P> blanksMap(Map<Integer, BlankBuilderSpec<?>> blanksMap) {
    verifyMutable();

    if (this.blanksMap == null) {
      this.blanksMap = new TreeMap<Integer, BlankBuilderSpec<?>>();
    }
    if (blanksMap != null) {
      for (Map.Entry<Integer, BlankBuilderSpec<?>> e : blanksMap.entrySet()) {
        CollectionUtils.putItem(this.blanksMap, e.getKey(), e.getValue());
      }
    }
    return this;
  }
Пример #6
0
  public BlankBuilderSpec<? extends SampleBuilderSpec<P>> blanks$addBlank() {
    verifyMutable();
    if (this.blanks == null) {
      this.blanks = new ArrayList<BlankBuilderSpec<?>>();
    }

    BlankBuilderSpec<SampleBuilderSpec<P>> result =
        new BlankBuilderSpec<SampleBuilderSpec<P>>(this);

    CollectionUtils.addItem(this.blanks, result);

    return result;
  }
Пример #7
0
  public SampleBuilderSpec<P> keywordCounts(Map<String, Integer> keywordCounts) {
    verifyMutable();

    if (this.keywordCounts == null) {
      this.keywordCounts = new HashMap<String, Integer>();
    }
    if (keywordCounts != null) {
      for (Map.Entry<String, Integer> e : keywordCounts.entrySet()) {
        CollectionUtils.putItem(this.keywordCounts, e.getKey(), e.getValue());
      }
    }
    return this;
  }
Пример #8
0
  public SampleBuilderSpec<P> blanks2blanks(
      Map<BlankBuilderSpec<?>, BlankBuilderSpec<?>> blanks2blanks) {
    verifyMutable();

    if (this.blanks2blanks == null) {
      this.blanks2blanks = new HashMap<BlankBuilderSpec<?>, BlankBuilderSpec<?>>();
    }
    if (blanks2blanks != null) {
      for (Map.Entry<BlankBuilderSpec<?>, BlankBuilderSpec<?>> e : blanks2blanks.entrySet()) {
        CollectionUtils.putItem(this.blanks2blanks, e.getKey(), e.getValue());
      }
    }
    return this;
  }
Пример #9
0
  public SampleBuilderSpec<P> blanks$wrap(Collection<? extends Blank> blanks) {
    verifyMutable();

    if (this.blanks == null) {
      this.blanks = new ArrayList<BlankBuilderSpec<?>>();
    }
    if (blanks != null) {
      for (Blank e : blanks) {
        BlankBuilderSpec<?> wrapped =
            new WrapConverter(BuilderSpecs.DESTINATION_CLASS_RESOLVER, BuilderSpecs.IGNORED_TYPES)
                .convert(e)
                .to(BlankBuilderSpec.class);
        CollectionUtils.addItem(this.blanks, wrapped);
      }
    }
    return this;
  }
Пример #10
0
  public SampleBuilderSpec<P> blanks$restoreFrom(
      BuilderRepository repo, Collection<Object> builderIds) {
    verifyMutable();

    if (this.blanks == null) {
      this.blanks = new ArrayList<BlankBuilderSpec<?>>();
    }
    if (builderIds != null) {
      for (Object builderId : builderIds) {
        Object restoredObject = repo.get(builderId);
        if (restoredObject == null) {
          if (repo.isSupportLazy()) {
            repo.addObjectStoredListener(
                builderId,
                new Procedure() {
                  public void execute(Object... arguments) {
                    CollectionUtils.addItem(SampleBuilderSpec.this.blanks, arguments[0]);
                  }
                });
          } else {
            throw new IllegalStateException("Object does not exist with id " + builderId);
          }
        } else if (!(restoredObject instanceof BlankBuilderSpec)) {
          throw new IllegalStateException(
              "Type mismatch for id: "
                  + builderId
                  + ". "
                  + BlankBuilderSpec.class.getSimpleName()
                  + " vs "
                  + restoredObject.getClass().getSimpleName());
        } else {
          CollectionUtils.addItem(this.blanks, restoredObject);
        }
      }
    }
    return this;
  }
Пример #11
0
 public BlankBuilderSpec<Blanks2blanks$builder<P1>> value$asBlank() {
   BlankBuilderSpec<Blanks2blanks$builder<P1>> result =
       new BlankBuilderSpec<Blanks2blanks$builder<P1>>(Blanks2blanks$builder.this);
   CollectionUtils.putItem(SampleBuilderSpec.this.blanks2blanks, key, result);
   return result;
 }
Пример #12
0
 public Blanks2blanks$builder<P1> value(BlankBuilderSpec<?> value) {
   CollectionUtils.putItem(SampleBuilderSpec.this.blanks2blanks, key, value);
   return Blanks2blanks$builder.this;
 }
Пример #13
0
 public BlankBuilderSpec<Blanks$$$builder<P1>> blank$begin() {
   BlankBuilderSpec<Blanks$$$builder<P1>> result =
       new BlankBuilderSpec<Blanks$$$builder<P1>>(this);
   CollectionUtils.addItem(SampleBuilderSpec.this.blanks, result);
   return result;
 }
Пример #14
0
 public KeywordCounts$builder<P1> value(Integer value) {
   CollectionUtils.putItem(SampleBuilderSpec.this.keywordCounts, key, value);
   return KeywordCounts$builder.this;
 }