Merge "Added headers to the concepts bundles"
[yangtools.git] / concepts / src / main / java / org / opendaylight / yangtools / concepts / AbstractObjectRegistration.java
1 /*\r
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.\r
3  *\r
4  * This program and the accompanying materials are made available under the\r
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
6  * and is available at http://www.eclipse.org/legal/epl-v10.html\r
7  */\r
8 package org.opendaylight.yangtools.concepts;\r
9 \r
10 /**\r
11  * Utility registration handle. It is a convenience for register-style method\r
12  * which can return an AutoCloseable realized by a subclass of this class.\r
13  * Invoking the close() method triggers unregistration of the state the method\r
14  * installed.\r
15  */\r
16 public abstract class AbstractObjectRegistration<T> extends AbstractRegistration implements Registration<T> {\r
17 \r
18     \r
19     private final T instance;\r
20 \r
21     public AbstractObjectRegistration(T instance) {\r
22         this.instance = instance;\r
23     }\r
24 \r
25     @Override\r
26     public final T getInstance() {\r
27         return instance;\r
28     }\r
29 \r
30 }\r