コード例 #1
0
  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;
  }
コード例 #2
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;
  }
コード例 #3
0
 public AliasJoinBuilder<P> storeTo(BuilderRepository repo, Object builderId) {
   repo.put(builderId, this);
   return this;
 }
コード例 #4
0
 @Override
 public EntityIdentifierBuilder<P> storeTo(BuilderRepository repo, Object builderId) {
   repo.put(builderId, this);
   return this;
 }
コード例 #5
0
 public SampleBuilderSpec<P> storeTo(BuilderRepository repo, Object builderId) {
   repo.put(builderId, this);
   return this;
 }
コード例 #6
0
ファイル: Builders.java プロジェクト: nebulae2us/electron
 public static PaperBuilder<?> paper$restoreFrom(BuilderRepository repo, int builderId) {
   return (PaperBuilder<?>) repo.get(builderId);
 }
コード例 #7
0
ファイル: Builders.java プロジェクト: nebulae2us/electron
 public static ColorBuilder<?> color$restoreFrom(BuilderRepository repo, int builderId) {
   return (ColorBuilder<?>) repo.get(builderId);
 }
コード例 #8
0
ファイル: Builders.java プロジェクト: nebulae2us/electron
 public static BookBuilder<?> book$restoreFrom(BuilderRepository repo, int builderId) {
   return (BookBuilder<?>) repo.get(builderId);
 }
コード例 #9
0
ファイル: Builders.java プロジェクト: nebulae2us/electron
 public static FictionBuilder<?> fiction$restoreFrom(BuilderRepository repo, int builderId) {
   return (FictionBuilder<?>) repo.get(builderId);
 }