001/*
002 * Copyright 2002-2020 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.aop.config;
018
019import org.springframework.beans.factory.parsing.ParseState;
020import org.springframework.util.StringUtils;
021
022/**
023 * {@link ParseState} entry representing an aspect.
024 *
025 * @author Mark Fisher
026 * @author Juergen Hoeller
027 * @since 2.0
028 */
029public class AspectEntry implements ParseState.Entry {
030
031        private final String id;
032
033        private final String ref;
034
035
036        /**
037         * Create a new {@code AspectEntry} instance.
038         * @param id the id of the aspect element
039         * @param ref the bean name referenced by this aspect element
040         */
041        public AspectEntry(String id, String ref) {
042                this.id = id;
043                this.ref = ref;
044        }
045
046
047        @Override
048        public String toString() {
049                return "Aspect: " + (StringUtils.hasLength(this.id) ? "id='" + this.id + "'" : "ref='" + this.ref + "'");
050        }
051
052}