KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > beans > factory > parsing > ConstructorArgumentEntry


1 /*
2  * Copyright 2002-2007 the original author or authors.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.springframework.beans.factory.parsing;
18
19 import org.springframework.util.Assert;
20
21 /**
22  * {@link ParseState} entry representing a (possibly indexed)
23  * constructor argument.
24  *
25  * @author Rob Harrop
26  * @author Juergen Hoeller
27  * @since 2.0
28  */

29 public class ConstructorArgumentEntry implements ParseState.Entry {
30
31     private final int index;
32
33
34     /**
35      * Creates a new instance of the {@link ConstructorArgumentEntry} class
36      * representing a constructor argument with a (currently) unknown index.
37      */

38     public ConstructorArgumentEntry() {
39         this.index = -1;
40     }
41
42     /**
43      * Creates a new instance of the {@link ConstructorArgumentEntry} class
44      * representing a constructor argument at the supplied <code>index</code>.
45      * @param index the index of the constructor argument
46      * @throws IllegalArgumentException if the supplied <code>index</code>
47      * is less than zero
48      */

49     public ConstructorArgumentEntry(int index) {
50         Assert.isTrue(index >= 0, "Constructor argument index must be greater than or equal to zero");
51         this.index = index;
52     }
53
54
55     public String JavaDoc toString() {
56         return "Constructor-arg" + (this.index >= 0 ? " #" + this.index : "");
57     }
58
59 }
60
Popular Tags