Browse Source

Consistent javadoc for ParseState and its entry classes

pull/25798/head
Juergen Hoeller 5 years ago
parent
commit
a8b295c516
  1. 7
      spring-aop/src/main/java/org/springframework/aop/config/AdviceEntry.java
  2. 5
      spring-aop/src/main/java/org/springframework/aop/config/AdvisorEntry.java
  3. 5
      spring-aop/src/main/java/org/springframework/aop/config/AspectEntry.java
  4. 6
      spring-aop/src/main/java/org/springframework/aop/config/PointcutEntry.java
  5. 7
      spring-beans/src/main/java/org/springframework/beans/factory/parsing/BeanEntry.java
  6. 20
      spring-beans/src/main/java/org/springframework/beans/factory/parsing/ParseState.java
  7. 8
      spring-beans/src/main/java/org/springframework/beans/factory/parsing/PropertyEntry.java
  8. 11
      spring-beans/src/main/java/org/springframework/beans/factory/parsing/QualifierEntry.java

7
spring-aop/src/main/java/org/springframework/aop/config/AdviceEntry.java

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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. * Create a new {@code AdviceEntry} instance.
* @param kind the kind of advice represented by this entry (before, after, around, etc.) * @param kind the kind of advice represented by this entry (before, after, around)
*/ */
public AdviceEntry(String kind) { public AdviceEntry(String kind) {
this.kind = kind; this.kind = kind;
} }
@Override @Override
public String toString() { public String toString() {
return "Advice (" + this.kind + ")"; return "Advice (" + this.kind + ")";

5
spring-aop/src/main/java/org/springframework/aop/config/AdvisorEntry.java

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * @param name the bean name of the advisor
*/ */
public AdvisorEntry(String name) { public AdvisorEntry(String name) {
this.name = name; this.name = name;
} }
@Override @Override
public String toString() { public String toString() {
return "Advisor '" + this.name + "'"; return "Advisor '" + this.name + "'";

5
spring-aop/src/main/java/org/springframework/aop/config/AspectEntry.java

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 id the id of the aspect element
* @param ref the bean name referenced by this 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; this.ref = ref;
} }
@Override @Override
public String toString() { public String toString() {
return "Aspect: " + (StringUtils.hasLength(this.id) ? "id='" + this.id + "'" : "ref='" + this.ref + "'"); return "Aspect: " + (StringUtils.hasLength(this.id) ? "id='" + this.id + "'" : "ref='" + this.ref + "'");

6
spring-aop/src/main/java/org/springframework/aop/config/PointcutEntry.java

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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; 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 * @param name the bean name of the pointcut
*/ */
public PointcutEntry(String name) { public PointcutEntry(String name) {
this.name = name; this.name = name;
} }
@Override @Override
public String toString() { public String toString() {
return "Pointcut '" + this.name + "'"; return "Pointcut '" + this.name + "'";

7
spring-beans/src/main/java/org/springframework/beans/factory/parsing/BeanEntry.java

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 { 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 * @param beanDefinitionName the name of the associated bean definition
*/ */
public BeanEntry(String beanDefinitionName) { public BeanEntry(String beanDefinitionName) {
this.beanDefinitionName = beanDefinitionName; this.beanDefinitionName = beanDefinitionName;
} }
@Override @Override
public String toString() { public String toString() {
return "Bean '" + this.beanDefinitionName + "'"; return "Bean '" + this.beanDefinitionName + "'";

20
spring-beans/src/main/java/org/springframework/beans/factory/parsing/ParseState.java

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

8
spring-beans/src/main/java/org/springframework/beans/factory/parsing/PropertyEntry.java

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * @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) { public PropertyEntry(String name) {
if (!StringUtils.hasText(name)) { if (!StringUtils.hasText(name)) {
throw new IllegalArgumentException("Invalid property name '" + name + "'."); throw new IllegalArgumentException("Invalid property name '" + name + "'");
} }
this.name = name; this.name = name;
} }

11
spring-beans/src/main/java/org/springframework/beans/factory/parsing/QualifierEntry.java

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 { 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) { public QualifierEntry(String typeName) {
if (!StringUtils.hasText(typeName)) { if (!StringUtils.hasText(typeName)) {
throw new IllegalArgumentException("Invalid qualifier type '" + typeName + "'."); throw new IllegalArgumentException("Invalid qualifier type '" + typeName + "'");
} }
this.typeName = typeName; this.typeName = typeName;
} }
@Override @Override
public String toString() { public String toString() {
return "Qualifier '" + this.typeName + "'"; return "Qualifier '" + this.typeName + "'";

Loading…
Cancel
Save