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 18a670b commit 0c41a1c
Show file tree
Hide file tree
Showing 6 changed files with 211 additions and 184 deletions.
15 changes: 12 additions & 3 deletions src/main/java/org/deepsymmetry/beatlink/data/ColorItem.java
Original file line number Diff line number Diff line change
@@ -1,26 +1,31 @@
package org.deepsymmetry.beatlink.data;

import org.apiguardian.api.API;

import java.awt.*;

/**
* Represents a track color label. This is a specialized {@link SearchableItem}, since in addition to a specific color,
* <p>Represents a track color label. This is a specialized {@link SearchableItem}, since in addition to a specific color,
* it has 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.
* and on which playlists can be sorted.</p>
*
* A simple immutable value class.
* <p>A simple immutable value class.</p>
*
* @author James Elliott
*/
@API(status = API.Status.STABLE)
public class ColorItem extends SearchableItem {

/**
* The color that is represented by this item.
*/
@API(status = API.Status.STABLE)
public final Color color;

/**
* The name of the color represented by this item, for textual display.
*/
@API(status = API.Status.STABLE)
public final String colorName;

/**
Expand All @@ -30,6 +35,7 @@ public class ColorItem extends 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 ColorItem(int id, String label) {
super(id, label);
color = colorForId(id);
Expand Down Expand Up @@ -69,6 +75,7 @@ public boolean equals(Object obj) {
* @param color a color to be examined
* @return {@code true} if the color represents the lack of a color assignment
*/
@API(status = API.Status.STABLE)
public static boolean isNoColor(Color color) {
return color.getAlpha() == 0;
}
Expand All @@ -83,6 +90,7 @@ public static boolean isNoColor(Color color) {
*
* @return the color that should be displayed (or which the UI should be tinted with)
*/
@API(status = API.Status.STABLE)
public static Color colorForId(int colorId) {
switch (colorId) {

Expand Down Expand Up @@ -125,6 +133,7 @@ public static Color colorForId(int colorId) {
*
* @return the color that should be displayed (or which the UI should be tinted with)
*/
@API(status = API.Status.STABLE)
public static String colorNameForId(int colorId) {
switch (colorId) {
case 0:
Expand Down
Loading

0 comments on commit 0c41a1c

Please sign in to comment.