Make ItemRewriter type getters nullable and optional (#3737)

This commit is contained in:
EnZaXD 2024-03-05 23:23:57 +01:00 committed by GitHub
parent 2d03110f08
commit 908823c612
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -45,11 +45,35 @@ public interface ItemRewriter<T extends Protocol> extends Rewriter<T> {
*/
@Nullable Item handleItemToServer(@Nullable Item item);
Type<Item> itemType();
/**
* Returns the item type of the current protocol.
* @return item type
*/
@Nullable default Type<Item> itemType() {
return null;
}
Type<Item[]> itemArrayType();
/**
* Returns the item array type of the current protocol.
* @return item array type
*/
@Nullable default Type<Item[]> itemArrayType() {
return null;
}
Type<Item> mappedItemType();
/**
* Returns the mapped item type of the target protocol.
* @return mapped item type
*/
@Nullable default Type<Item> mappedItemType() {
return itemType();
}
Type<Item[]> mappedItemArrayType();
/**
* Returns the mapped item array type of the target protocol.
* @return mapped item array type
*/
@Nullable default Type<Item[]> mappedItemArrayType() {
return itemArrayType();
}
}