Stefano Lenzi | 476013d | 2007-09-21 23:59:54 +0000 | [diff] [blame] | 1 | /*
|
Clement Escoffier | 491a123 | 2007-12-04 16:09:03 +0000 | [diff] [blame] | 2 | * $Id: Parameter.java 44 2007-07-13 20:49:41Z hargrave@us.ibm.com $
|
Stefano Lenzi | 476013d | 2007-09-21 23:59:54 +0000 | [diff] [blame] | 3 | *
|
Clement Escoffier | 491a123 | 2007-12-04 16:09:03 +0000 | [diff] [blame] | 4 | * Copyright (c) OSGi Alliance (2002, 2006, 2007). All Rights Reserved.
|
Stefano Lenzi | 476013d | 2007-09-21 23:59:54 +0000 | [diff] [blame] | 5 | *
|
Clement Escoffier | 491a123 | 2007-12-04 16:09:03 +0000 | [diff] [blame] | 6 | * 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 Lenzi | 476013d | 2007-09-21 23:59:54 +0000 | [diff] [blame] | 17 | */
|
Stefano Lenzi | 476013d | 2007-09-21 23:59:54 +0000 | [diff] [blame] | 18 | package org.osgi.impl.bundle.obr.resource;
|
| 19 |
|
| 20 | class 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 | }
|