ca0ce1e76cbd2d5660a03986a4758efb3783775d
[yangtools.git] / common / concepts / src / main / java / org / opendaylight / yangtools / concepts / ObjectRegistration.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.yangtools.concepts;
9
10 import javax.annotation.Nonnull;
11
12 /**
13  * Class representing a registration of an object. Such a registration is a proper resource and should be cleaned up
14  * when no longer required, so references to the object can be removed. This mechanism lies above the usual Java
15  * reference mechanism, as the entity where the object is registered may reside outside of the Java Virtual Machine.
16  */
17 public interface ObjectRegistration<T> extends Registration {
18     /**
19      * Return the object instance.
20      *
21      * @return Registered object.
22      */
23     @Nonnull T getInstance();
24
25     @Override
26     void close();
27 }