All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.shipdream.lib.android.mvc.event.BaseEvent Maven / Gradle / Ivy

Go to download

Controller module for AndroidMvc Framework. It doesn't depend on Android SDK thus app controller module depending on this module would do jUnit test easily on pure JVM.

The newest version!
/*
 * Copyright 2016 Kejun Xia
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.shipdream.lib.android.mvc.event;

/**
 * Base event.
 */
public abstract class BaseEvent {
    private final Object sender;

    /**
     * Construct an event
     * @param sender Who initially sent the request that triggers this event
     */
    public BaseEvent(Object sender) {
        this.sender = sender;
    }

    /**
     * Gets the sender that tracks who initially sends a command leading to trigger this event. It's
     * useful when the origin of the event is important. For example, in a login controller there is
     * a login function - login(sender). It could be called by a button click operation or an
     * automatic call on app start up. Then the event handler may needs to handle the successful
     * login differently based on different login requesters when sender is useful to differentiate
     * these scenarios.
     *
     * @return Who initially sent the request that triggers this event.
     */
    public Object getSender(){
        return sender;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy