01: /*
02: * Attributes.java December 2003
03: *
04: * Copyright (C) 2003, Niall Gallagher <niallg@users.sf.net>
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation.
09: *
10: * This library is distributed in the hope that it will be useful,
11: * but WITHOUT ANY WARRANTY; without even the implied warranty of
12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13: * GNU Lesser General Public License for more details.
14: *
15: * You should have received a copy of the GNU Lesser General
16: * Public License along with this library; if not, write to the
17: * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
18: * Boston, MA 02111-1307 USA
19: */
20:
21: package simple.http;
22:
23: import java.util.Set;
24:
25: /**
26: * This is an <code>Attributes</code> object which is used to convey
27: * attributes for a given connection. This is used to describe any
28: * specific attributes that a connection may have, for example any
29: * security policy for HTTPS. The <code>Attributes</code> provide a
30: * subset of the methods provided by the <code>Map</code> object.
31: *
32: * @author Niall Gallagher
33: */
34: public interface Attributes {
35:
36: /**
37: * The <code>put</code> method is used to insert a mapping to
38: * the attributes that pairs the issued name with the issued
39: * value. The value can be referenced in future by its name.
40: *
41: * @param name this is the name of the value being inserted
42: * @param value this is the named value that is inserted
43: */
44: public void put(String name, Object value);
45:
46: /**
47: * The <code>get</code> method is used to retrieve the value
48: * mapped to the specified name. If a value does not exist
49: * matching the given name, then this returns null.
50: *
51: * @param name this is the name of the value to be retrieved
52: *
53: * @return returns the value if it exists or null otherwise
54: */
55: public Object get(String name);
56:
57: /**
58: * The <code>remove</code> method is used to remove the
59: * named value from the attributes. This method will remove
60: * the value or returns silently if the name does not exits.
61: *
62: * @param name this is the name of the value to be removed
63: */
64: public void remove(String name);
65:
66: /**
67: * To ascertain what mappings exist, the names of all values
68: * previously put into this attributes can be retrieved with
69: * this method. This will return a <code>Set</code> that
70: * contains the names of all the mappings added to this.
71: *
72: * @return this returns all the keys for existing mappings
73: */
74: public Set keySet();
75:
76: /**
77: * The <code>contains</code> method is used to determine if
78: * a mapping exists for the given name. This returns true if
79: * the mapping exists or false otherwise.
80: *
81: * @param name this is the name of the mapping to determine
82: *
83: * @return returns true if a mapping exists, false otherwise
84: */
85: public boolean contains(String name);
86: }
|