blob: 50381323d924a3bd17b67fb8c306a8e65faeb5fb [file] [log] [blame]
Stefano Lenzi476013d2007-09-21 23:59:54 +00001/*
Clement Escoffier491a1232007-12-04 16:09:03 +00002 * $Id: Parameter.java 44 2007-07-13 20:49:41Z hargrave@us.ibm.com $
Stefano Lenzi476013d2007-09-21 23:59:54 +00003 *
Clement Escoffier491a1232007-12-04 16:09:03 +00004 * Copyright (c) OSGi Alliance (2002, 2006, 2007). All Rights Reserved.
Stefano Lenzi476013d2007-09-21 23:59:54 +00005 *
Clement Escoffier491a1232007-12-04 16:09:03 +00006 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
Stefano Lenzi476013d2007-09-21 23:59:54 +000017 */
Stefano Lenzi476013d2007-09-21 23:59:54 +000018package org.osgi.impl.bundle.obr.resource;
19
20class Parameter {
21 final static int ATTRIBUTE = 1;
22 final static int DIRECTIVE = 2;
23 final static int SINGLE = 0;
24
25 int type;
26 String key;
27 String value;
28
29 public String toString() {
30 StringBuffer sb = new StringBuffer();
31 sb.append(key);
32 switch (type) {
33 case ATTRIBUTE :
34 sb.append("=");
35 break;
36 case DIRECTIVE :
37 sb.append(":=");
38 break;
39 case SINGLE :
40 return sb.toString();
41 }
42 sb.append(value);
43 return sb.toString();
44 }
45
46 boolean is(String s, int type) {
47 return this.type == type && key.equalsIgnoreCase(s);
48 }
49}