Record Class WPClassMapping<K,V>
java.lang.Object
java.lang.Record
net.ygbstudio.powerwp4j.models.entities.WPClassMapping<K,V>
- Type Parameters:
K- The type of the key.V- The type of the taxonomy value.- Record Components:
key- The key of the class (category or tag).value- The value of the taxonomy marker.
Represents a mapping between a WordPress API class ID and a taxonomy value.
-
Constructor Summary
ConstructorsConstructorDescriptionWPClassMapping(K key, V value) Creates an instance of aWPClassMappingrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.key()Returns the value of thekeyrecord component.toNumberList(@NotNull List<WPClassMapping<T, U>> classMappingList) Converts a list ofWPClassMappingwith numeric values to a set of the same numeric type.toNumberSet(@NotNull Set<WPClassMapping<T, U>> classMappingSet) Converts a set ofWPClassMappingwith numeric values to a set of the same numeric type.final StringtoString()Returns a string representation of this record class.value()Returns the value of thevaluerecord component.
-
Constructor Details
-
Method Details
-
toNumberSet
public static <T,U extends Number> Set<U> toNumberSet(@NotNull @NotNull Set<WPClassMapping<T, U>> classMappingSet) Converts a set ofWPClassMappingwith numeric values to a set of the same numeric type.- Type Parameters:
T- the type of the key in each class mapping objectU- the numeric type of the values in the input set and the output set- Parameters:
classMappingSet- the set ofWPClassMappingobjects to convert- Returns:
- a set of the numeric type
U
-
toNumberList
@NotNull public static <T,U extends Number> @Unmodifiable @NotNull List<U> toNumberList(@NotNull @NotNull List<WPClassMapping<T, U>> classMappingList) Converts a list ofWPClassMappingwith numeric values to a set of the same numeric type.- Type Parameters:
T- the type of the key in each class mapping objectU- the numeric type of the values in the input list and the output set- Parameters:
classMappingList- the list ofWPClassMappingobjects to convert- Returns:
- a list of the numeric type
U
-
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). -
key
Returns the value of thekeyrecord component.- Returns:
- the value of the
keyrecord component
-
value
Returns the value of thevaluerecord component.- Returns:
- the value of the
valuerecord component
-