CPD Results

The following document contains the results of PMD's CPD 3.9.

Duplications

FileLine
net\sourceforge\sannotations\scopes\ConversationScope.java36
net\sourceforge\sannotations\scopes\FlashScope.java35
	private final String	SCOPE_KEY	= FlashScope.class.getName() + ".SCOPEDMAP";
	//TODO document
	@SuppressWarnings("unchecked")
	private HashMap<String, Object> getScopedValues() {
		HashMap<String, Object> scopedObj = (HashMap<String, Object>) RequestContextHolder.currentRequestAttributes().getAttribute(this.SCOPE_KEY, RequestAttributes.SCOPE_SESSION);
		if (scopedObj == null) {
			scopedObj = new HashMap<String, Object>();
			RequestContextHolder.currentRequestAttributes().setAttribute(this.SCOPE_KEY, scopedObj, RequestAttributes.SCOPE_SESSION);
		}
		return scopedObj;
	}
	//TODO document
	public Object get(final String name, final ObjectFactory objectFactory) {
		Object scopedObject = this.getScopedValues().get(name);
		if ((scopedObject == null) && (objectFactory != null)) {
			scopedObject = objectFactory.getObject();
			this.getScopedValues().put(name, scopedObject);
		}
		return scopedObject;
	}
	//TODO document
	public Object remove(final String name) {
		final Object scopedObject = this.getScopedValues().get(name);
		if (scopedObject != null) {
			this.getScopedValues().remove(name);
			return scopedObject;
		}
		return null;
	}
	//TODO document
	public void clearScope() {
		this.getScopedValues().clear();
	}
	//TODO document
	public void set(String name, Object value) {
		this.getScopedValues().put(name, value);
	}
	//TODO document
	public String getConversationId() {
		return "flash";