public SampleBuilderSpec<P> blank$restoreFrom(BuilderRepository repo, Object builderId) {
    verifyMutable();

    Object restoredObject = repo.get(builderId);
    if (restoredObject == null) {
      if (repo.isSupportLazy()) {
        repo.addObjectStoredListener(
            builderId,
            new Procedure() {
              public void execute(Object... arguments) {
                SampleBuilderSpec.this.blank = (BlankBuilderSpec<?>) 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 {
      this.blank = (BlankBuilderSpec<?>) restoredObject;
    }
    return this;
  }
  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;
  }
示例#3
0
 public AliasJoinBuilder<P> storeTo(BuilderRepository repo, Object builderId) {
   repo.put(builderId, this);
   return this;
 }
 @Override
 public EntityIdentifierBuilder<P> storeTo(BuilderRepository repo, Object builderId) {
   repo.put(builderId, this);
   return this;
 }
 public SampleBuilderSpec<P> storeTo(BuilderRepository repo, Object builderId) {
   repo.put(builderId, this);
   return this;
 }
示例#6
0
 public static PaperBuilder<?> paper$restoreFrom(BuilderRepository repo, int builderId) {
   return (PaperBuilder<?>) repo.get(builderId);
 }
示例#7
0
 public static ColorBuilder<?> color$restoreFrom(BuilderRepository repo, int builderId) {
   return (ColorBuilder<?>) repo.get(builderId);
 }
示例#8
0
 public static BookBuilder<?> book$restoreFrom(BuilderRepository repo, int builderId) {
   return (BookBuilder<?>) repo.get(builderId);
 }
示例#9
0
 public static FictionBuilder<?> fiction$restoreFrom(BuilderRepository repo, int builderId) {
   return (FictionBuilder<?>) repo.get(builderId);
 }