PageRenderTime 20ms CodeModel.GetById 12ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 1ms

/hazelcast/src/main/java/com/hazelcast/core/ItemEvent.java

https://bitbucket.org/gabral6_gmailcom/hazelcast
Java | 63 lines | 33 code | 10 blank | 20 comment | 0 complexity | fb15c315e3400c886d99d62dc1cdd279 MD5 | raw file
 1/*
 2 * Copyright (c) 2008-2013, Hazelcast, Inc. All Rights Reserved.
 3 *
 4 * Licensed under the Apache License, Version 2.0 (the "License");
 5 * you may not use this file except in compliance with the License.
 6 * You may obtain a copy of the License at
 7 *
 8 * http://www.apache.org/licenses/LICENSE-2.0
 9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.hazelcast.core;
18
19import java.util.EventObject;
20
21public class ItemEvent<E> extends EventObject {
22
23    private final E item;
24    private final ItemEventType eventType;
25    private final Member member;
26
27    public ItemEvent(String name, int eventType, E item, Member member) {
28        this(name, ItemEventType.getByType(eventType), item, member);
29    }
30
31    public ItemEvent(String name, ItemEventType itemEventType, E item, Member member) {
32        super(name);
33        this.item = item;
34        this.eventType = itemEventType;
35        this.member = member;
36    }
37
38    public ItemEventType getEventType() {
39        return eventType;
40    }
41
42    public E getItem() {
43        return item;
44    }
45
46    /**
47     * Returns the member fired this event.
48     *
49     * @return the member fired this event.
50     */
51    public Member getMember() {
52        return member;
53    }
54
55    @Override
56    public String toString() {
57        return "ItemEvent{" +
58                "event=" + eventType +
59                ", item=" + getItem() +
60                ", member=" + getMember() +
61                "} ";
62    }
63}