001/* 002 * (C) Copyright 2017 Nuxeo SA (http://nuxeo.com/) and others. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 * 016 * Contributors: 017 * bdelbosc 018 */ 019package org.nuxeo.lib.stream.log; 020 021import java.io.Externalizable; 022 023/** 024 * A LogRecord contains the message and its offset. 025 * 026 * @since 9.3 027 */ 028public class LogRecord<M extends Externalizable> { 029 protected final M message; 030 031 protected final LogOffset offset; 032 033 public LogRecord(M message, LogOffset offset) { 034 this.message = message; 035 this.offset = offset; 036 } 037 038 /** 039 * @since 9.3 040 */ 041 public M message() { 042 return message; 043 } 044 045 /** 046 * @since 9.3 047 */ 048 public LogOffset offset() { 049 return offset; 050 } 051 052 @Override 053 public String toString() { 054 return "LogRecord{" + "message=" + message + ", offset=" + offset + '}'; 055 } 056 057}