Controlling Solenoids in Java

So I have googled compressor and solenoid examples, but my team wants to control when the shift in the gearbox happens via controller. I have no idea how to do that, please help, much appreciated.

Solenoid shifter = new Solenoid(Whatever port it is in);

shifter.set(a boolean)