/* * Proxy.java * * Copyright (c) 2007 Vreixo Formoso * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * See COPYING file for details. */ package org.pykix.libburnia.bindings; import java.lang.ref.WeakReference; import java.util.HashMap; /** * Wrapper around a native C resource, i.e., a pointer. * *
* This also keeps track of all Java objects that are a wrapper around * a C object, to prevent replication of objects when retrieved from C * side. * *
* This class is a implementation detail, that should be never user
* by a developer
*
* @author Vreixo Formoso
* @since 0.1
*/
public abstract class Proxy {
/** Pointer to C object. */
private final long pointer;
/** Keeps track of existing pointers. */
private static final HashMapnull
if no Proxy is registered.
*/
protected static Proxy proxyFor(long ptr) {
WeakReference