Package edu.wpi.grip.core
Class OperationDescription
- java.lang.Object
-
- edu.wpi.grip.core.OperationDescription
-
@Immutable public class OperationDescription extends java.lang.Object
An interface describing how an operation should be displayed in thePalette
to the user.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
OperationDescription.Builder
Builder class forOperationDescription
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description com.google.common.collect.ImmutableSet<java.lang.String>
aliases()
This is used to preserve compatibility with old versions of GRIP if the operation name changes.static OperationDescription.Builder
builder()
Creates a newOperationDescription.Builder
instance to create a newOperationDescription
object.OperationCategory
category()
boolean
equals(java.lang.Object o)
static OperationDescription
from(Description description)
Creates an operation description from a@Description
annotation on an operation subclass.static OperationDescription
from(java.lang.Class<? extends Operation> clazz)
Creates an operation description from a@Description
annotation on an operation subclass.int
hashCode()
java.util.Optional<java.io.InputStream>
icon()
AnInputStream
of a 128x128 image to show the user as a representation of the operation.java.lang.String
name()
java.lang.String
summary()
java.lang.String
toString()
-
-
-
Method Detail
-
from
public static OperationDescription from(Description description)
Creates an operation description from a@Description
annotation on an operation subclass.
-
from
public static OperationDescription from(java.lang.Class<? extends Operation> clazz)
Creates an operation description from a@Description
annotation on an operation subclass. The class is assumed to have the annotation; be careful when using this method.- Parameters:
clazz
- the class to generate a description for
-
builder
public static OperationDescription.Builder builder()
Creates a newOperationDescription.Builder
instance to create a newOperationDescription
object. The created descriptor has a default category ofMISCELLANEOUS
and no icon; use the.category()
and.icon()
methods to override the default values.
-
name
public java.lang.String name()
- Returns:
- The unique user-facing name of the operation, such as "Gaussian Blur".
-
summary
public java.lang.String summary()
- Returns:
- A summary of the operation.
-
category
public OperationCategory category()
- Returns:
- What category the operation falls under. This is used to organize them in the GUI.
-
icon
public java.util.Optional<java.io.InputStream> icon()
AnInputStream
of a 128x128 image to show the user as a representation of the operation.- Returns:
- The icon to be displayed.
-
aliases
public com.google.common.collect.ImmutableSet<java.lang.String> aliases()
This is used to preserve compatibility with old versions of GRIP if the operation name changes.- Returns:
- Any old unique user-facing names of the operation.
-
equals
public boolean equals(@Nullable java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-