This project has retired. For details please refer to its Attic page.
Source code
001/*
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 *   http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing,
013 * software distributed under the License is distributed on an
014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 * KIND, either express or implied.  See the License for the
016 * specific language governing permissions and limitations
017 * under the License.
018 */
019package org.apache.reef.runtime.common.driver.api;
020
021import org.apache.reef.util.BuilderUtils;
022
023/**
024 * Default POJO implementation of ResourceReleaseEvent.
025 * Use newBuilder to construct an instance.
026 */
027public final class ResourceReleaseEventImpl implements ResourceReleaseEvent {
028
029  private final String identifier;
030  private final String runtimeName;
031
032  private ResourceReleaseEventImpl(final Builder builder) {
033    this.identifier = BuilderUtils.notNull(builder.identifier);
034    this.runtimeName = BuilderUtils.notNull(builder.runtimeName);
035  }
036
037  @Override
038  public String getIdentifier() {
039    return identifier;
040  }
041
042  @Override
043  public String getRuntimeName() {
044    return runtimeName;
045  }
046
047  public static Builder newBuilder() {
048    return new Builder();
049  }
050
051  /**
052   * Builder used to create ResourceReleaseEvent instances.
053   */
054  public static final class Builder implements org.apache.reef.util.Builder<ResourceReleaseEvent> {
055
056    private String identifier;
057    private String runtimeName;
058    /**
059     * @see ResourceReleaseEvent#getIdentifier()
060     */
061    public Builder setIdentifier(final String identifier) {
062      this.identifier = identifier;
063      return this;
064    }
065
066    /**
067     * @see ResourceReleaseEvent#getRuntimeName()
068     */
069    public Builder setRuntimeName(final String runtimeName) {
070      this.runtimeName = runtimeName;
071      return this;
072    }
073
074    @Override
075    public ResourceReleaseEvent build() {
076      return new ResourceReleaseEventImpl(this);
077    }
078  }
079}