001// Copyright (C) 1999-2001 by Jason Hunter <jhunter_AT_acm_DOT_org>. 002// All rights reserved. Use of this class is limited. 003// Please see the LICENSE for more information. 004 005package com.oreilly.servlet.multipart; 006 007/** 008 * A <code>Part</code> is an abstract upload part which represents an 009 * <code>INPUT</code> form element in a <code>multipart/form-data</code> form 010 * submission. 011 * 012 * @see FilePart 013 * @see ParamPart 014 * 015 * @author Geoff Soutter 016 * @version 1.0, 2000/10/27, initial revision 017 */ 018public abstract class Part { 019 private String name; 020 021 /** 022 * Constructs an upload part with the given name. 023 */ 024 Part(String name) { 025 this.name = name; 026 } 027 028 /** 029 * Returns the name of the form element that this Part corresponds to. 030 * 031 * @return the name of the form element that this Part corresponds to. 032 */ 033 public String getName() { 034 return name; 035 } 036 037 /** 038 * Returns true if this Part is a FilePart. 039 * 040 * @return true if this is a FilePart. 041 */ 042 public boolean isFile() { 043 return false; 044 } 045 046 /** 047 * Returns true if this Part is a ParamPart. 048 * 049 * @return true if this is a ParamPart. 050 */ 051 public boolean isParam() { 052 return false; 053 } 054}