Class XMLUtil
java.lang.Object
me.despical.inventoryframework.util.XMLUtil
An utility class for xml files
- Since:
- 1.0.1
Created at 04.09.2020
- Author:
- Despical
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidloadFieldAttribute(@NotNull Object instance, @NotNull Element element, @Nullable Object value) Sets a field from the given instance and element to the specified valuestatic <T extends org.bukkit.event.Event>
@Nullable Consumer<T> loadOnEventAttribute(@NotNull Object instance, @NotNull Element element, @NotNull Class<T> eventType, @NotNull String name) Loads an event consumer from the given instance and element
-
Constructor Details
-
XMLUtil
public XMLUtil()
-
-
Method Details
-
loadOnEventAttribute
@Nullable @Contract(pure=true) public static <T extends org.bukkit.event.Event> @Nullable Consumer<T> loadOnEventAttribute(@NotNull @NotNull Object instance, @NotNull @NotNull Element element, @NotNull @NotNull Class<T> eventType, @NotNull @NotNull String name) Loads an event consumer from the given instance and element- Type Parameters:
T- any object that is event- Parameters:
instance- the object instanceelement- the elementeventType- event type of classname- the name of the attribute- Returns:
- the consumer to be called on click
-
loadFieldAttribute
public static void loadFieldAttribute(@NotNull @NotNull Object instance, @NotNull @NotNull Element element, @Nullable @Nullable Object value) Sets a field from the given instance and element to the specified value- Parameters:
instance- the class instance the field is located inelement- the element from which the field is specifiedvalue- the field's new value
-