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 031 private ResourceReleaseEventImpl(final Builder builder) { 032 this.identifier = BuilderUtils.notNull(builder.identifier); 033 } 034 035 @Override 036 public String getIdentifier() { 037 return identifier; 038 } 039 040 public static Builder newBuilder() { 041 return new Builder(); 042 } 043 044 /** 045 * Builder used to create ResourceReleaseEvent instances. 046 */ 047 public static final class Builder implements org.apache.reef.util.Builder<ResourceReleaseEvent> { 048 049 private String identifier; 050 051 /** 052 * @see ResourceReleaseEvent#getIdentifier() 053 */ 054 public Builder setIdentifier(final String identifier) { 055 this.identifier = identifier; 056 return this; 057 } 058 059 @Override 060 public ResourceReleaseEvent build() { 061 return new ResourceReleaseEventImpl(this); 062 } 063 } 064}