@@ -21,9 +21,9 @@ abstract class SocketOwner<T>(val socketClass: Class<T>) {
2121 PlugDescriptor (plug!! ::class .java.name, socketClass.name, metadata(plug)).toJson()
2222
2323 /* *
24- * Instantiates the given plug. Already implemented by the default implementations [Id] and
25- * [Complex ]. If you implement this yourself, make sure that you call [PlugRegistry.register] in
26- * your constructor.
24+ * Instantiates the given plug. Already implemented by the default implementations [SingletonById]
25+ * and [EphemeralByDescriptor ]. If you implement this yourself, make sure that you call
26+ * [PlugRegistry.register] in your constructor.
2727 */
2828 protected abstract fun instantiatePlug (plugDescriptor : PlugDescriptor ): T
2929
@@ -39,7 +39,8 @@ abstract class SocketOwner<T>(val socketClass: Class<T>) {
3939
4040 protected abstract fun remove (plugDescriptor : PlugDescriptor )
4141
42- abstract class Complex <T , ParsedDescriptor >(socketClass : Class <T >) : SocketOwner<T>(socketClass) {
42+ abstract class EphemeralByDescriptor <T , ParsedDescriptor >(socketClass : Class <T >) :
43+ SocketOwner <T >(socketClass) {
4344 private val descriptors = mutableMapOf<ParsedDescriptor , PlugDescriptor >()
4445 init {
4546 PlugRegistry .register(socketClass, this )
@@ -97,7 +98,7 @@ abstract class SocketOwner<T>(val socketClass: Class<T>) {
9798 open fun removeHook (plugDescriptor : PlugDescriptor ) {}
9899 }
99100
100- abstract open class Id <T >(socketClass : Class <T >) : SocketOwner<T>(socketClass) {
101+ abstract open class SingletonById <T >(socketClass : Class <T >) : SocketOwner<T>(socketClass) {
101102 private val descriptorById = mutableMapOf<String , PlugDescriptor >()
102103 private val instanceById = mutableMapOf<String , T >()
103104 init {
@@ -125,9 +126,9 @@ abstract class SocketOwner<T>(val socketClass: Class<T>) {
125126 }
126127 }
127128
128- open fun registerHook (plugDescriptor : PlugDescriptor ) {}
129+ open protected fun registerHook (plugDescriptor : PlugDescriptor ) {}
129130
130- open fun removeHook (plugDescriptor : PlugDescriptor ) {}
131+ open protected fun removeHook (plugDescriptor : PlugDescriptor ) {}
131132
132133 fun allIds () = Collections .unmodifiableSet(descriptorById.keys)
133134
0 commit comments