Package net.fabricmc.loom.util.service
Record Class ServiceType<O extends Service.Options,S extends Service<O>>
java.lang.Object
java.lang.Record
net.fabricmc.loom.util.service.ServiceType<O,S>
- Record Components:
optionsClass- The options class for the service.serviceClass- The service class.
public record ServiceType<O extends Service.Options,S extends Service<O>> (Class<O extends Service.Options> optionsClass, Class<S extends Service<O>> serviceClass)
extends Record
A record to hold the options and service class for a service.
-
Constructor Summary
ConstructorsConstructorDescriptionServiceType(Class<O> optionsClass, Class<S> serviceClass) Creates an instance of aServiceTyperecord class. -
Method Summary
Modifier and TypeMethodDescriptionorg.gradle.api.provider.Provider<O> Create an instance of the options class for the given service class.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.org.gradle.api.provider.Provider<O> maybeCreate(org.gradle.api.Project project, Function<O, Boolean> function) Maybe create an instance of the options class for the given service class.Returns the value of theoptionsClassrecord component.Returns the value of theserviceClassrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
ServiceType
Creates an instance of aServiceTyperecord class.- Parameters:
optionsClass- the value for theoptionsClassrecord componentserviceClass- the value for theserviceClassrecord component
-
-
Method Details
-
create
public org.gradle.api.provider.Provider<O> create(org.gradle.api.Project project, org.gradle.api.Action<O> action) Create an instance of the options class for the given service class.- Parameters:
project- TheProjectto create the options for.action- An action to configure the options.- Returns:
- The created options provider.
-
maybeCreate
public org.gradle.api.provider.Provider<O> maybeCreate(org.gradle.api.Project project, Function<O, Boolean> function) Maybe create an instance of the options class for the given service class.- Parameters:
project- TheProjectto create the options for.function- A function to configure the options, returning true if the options should be created.- Returns:
- The created options provider.
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
optionsClass
Returns the value of theoptionsClassrecord component.- Returns:
- the value of the
optionsClassrecord component
-
serviceClass
Returns the value of theserviceClassrecord component.- Returns:
- the value of the
serviceClassrecord component
-