Stuart McCulloch | bb01437 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 1 | package aQute.bnd.compatibility; |
| 2 | |
| 3 | public class GenericParameter { |
Stuart McCulloch | 2286f23 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 4 | String name; |
| 5 | GenericType bounds[]; |
| 6 | |
Stuart McCulloch | bb01437 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 7 | public GenericParameter(String name, GenericType[] bounds) { |
| 8 | this.name = name; |
| 9 | this.bounds = bounds; |
| 10 | if (bounds == null || bounds.length == 0) |
Stuart McCulloch | 2286f23 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 11 | this.bounds = new GenericType[] { |
| 12 | new GenericType(Object.class) |
| 13 | }; |
Stuart McCulloch | bb01437 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 14 | } |
| 15 | |
Stuart McCulloch | 55d4dfe | 2012-08-07 10:57:21 +0000 | [diff] [blame] | 16 | @Override |
Stuart McCulloch | bb01437 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 17 | public String toString() { |
| 18 | StringBuilder sb = new StringBuilder(); |
| 19 | sb.append(name); |
Stuart McCulloch | 2286f23 | 2012-06-15 13:27:53 +0000 | [diff] [blame] | 20 | if (bounds != null && bounds.length > 0) { |
| 21 | for (GenericType gtype : bounds) { |
| 22 | sb.append(":"); |
Stuart McCulloch | bb01437 | 2012-06-07 21:57:32 +0000 | [diff] [blame] | 23 | sb.append(gtype); |
| 24 | } |
| 25 | } |
| 26 | return sb.toString(); |
| 27 | } |
| 28 | } |