Paste: Random java snippet

Author: Crest
Mode: java
Date: Sat, 11 Sep 2010 14:57:37
Plain Text |
	@Override
	public String toString() {
		StringWriter w = new StringWriter();
		PrintWriter  p = new PrintWriter(w);
		
		p.println("@" + type + "{\t" + key + ",");
		for ( Entry<String, List<CommonValue>> entry : attributes.entrySet() ) {
			for ( CommonValue value : entry.getValue() ) {
				p.println("\t" + entry.getKey() + " = " + format(value) + "," );
			}
		}
		p.println("}");
		return w.toString();
	}

	private String format(CommonValue value) {
		if (value instanceof IntegerValue)
			return value.toString();
		else
			return "{" + value + "}";
	}

New Annotation

Summary:
Author:
Mode:
Body: