APIAdapter.java
2.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package com.mumfrey.liteloader.api.manager;
import java.util.List;
import com.mumfrey.liteloader.api.CoreProvider;
import com.mumfrey.liteloader.api.LiteAPI;
import com.mumfrey.liteloader.api.Observer;
import com.mumfrey.liteloader.interfaces.InterfaceRegistry;
/**
* API Adapter provides convenience methods for invoking actions on ALL registered APIs
*
* @author Adam Mummery-Smith
*/
public interface APIAdapter
{
/**
* Aggregate and return required transformers from all registered APIs
*/
public abstract List<String> getRequiredTransformers();
/**
* Aggregate and return required downstream transformers from all registered APIs
*/
public abstract List<String> getRequiredDownstreamTransformers();
/**
* Register interfaces from all registered APIs with the specified registry
*/
public abstract void registerInterfaces(InterfaceRegistry interfaceManager);
/**
* Get the CoreProviders for the specified API. Consuming classes should call this method instead of calling API::getCoreProviders()
* directly since getCoreProviders() should only be invoked once and the resulting collection is cached by the API Adapter
*/
public abstract List<CoreProvider> getCoreProviders();
/**
* Get the observers for the specified API. Consuming classes should call this method instead of calling API::getObservers() directly
* since getObservers() should only be invoked once and the resulting list is cached by the API Adapter
*
* @param api API to get observers for
*/
public abstract List<? extends Observer> getObservers(LiteAPI api);
/**
* Get the observers for the specified API which implement the specified Observer interface. Always returns a valid list (even if
* empty) and doesn't return null.
*
* @param api API to get observers for
* @param observerType type of observer to search for
*/
public abstract <T extends Observer> List<T> getObservers(LiteAPI api, Class<T> observerType);
/**
* Get the observers for all registered APIs which implement the specified Observer interface. Always returns a valid list (even if
* empty) and doesn't return null. Also includes core providers
*
* @param observerType type of observer to search for
*/
public abstract <T extends Observer> List<T> getAllObservers(Class<T> observerType);
/**
* @param api
*/
public abstract List<? extends Observer> getPreInitObservers(LiteAPI api);
/**
* @param observerType
*/
public abstract <T extends Observer> List<T> getPreInitObservers(Class<T> observerType);
}