Consistent javadoc for ParseState and its entry classes

This commit is contained in:
Juergen Hoeller 2020-08-27 14:37:42 +02:00
parent cf2e0c7959
commit a8b295c516
8 changed files with 35 additions and 34 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2020 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.
@ -30,13 +30,14 @@ public class AdviceEntry implements ParseState.Entry {
/**
* Creates a new instance of the {@link AdviceEntry} class.
* @param kind the kind of advice represented by this entry (before, after, around, etc.)
* Create a new {@code AdviceEntry} instance.
* @param kind the kind of advice represented by this entry (before, after, around)
*/
public AdviceEntry(String kind) {
this.kind = kind;
}
@Override
public String toString() {
return "Advice (" + this.kind + ")";

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2020 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.
@ -30,13 +30,14 @@ public class AdvisorEntry implements ParseState.Entry {
/**
* Creates a new instance of the {@link AdvisorEntry} class.
* Create a new {@code AdvisorEntry} instance.
* @param name the bean name of the advisor
*/
public AdvisorEntry(String name) {
this.name = name;
}
@Override
public String toString() {
return "Advisor '" + this.name + "'";

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2020 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.
@ -34,7 +34,7 @@ public class AspectEntry implements ParseState.Entry {
/**
* Create a new AspectEntry.
* Create a new {@code AspectEntry} instance.
* @param id the id of the aspect element
* @param ref the bean name referenced by this aspect element
*/
@ -43,6 +43,7 @@ public class AspectEntry implements ParseState.Entry {
this.ref = ref;
}
@Override
public String toString() {
return "Aspect: " + (StringUtils.hasLength(this.id) ? "id='" + this.id + "'" : "ref='" + this.ref + "'");

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2020 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.
@ -28,14 +28,16 @@ public class PointcutEntry implements ParseState.Entry {
private final String name;
/**
* Creates a new instance of the {@link PointcutEntry} class.
* Create a new {@code PointcutEntry} instance.
* @param name the bean name of the pointcut
*/
public PointcutEntry(String name) {
this.name = name;
}
@Override
public String toString() {
return "Pointcut '" + this.name + "'";

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2006 the original author or authors.
* Copyright 2002-2020 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.
@ -24,18 +24,17 @@ package org.springframework.beans.factory.parsing;
*/
public class BeanEntry implements ParseState.Entry {
private String beanDefinitionName;
private final String beanDefinitionName;
/**
* Creates a new instance of {@link BeanEntry} class.
* Create a new {@code BeanEntry} instance.
* @param beanDefinitionName the name of the associated bean definition
*/
public BeanEntry(String beanDefinitionName) {
this.beanDefinitionName = beanDefinitionName;
}
@Override
public String toString() {
return "Bean '" + this.beanDefinitionName + "'";

View File

@ -22,12 +22,11 @@ import org.springframework.lang.Nullable;
/**
* Simple {@link ArrayDeque}-based structure for tracking the logical position during
* a parsing process. {@link Entry entries} are added to the LinkedList at
* each point during the parse phase in a reader-specific manner.
* a parsing process. {@link Entry entries} are added to the ArrayDeque at each point
* during the parse phase in a reader-specific manner.
*
* <p>Calling {@link #toString()} will render a tree-style view of the current logical
* position in the parse phase. This representation is intended for use in
* error messages.
* position in the parse phase. This representation is intended for use in error messages.
*
* @author Rob Harrop
* @author Juergen Hoeller
@ -35,11 +34,6 @@ import org.springframework.lang.Nullable;
*/
public final class ParseState {
/**
* Tab character used when rendering the tree-style representation.
*/
private static final char TAB = '\t';
/**
* Internal {@link ArrayDeque} storage.
*/
@ -54,8 +48,8 @@ public final class ParseState {
}
/**
* Create a new {@code ParseState} whose {@link ArrayDeque} is a {@link Object#clone clone}
* of that of the passed in {@code ParseState}.
* Create a new {@code ParseState} whose {@link ArrayDeque} is a clone
* of the state in the passed-in {@code ParseState}.
*/
private ParseState(ParseState other) {
this.state = other.state.clone();
@ -99,13 +93,13 @@ public final class ParseState {
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
StringBuilder sb = new StringBuilder(64);
int i = 0;
for (ParseState.Entry entry : this.state) {
if (i > 0) {
sb.append('\n');
for (int j = 0; j < i; j++) {
sb.append(TAB);
sb.append('\t');
}
sb.append("-> ");
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2020 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.
@ -30,14 +30,12 @@ public class PropertyEntry implements ParseState.Entry {
/**
* Creates a new instance of the {@link PropertyEntry} class.
* Create a new {@code PropertyEntry} instance.
* @param name the name of the JavaBean property represented by this instance
* @throws IllegalArgumentException if the supplied {@code name} is {@code null}
* or consists wholly of whitespace
*/
public PropertyEntry(String name) {
if (!StringUtils.hasText(name)) {
throw new IllegalArgumentException("Invalid property name '" + name + "'.");
throw new IllegalArgumentException("Invalid property name '" + name + "'");
}
this.name = name;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2020 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.
@ -26,16 +26,21 @@ import org.springframework.util.StringUtils;
*/
public class QualifierEntry implements ParseState.Entry {
private String typeName;
private final String typeName;
/**
* Create a new {@code QualifierEntry} instance.
* @param typeName the name of the qualifier type
*/
public QualifierEntry(String typeName) {
if (!StringUtils.hasText(typeName)) {
throw new IllegalArgumentException("Invalid qualifier type '" + typeName + "'.");
throw new IllegalArgumentException("Invalid qualifier type '" + typeName + "'");
}
this.typeName = typeName;
}
@Override
public String toString() {
return "Qualifier '" + this.typeName + "'";