2 * JavaInspect - Utility to visualize java software
3 * Copyright (C) 2013-2015, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of version 3 of the GNU Lesser General Public License
7 * or later as published by the Free Software Foundation.
10 package eu.svjatoslav.inspector.java.methods;
12 import eu.svjatoslav.commons.string.tokenizer.InvalidSyntaxException;
13 import eu.svjatoslav.commons.string.tokenizer.Tokenizer;
15 import java.util.ArrayList;
16 import java.util.List;
18 public class ClassReference {
22 List<ClassReference> typeParameters = new ArrayList<ClassReference>();
24 public ClassReference(final Tokenizer tokenizer)
25 throws InvalidSyntaxException {
26 name = tokenizer.getNextToken().token;
28 if (!tokenizer.probeNextToken("<"))
32 final ClassReference parameterType = new ClassReference(tokenizer);
33 typeParameters.add(parameterType);
35 if (!tokenizer.probeNextToken(","))
39 tokenizer.expectNextToken(">");
43 public String toString() {
44 final EnumerationBuffer result = new EnumerationBuffer();
48 if (typeParameters.size() > 0) {
50 for (final ClassReference classReference : typeParameters)
51 result.appendEnumeration(classReference.toString());
55 return result.toString();