public void setDefinition(String definition) {
	  // JavaMetadata will extract all modifiers for us
		JavaMetadata metadata = new JavaMetadata(definition);
		modifier = metadata.getModifier();
		definition = metadata.getClassName();

		context.getImports().addImports(metadata.getImports());

		// Add any generics extracted
		if (metadata.hasGenerics()){
			generics.clear();
			String[] generic = metadata.getGenerics();
			for (String s : generic)
				generics.add(s);
		}

		// Add the return type
		int ind = definition.indexOf(' ');
		returnType = definition.substring(0, ind);
		definition = definition.substring(ind+1);
		ind = returnType.lastIndexOf('.');
		if (ind > 0) {
		  context.getImports().addImport(returnType);
		  returnType = returnType.substring(ind+1);
		}

		// Resolve parameters; reducing fqcn to import statements
		ind = definition.indexOf('(');
		assert ind > 0;
		methodName = definition.substring(0, ind);
		definition = definition.substring(ind+1, definition.lastIndexOf(')'));
		for (String param : definition.split(",")) {
		  param = param.trim();
		  ind = param.lastIndexOf('.');
		  if (ind > 0) {
		    context.getImports().addImport(param.substring(0, param.indexOf(' ')));
		    param = param.substring(ind+1);
		  }
		  parameters.add(param);
		}

		if (methodName.contains(" "))
		  throw new CompilationFailed("Found ambiguous method definition in "+definition);
		if (methodName.length() == 0)
			throw new CompilationFailed("Did not have a class name in class definition "+definition);
	}