/*
 * Copyright 2020, TeamDev. All rights reserved.
 *
 * Redistribution and use in source and/or binary forms, with or without
 * modification, must retain the above copyright notice and the following
 * disclaimer.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

package io.spine.base;

import com.google.protobuf.Message;

public abstract class SubscribableField<M extends Message> {

    private final Field field;
    private final Class<M> enclosingMessage;

    protected SubscribableField(Field field, Class<M> message) {
        this.field = field;
        this.enclosingMessage = message;
    }

    /**
     * Returns the enclosed field.
     *
     * @apiNote Named with otherwise redundant "get-" prefix on purpose, to avoid clashing with any
     *        field names.
     */
    public Field getField() {
        return field;
    }

    public Class<M> enclosingMessage() {
        return enclosingMessage;
    }
}

@@ -1067,16 +1067,200 @@
 ssage;%0A%0A
+/**%0A * @apiNote Methods in this class are named with otherwise redundant %22get-%22 prefix to avoid%0A *        clashing with any of the field names in the generated descendant classes.%0A */%0A
 public a
@@ -1371,32 +1371,27 @@
 lass%3CM%3E 
-enclosingM
+m
 essage
+Type
 ;%0A%0A    p
@@ -1446,16 +1446,20 @@
  message
+Type
 ) %7B%0A    
@@ -1495,32 +1495,27 @@
    this.
-enclosingM
+m
 essage
+Type
  = messa
@@ -1516,24 +1516,28 @@
  message
+Type
 ;%0A    %7D%0A
 %0A    /**
@@ -1532,193 +1532,8 @@
   %7D%0A
-%0A    /**%0A     * Returns the enclosed field.%0A     *%0A     * @apiNote Named with otherwise redundant %22get-%22 prefix on purpose, to avoid clashing with any%0A     *        field names.%0A     */
 %0A   
@@ -1608,17 +1608,20 @@
 lass%3CM%3E 
-e
+getE
 nclosing
@@ -1651,24 +1651,19 @@
 urn 
-enclosingM
+m
 essage
+Type
 ;%0A  

Fix the method name