001/*
002 * Copyright 2002-2018 the original author or authors.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *      https://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package org.springframework.beans.factory.support;
018
019import org.springframework.lang.Nullable;
020import org.springframework.util.Assert;
021
022/**
023 * Tag collection class used to hold managed array elements, which may
024 * include runtime bean references (to be resolved into bean objects).
025 *
026 * @author Juergen Hoeller
027 * @since 3.0
028 */
029@SuppressWarnings("serial")
030public class ManagedArray extends ManagedList<Object> {
031
032        /** Resolved element type for runtime creation of the target array. */
033        @Nullable
034        volatile Class<?> resolvedElementType;
035
036
037        /**
038         * Create a new managed array placeholder.
039         * @param elementTypeName the target element type as a class name
040         * @param size the size of the array
041         */
042        public ManagedArray(String elementTypeName, int size) {
043                super(size);
044                Assert.notNull(elementTypeName, "elementTypeName must not be null");
045                setElementTypeName(elementTypeName);
046        }
047
048}