All Downloads are FREE. Search and download functionalities are using the official Maven repository.

xapi.util.api.Pointer Maven / Gradle / Ivy

Go to download

Everything needed to run a comprehensive dev environment. Just type X_ and pick a service from autocomplete; new dev modules will be added as they are built. The only dev service not included in the uber jar is xapi-dev-maven, as it includes all runtime dependencies of maven, adding ~4 seconds to build time, and 6 megabytes to the final output jar size (without xapi-dev-maven, it's ~1MB).

The newest version!
package xapi.util.api;

import xapi.annotation.inject.InstanceDefault;


/**
 * This is not "actually" a pointer, but a hard Reference.
 * Since that name is taken, we go with Pointer. :)
 * 

* It implements {@link ProvidesValue}, {@link ReceivesValue} and {@link Bean}. *

* This class is final for compiler optimization; * you should pass references as Bean if you want api compatibility, * and Pointer if you want better inlining characteristics. * * @author "James X. Nelson ([email protected])" * @param - The type of X this pointer wraps. */ @InstanceDefault(implFor=Bean.class) public final class Pointer implements ProvidesValue, ReceivesValue, Bean { public Pointer() { } public Pointer(X x) { set(x); } private volatile X x; public final void set(X x) { this.x=x; } @Override public final X get() { return x; } public final X remove() { try { return x; }finally { x = null; } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy