InterfaceRegistrationDelegate.java
2.05 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
package com.mumfrey.liteloader.core;
import java.util.ArrayList;
import java.util.List;
import com.mumfrey.liteloader.api.Listener;
import com.mumfrey.liteloader.api.InterfaceProvider;
import com.mumfrey.liteloader.core.LiteLoaderInterfaceManager.InterfaceHandler;
import com.mumfrey.liteloader.interfaces.InterfaceRegistry;
/**
* Delegate passed in to an InterfaceProvider's registerInterfaces method
* @author Adam Mummery-Smith
*/
public class InterfaceRegistrationDelegate
{
/**
* Registry which this delegate is delegating for
*/
private final InterfaceRegistry registry;
/**
* InterfaceProvider being queried
*/
private final InterfaceProvider provider;
/**
* The registry temporarily stores the list of handlers here
*/
private final List<InterfaceHandler> handlers = new ArrayList<InterfaceHandler>();
/**
* @param registry
* @param provider
*/
InterfaceRegistrationDelegate(InterfaceRegistry registry, InterfaceProvider provider)
{
this.registry = registry;
this.provider = provider;
}
/**
* @param handler
*/
void addHandler(InterfaceHandler handler)
{
this.handlers.add(handler);
}
/**
*
*/
List<InterfaceHandler> getHandlers()
{
return this.handlers;
}
/**
*
*/
void registerInterfaces()
{
this.provider.registerInterfaces(this);
}
/**
* @param interfaceType
*/
public void registerInterface(Class<? extends Listener> interfaceType)
{
this.registry.registerInterface(this.provider, interfaceType);
}
/**
* @param interfaceType
* @param priority
*/
public void registerInterface(Class<? extends Listener> interfaceType, int priority)
{
this.registry.registerInterface(this.provider, interfaceType, priority);
}
/**
* @param interfaceType
* @param priority
* @param exclusive
*/
public void registerInterface(Class<? extends Listener> interfaceType, int priority, boolean exclusive)
{
this.registry.registerInterface(this.provider, interfaceType, priority, exclusive);
}
}