From c33349408599c34f5a0786070ffd4f4cb4fd58f1 Mon Sep 17 00:00:00 2001 From: Keith Donald Date: Wed, 7 Oct 2009 17:02:22 +0000 Subject: [PATCH] javadoc --- .../mapping/support/MappingContextHolder.java | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/org.springframework.context/src/main/java/org/springframework/mapping/support/MappingContextHolder.java b/org.springframework.context/src/main/java/org/springframework/mapping/support/MappingContextHolder.java index 45915fed5e1..fbb3bc407da 100644 --- a/org.springframework.context/src/main/java/org/springframework/mapping/support/MappingContextHolder.java +++ b/org.springframework.context/src/main/java/org/springframework/mapping/support/MappingContextHolder.java @@ -1,14 +1,37 @@ +/* + * Copyright 2002-2009 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.mapping.support; import java.util.Stack; import org.springframework.core.NamedThreadLocal; +/** + * Holds thread-specific context about a mapping operation + * @author Keith Donald + * @see SpelMapper#map(Object, Object) + */ class MappingContextHolder { private static final ThreadLocal> mappingContextHolder = new NamedThreadLocal>( "Mapping context"); + /** + * Push a source object being mapped onto the context. + */ public static void push(Object source) { Stack context = getContext(); if (context == null) { @@ -18,10 +41,16 @@ class MappingContextHolder { context.add(source); } + /** + * Is the source being mapped or has already been mapped? + */ public static boolean contains(Object source) { return getContext().contains(source); } + /** + * Pop the source object being mapped off the context; mapping is complete. + */ public static void pop() { Stack context = getContext(); if (context != null) { @@ -32,6 +61,9 @@ class MappingContextHolder { } } + /** + * Return a level of bullets for indenting mapping debug logs based on the depth in the object graph. + */ public static String getLevel() { int size = getContext().size(); StringBuilder builder = new StringBuilder();