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

com.g2forge.alexandria.java.resource.CountResource Maven / Gradle / Ivy

There is a newer version: 0.0.18
Show newest version
package com.g2forge.alexandria.java.resource;

import com.g2forge.alexandria.java.close.ICloseable;

public class CountResource implements ICloseableResource {
	protected int nesting;

	public void close(int previous) {
		this.nesting = previous;
	}

	@Override
	public Integer get() {
		return nesting;
	}

	@Override
	public ICloseable open(Integer value) {
		final int previous = nesting;
		this.nesting += value;
		return () -> close(previous);
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy