Skip to content

Commit

Permalink
Updating for Java 11
Browse files Browse the repository at this point in the history
Also continuing updates to take advantage of the newer
Java version we build against, fix typos in documentation, and
switch to explicit API annotations to indicate project entry
points.
  • Loading branch information
brunchboy committed May 28, 2024
1 parent 0c41a1c commit 5b3d55c
Show file tree
Hide file tree
Showing 20 changed files with 920 additions and 944 deletions.
1,109 changes: 510 additions & 599 deletions src/main/java/org/deepsymmetry/beatlink/data/MenuLoader.java

Large diffs are not rendered by default.

192 changes: 91 additions & 101 deletions src/main/java/org/deepsymmetry/beatlink/data/MetadataFinder.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.deepsymmetry.beatlink.data;

import org.apiguardian.api.API;
import org.deepsymmetry.beatlink.MediaDetails;
import org.deepsymmetry.cratedigger.pdb.RekordboxAnlz;

Expand All @@ -12,7 +13,7 @@
*
* @since 0.5.0
*/
@SuppressWarnings("WeakerAccess")
@API(status = API.Status.STABLE)
public interface MetadataProvider {
/**
* Get the list of media devices for which metadata can be offered by this provider. If the provider can
Expand All @@ -34,6 +35,7 @@ public interface MetadataProvider {
*
* @return the metadata corresponding to that track, or {@code null} if it is not a track for which we have metadata
*/
@API(status = API.Status.STABLE)
TrackMetadata getTrackMetadata(MediaDetails sourceMedia, DataReference track);

/**
Expand All @@ -46,6 +48,7 @@ public interface MetadataProvider {
*
* @return the art with the specified id, or {@code null} if we don't have it to offer
*/
@API(status = API.Status.STABLE)
AlbumArt getAlbumArt(MediaDetails sourceMedia, DataReference art);

/**
Expand All @@ -58,6 +61,7 @@ public interface MetadataProvider {
*
* @return the beat grid corresponding to that track, or {@code null} if we don't have one to offer
*/
@API(status = API.Status.STABLE)
BeatGrid getBeatGrid(MediaDetails sourceMedia, DataReference track);


Expand All @@ -70,6 +74,7 @@ public interface MetadataProvider {
*
* @return the cue list corresponding to that track, or {@code null} if we don't have one to offer
*/
@API(status = API.Status.STABLE)
CueList getCueList(MediaDetails sourceMedia, DataReference track);

/**
Expand All @@ -82,6 +87,7 @@ public interface MetadataProvider {
*
* @return the waveform preview corresponding to that track, or {@code null} if we don't have one to offer
*/
@API(status = API.Status.STABLE)
WaveformPreview getWaveformPreview(MediaDetails sourceMedia, DataReference track);

/**
Expand All @@ -94,6 +100,7 @@ public interface MetadataProvider {
*
* @return the waveform detail corresponding to that track, or {@code null} if we don't have one to offer
*/
@API(status = API.Status.STABLE)
WaveformDetail getWaveformDetail(MediaDetails sourceMedia, DataReference track);

/**
Expand All @@ -109,5 +116,6 @@ public interface MetadataProvider {
*
* @return the Kaitai Struct object representing the parsed matching section of the file, if one is found.
*/
@API(status = API.Status.STABLE)
RekordboxAnlz.TaggedSection getAnalysisSection(MediaDetails sourceMedia, DataReference track, String fileExtension, String typeTag);
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.deepsymmetry.beatlink.data;

import org.apiguardian.api.API;

/**
* <p>The listener interface for receiving updates when the set of mounted media slots on the network changes.</p>
*
Expand All @@ -12,21 +14,22 @@
*
* @author James Elliott
*/
@SuppressWarnings("WeakerAccess")
@API(status = API.Status.STABLE)
public interface MountListener {

/**
* Report that media is newly available in the specified player slot.
*
* @param slot uniquely identifies a media slot on the network.
*/
@SuppressWarnings("EmptyMethod")
@API(status = API.Status.STABLE)
void mediaMounted(SlotReference slot);

/**
* Report that media is no longer available in the specified player slot.
*
* @param slot uniquely identifies a media slot on the network.
*/
@API(status = API.Status.STABLE)
void mediaUnmounted(SlotReference slot);
}
15 changes: 10 additions & 5 deletions src/main/java/org/deepsymmetry/beatlink/data/OpusProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
*
* @author James Elliott
* @since 8.0.0 */
@API(status = API.Status.STABLE) // TODO get rid of all IntelliJ code pattern entry points and @SuppressWarnings annotations, use this instead.
@API(status = API.Status.EXPERIMENTAL) // TODO get rid of all IntelliJ code pattern entry points and @SuppressWarnings annotations, use this instead.
public class OpusProvider {

private static final Logger logger = LoggerFactory.getLogger(OpusProvider.class);
Expand Down Expand Up @@ -58,6 +58,7 @@ public boolean isRunning() {
/**
* Container for the USB slot number, database and filesystem of any particular Rekordbox USB archive.
*/
@API(status = API.Status.EXPERIMENTAL)
public static class RekordboxUsbArchive {
private final int usbSlot;
private final Database database;
Expand All @@ -81,6 +82,7 @@ private RekordboxUsbArchive(int usbSlot, Database database, FileSystem fileSyste
*
* @return the USB slot on the Opus Quad to which the user has reported this metadata belongs
*/
@API(status = API.Status.EXPERIMENTAL)
public int getUsbSlot() {
return usbSlot;
}
Expand All @@ -90,6 +92,7 @@ public int getUsbSlot() {
*
* @return the parsed database which contains information about tracks, artwork, etc.
*/
@API(status = API.Status.EXPERIMENTAL)
public Database getDatabase() {
return database;
}
Expand All @@ -99,6 +102,7 @@ public Database getDatabase() {
*
* @return the filesystem which contains the database and other metadata
*/
@API(status = API.Status.EXPERIMENTAL)
public FileSystem getFileSystem() {
return fileSystem;
}
Expand All @@ -122,7 +126,7 @@ public FileSystem getFileSystem() {
* @throws java.io.IOException if there is a problem attaching the archive
* @throws IllegalArgumentException if a slot other than the SD or USB slot is specified
*/
@API(status = API.Status.STABLE)
@API(status = API.Status.EXPERIMENTAL)
public synchronized void attachMetadataArchive(File archiveFile, int usbSlotNumber) throws IOException {
if (usbSlotNumber < 1 || usbSlotNumber > 3) {
throw new IllegalArgumentException("Unsupported usbSlotNumber, can only use 1, 2 or 3.");
Expand Down Expand Up @@ -197,7 +201,7 @@ public synchronized void attachMetadataArchive(File archiveFile, int usbSlotNumb
*
* @throws IllegalArgumentException if a slot reference other than the SD or USB slot is specified
*/
@API(status = API.Status.STABLE)
@API(status = API.Status.EXPERIMENTAL)
public RekordboxUsbArchive findArchive(int usbSlotNumber) {
return usbArchiveMap.get(usbSlotNumber);
}
Expand Down Expand Up @@ -314,7 +318,7 @@ private RekordboxAnlz findTrackAnalysis(int usbSlotNumber, DataReference track,
* This is the mechanism by which we offer metadata to the {@link MetadataProvider} while we are running.
* Exposed as public so that it can be used for testing and as a utility if desired.
*/
@API(status = API.Status.STABLE)
@API(status = API.Status.EXPERIMENTAL)
public final MetadataProvider metadataProvider = new MetadataProvider() {
@Override
public List<MediaDetails> supportedMedia() {
Expand Down Expand Up @@ -563,6 +567,7 @@ private boolean trackMatchesArchive(DataReference dataRef, ByteBuffer pssiFromOp
* @param songStructureBytes the PSSI data we have received for the player
* @return the USB slot number in which a match was found, or zero if none was found
*/
@API(status = API.Status.EXPERIMENTAL)
public int findMatchingUsbSlotForTrack(int rekordboxId, int player, ByteBuffer songStructureBytes){
SlotReference slotRef = SlotReference.getSlotReference(player, CdjStatus.TrackSourceSlot.USB_SLOT);
DataReference dataRef = new DataReference(slotRef, rekordboxId);
Expand Down Expand Up @@ -615,7 +620,7 @@ public static OpusProvider getInstance() {
/**
* The folder into which database exports and track analysis files will be extracted.
*/
@API(status = API.Status.STABLE)
@API(status = API.Status.EXPERIMENTAL)
public final File extractDirectory;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
package org.deepsymmetry.beatlink.data;

import org.apiguardian.api.API;

import java.awt.*;

/**
* In order to make it easy for applications like Beat Link Trigger to overlay selections or cues on the GUI
* components offered by Beat Link, they allow an overlay painter to be registered with them, and it will then
* be invoked after the component has done its own painting.
*/
@SuppressWarnings("WeakerAccess")
@API(status = API.Status.STABLE)
public interface OverlayPainter {
/**
* Paint the overlay on top of the component, which has finished doing its own painting.
*
* @param c the component that has just painted itself
* @param g the graphics content in which painting is taking place
*/
@API(status = API.Status.STABLE)
void paintOverlay(Component c, Graphics g);
}
Original file line number Diff line number Diff line change
@@ -1,23 +1,29 @@
package org.deepsymmetry.beatlink.data;

import org.apiguardian.api.API;

/**
* Captures the playback state of a single player that has the track loaded, as an immutable value class.
*/
@API(status = API.Status.STABLE)
public class PlaybackState {

/**
* The player number whose playback state this represents.
*/
@API(status = API.Status.STABLE)
public final int player;

/**
* The current playback position of the player in milliseconds.
*/
@API(status = API.Status.STABLE)
public final long position;

/**
* Whether the player is actively playing the track.
*/
@API(status = API.Status.STABLE)
public final boolean playing;

/**
Expand All @@ -27,7 +33,7 @@ public class PlaybackState {
* @param position the current playback position in milliseconds
* @param playing whether the player is actively playing the track
*/
@SuppressWarnings("WeakerAccess")
@API(status = API.Status.STABLE)
public PlaybackState(int player, long position, boolean playing) {
this.player = player;
this.position = position;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.deepsymmetry.beatlink.data;

import org.apiguardian.api.API;

/**
* Supports delegation of Swing repaint calls to a host component. This is currently used by the
* {@link WaveformPreviewComponent} to operate in a soft-loaded manner in user interfaces which display
Expand All @@ -9,7 +11,7 @@
* used along with {@link WaveformPreviewComponent#setRepaintDelegate(RepaintDelegate)} to enable those
* changes to be communicated to the lighter component which is hosting it.
*/
@SuppressWarnings("WeakerAccess")
@API(status = API.Status.STABLE)
public interface RepaintDelegate {

/**
Expand All @@ -22,6 +24,7 @@ public interface RepaintDelegate {
* @param width the width of the region that we want to have redrawn
* @param height the height of the region that we want to have redrawn
*/
@API(status = API.Status.STABLE)
void repaint(int x, int y, int width, int height);

}
14 changes: 9 additions & 5 deletions src/main/java/org/deepsymmetry/beatlink/data/SearchableItem.java
Original file line number Diff line number Diff line change
@@ -1,25 +1,29 @@
package org.deepsymmetry.beatlink.data;

import org.apiguardian.api.API;

/**
* Represents an item with an ID and label that can be used as a way to select tracks in a dynamic playlist request,
* <p>Represents an item with an ID and label that can be used as a way to select tracks in a dynamic playlist request,
* and on which playlists can be sorted. Many track metadata entries, like artist, genre, and the color labels,
* are represented this way.
* are represented this way.</p>
*
* A simple immutable value class.
* <p>A simple immutable value class.</p>
*
* @author James Elliott
*/
@SuppressWarnings("WeakerAccess")
@API(status = API.Status.STABLE)
public class SearchableItem {

/**
* The database ID associated with this item, for searches.
*/
@API(status = API.Status.STABLE)
public final int id;

/**
* The text label used to show this item to the user.
*/
@API(status = API.Status.STABLE)
public final String label;

/**
Expand All @@ -28,6 +32,7 @@ public class SearchableItem {
* @param id the database ID associated with this item, for searches
* @param label, the text label used to show this item to the user
*/
@API(status = API.Status.STABLE)
public SearchableItem(int id, String label) {
this.id = id;
this.label = label;
Expand All @@ -45,7 +50,6 @@ public int hashCode() {
return result;
}

@SuppressWarnings("BooleanMethodIsAlwaysInverted")
@Override
public boolean equals(Object obj) {
if (obj == this) {
Expand Down
Loading

0 comments on commit 5b3d55c

Please sign in to comment.