Java tutorial
/** * Copyright 2011-2014 Asakusa Framework Team. * * 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.asakusafw.example.direct.seqfile.writable; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import java.util.Date; import org.apache.hadoop.io.Text; import org.apache.hadoop.io.Writable; /** * ?Writable */ public class SalesDetailWritable implements Writable { /** */ protected Date salesDateTime; /** */ protected String storeCode; /** ? */ protected String itemCode; /** ? */ protected int amount; /** ? */ protected int unitSellingPrice; /** ? */ protected int sellingPrice; /** * ? * @return */ public Date getSalesDateTime() { return salesDateTime; } /** * ? * @param salesDateTime ? */ public void setSalesDateTime(Date salesDateTime) { this.salesDateTime = salesDateTime; } /** * ? * @return */ public String getStoreCode() { return storeCode; } /** * ? * @param storeCode ? */ public void setStoreCode(String storeCode) { this.storeCode = storeCode; } /** * ?? * @return ? */ public String getItemCode() { return itemCode; } /** * ?? * @param itemCode ? */ public void setItemCode(String itemCode) { this.itemCode = itemCode; } /** * ?? * @return ? */ public int getAmount() { return amount; } /** * ?? * @param amount ? */ public void setAmount(int amount) { this.amount = amount; } /** * ?? * @return ? */ public int getUnitSellingPrice() { return unitSellingPrice; } /** * ?? * @param unitSellingPrice ? */ public void setUnitSellingPrice(int unitSellingPrice) { this.unitSellingPrice = unitSellingPrice; } /** * ?? * @return ? */ public int getSellingPrice() { return sellingPrice; } /** * ?? * @param sellingPrice ? */ public void setSellingPrice(int sellingPrice) { this.sellingPrice = sellingPrice; } @Override public void write(DataOutput out) throws IOException { out.writeLong(salesDateTime.getTime()); Text.writeString(out, storeCode); Text.writeString(out, itemCode); out.writeInt(amount); out.writeInt(unitSellingPrice); out.writeInt(sellingPrice); } @Override public void readFields(DataInput in) throws IOException { salesDateTime = new Date(in.readLong()); storeCode = Text.readString(in); itemCode = Text.readString(in); amount = in.readInt(); unitSellingPrice = in.readInt(); sellingPrice = in.readInt(); } }