From 47b1a28bbab80dd1a68dc0285d83a1c967b9cb55 Mon Sep 17 00:00:00 2001
From: Pascal Essiembre {@literal @}valid
. That
* configuration class will be populated without the need for "configuration"
* wrapper elements (automatically adds {@literal @}JsonUnwrapped
- * This behavior can be turned off with {@link #configurableDetectionDisabled}
+ * This behavior can be turned off with
+ * {@link BeanMapperBuilder#configurableDetectionDisabled(boolean)}
*
null
and a pair of tags witn
* no content is treated as empty.
diff --git a/src/main/java/com/norconex/commons/lang/config/ConfigurationLoader.java b/src/main/java/com/norconex/commons/lang/config/ConfigurationLoader.java
index 3b482235..6acbc48e 100644
--- a/src/main/java/com/norconex/commons/lang/config/ConfigurationLoader.java
+++ b/src/main/java/com/norconex/commons/lang/config/ConfigurationLoader.java
@@ -14,7 +14,6 @@
*/
package com.norconex.commons.lang.config;
-import java.io.IOException;
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
@@ -332,11 +331,9 @@ public XML toXml(
* @param type class of the object to create and populate
* @param null
).
- * @param name the event name
- * @return event name
+ * The event name (never null
).
*/
- @SuppressWarnings("javadoc")
@NonNull
private final String name;
/**
- * Gets a message describing the event or giving precision,
+ * A message describing the event or giving precision,
* or null
if the event has no message.
- * @param message the event message
- * @return event message
*/
- @SuppressWarnings("javadoc")
private final String message;
/**
- * Gets the exception associated with this event, or null
.
- * @param exception an exception
- * @return event message
+ * The exception associated with this event, or null
.
*/
- @SuppressWarnings("javadoc")
private final transient Throwable exception;
/**
diff --git a/src/main/java/com/norconex/commons/lang/flow/FlowMapperConfig.java b/src/main/java/com/norconex/commons/lang/flow/FlowMapperConfig.java
index b2a0246a..883ba323 100644
--- a/src/main/java/com/norconex/commons/lang/flow/FlowMapperConfig.java
+++ b/src/main/java/com/norconex/commons/lang/flow/FlowMapperConfig.java
@@ -28,12 +28,10 @@ public class FlowMapperConfig {
private final FlowPolymorphicTypenull
, the default is
* "consumer".
- * @param consumerNameProvider name provider
- * @return consumer name
*/
- @SuppressWarnings("javadoc")
private Function* Convenience class for implementation requiring proxy settings. *
- * - * {@nx.include com.norconex.commons.lang.security.Credentials#doc} - * - * {@nx.xml.usage - *The above can be found under any parent tag. See consuming class - * documentation for exact usage.
- * * @since 1.14.0 */ -@SuppressWarnings("javadoc") -@ToString -@EqualsAndHashCode -@FieldNameConstants(level = AccessLevel.PRIVATE) @Slf4j @JsonAutoDetect( fieldVisibility = Visibility.ANY, getterVisibility = Visibility.NONE, isGetterVisibility = Visibility.NONE ) +@Data +@Accessors(chain = true) public class ProxySettings implements Serializable { private static final long serialVersionUID = 1L; + /** Proxy host (name and port), ornull
when not set. */
private Host host;
+ /**
+ * Proxy scheme (default is "http").
+ * @since 2.0.0
+ */
private String scheme;
+ /**
+ * Proxy credentials, when required or applicable. Never null
.
+ * @since 2.0.0
+ */
private final Credentials credentials = new Credentials();
+ /**
+ * Proxy authentication realm, when required or applicable.
+ * @since 2.0.0
+ */
private String realm;
public ProxySettings() {
@@ -82,54 +75,6 @@ public ProxySettings(Host host) {
this.host = host;
}
- /**
- * Gets the proxy host.
- * @return proxy host or null
if not set
- * @see #isSet()
- */
- public Host getHost() {
- return host;
- }
-
- /**
- * Sets the proxy host.
- * @param host proxy host
- * @return this
- */
- public ProxySettings setHost(Host host) {
- this.host = host;
- return this;
- }
-
- /**
- * Gets the proxy scheme.
- * @return proxy scheme
- * @since 2.0.0
- */
- public String getScheme() {
- return scheme;
- }
-
- /**
- * Sets the proxy scheme.
- * @param scheme proxy scheme
- * @return this
- * @since 2.0.0
- */
- public ProxySettings setScheme(String scheme) {
- this.scheme = scheme;
- return this;
- }
-
- /**
- * Gets the proxy credentials.
- * @return proxy credentials (never null
)
- * @since 2.0.0
- */
- public Credentials getCredentials() {
- return credentials;
- }
-
/**
* Sets the proxy credentials.
* @param credentials proxy credentials
@@ -142,33 +87,27 @@ public ProxySettings setCredentials(Credentials credentials) {
}
/**
- * Gets the proxy realm.
- * @return proxy realm
- * @since 2.0.0
+ * Wether this proxy is configured. That is, if the host is not
+ * null
and also configured.
+ * @return true
if set
+ * @see Host#isSet()
*/
- public String getRealm() {
- return realm;
- }
-
- /**
- * Sets the proxy realm.
- * @param realm proxy realm
- * @return this
- * @since 2.0.0
- */
- public ProxySettings setRealm(String realm) {
- this.realm = realm;
- return this;
- }
-
public boolean isSet() {
return host != null && host.isSet();
}
+ /**
+ * Copy properties of this instance to the supplied instance.
+ * @param another another proxy settings instance
+ */
public void copyTo(ProxySettings another) {
BeanUtil.copyProperties(another, this);
}
+ /**
+ * Copy properties of the supplied instance to this instance.
+ * @param another another proxy settings instance
+ */
public void copyFrom(ProxySettings another) {
BeanUtil.copyProperties(this, another);
}
diff --git a/src/main/java/com/norconex/commons/lang/security/Credentials.java b/src/main/java/com/norconex/commons/lang/security/Credentials.java
index 63db13fd..0c92f2b4 100644
--- a/src/main/java/com/norconex/commons/lang/security/Credentials.java
+++ b/src/main/java/com/norconex/commons/lang/security/Credentials.java
@@ -73,39 +73,10 @@
*
* }
*
- * {@nx.xml.usage
- * - * The expected parent tag name is defined by the consuming classes. - *
- * - * {@nx.xml.example - *- * The above example has the password encrypted with a key. The encryption - * key is stored in a file (required to decrypt the password). - *
- * * @since 2.0.0 * @see EncryptionKey * @see EncryptionUtil */ -@SuppressWarnings("javadoc") @FieldNameConstants(level = AccessLevel.PRIVATE) @Data @Accessors(chain = true) @@ -120,21 +91,15 @@ public class Credentials implements Serializable { /** * Credential user name. - * @param username user name - * @return {@code this}. */ private String username; /** * Credential password. - * @param password password - * @return {@code this}. */ private String password; /** * Credential password encryption key pointer (provided the password is * encrypted). - * @param passwordKey password key - * @return {@code this}. */ private EncryptionKey passwordKey; @@ -175,6 +140,11 @@ public Credentials(Credentials copy) { copyFrom(copy); } + /** + * Whether this credentials instance is set. That is, if any of + * user name and password is not blank. + * @returntrue
if set
+ */
public boolean isSet() {
return !isEmpty();
}
diff --git a/src/main/java/com/norconex/commons/lang/text/Regex.java b/src/main/java/com/norconex/commons/lang/text/Regex.java
index adf7a92b..0d5f34ea 100644
--- a/src/main/java/com/norconex/commons/lang/text/Regex.java
+++ b/src/main/java/com/norconex/commons/lang/text/Regex.java
@@ -52,37 +52,6 @@
* behaves as if the value is an empty string.
*
*
- * {@nx.xml.usage #attributes
- * ignoreCase="[false|true]"
- * ignoreDiacritic="[false|true]"
- * dotAll="[false|true]"
- * unixLines="[false|true]"
- * literal="[false|true]"
- * comments="[false|true]"
- * multiline="[false|true]"
- * canonEq="[false|true]"
- * unicodeCase="[false|true]"
- * unicodeCharacterClass="[false|true]"
- * trim="[false|true]"
- * matchEmpty="[false|true]"
- * }
- * - * The above are configurable attributes consuming classes can expect. - * The actual regular expression is expected to be the tag content. - * Many of the available attributes on XML configuration represent the - * regular expression flags as defined in {@link Pattern}. - *
- * - * {@nx.xml.example - *- * The above will match any text that starts with "start" and ends with "ends", - * regardless if there are new line characters in between. - *
- * * @since 2.0.0 * @see Pattern */ @@ -352,7 +321,7 @@ public String getPattern() { * ** For text-matching with diacritical mark insensitivity support enabled, - * or for {@link #trim} and {@link #matchEmpty} support, + * or for {@link #trim()} and {@link #matchEmpty()} support, * use {@link #matcher(CharSequence)} instead. *
* @return compiled pattern @@ -368,7 +337,7 @@ public Pattern compile() { * ** For text-matching with diacritical mark insensitivity support enabled, - * or for {@link #trim} and {@link #matchEmpty} support, + * or for {@link #trim()} and {@link #matchEmpty()} support, * use {@link #matcher(String, CharSequence)} instead. *
* @param pattern the pattern to compile diff --git a/src/main/java/com/norconex/commons/lang/text/RegexFieldValueExtractor.java b/src/main/java/com/norconex/commons/lang/text/RegexFieldValueExtractor.java index 7d56658e..ed4890b6 100644 --- a/src/main/java/com/norconex/commons/lang/text/RegexFieldValueExtractor.java +++ b/src/main/java/com/norconex/commons/lang/text/RegexFieldValueExtractor.java @@ -19,7 +19,6 @@ import java.util.Map.Entry; import java.util.Objects; import java.util.regex.Matcher; -import java.util.regex.Pattern; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.StringUtils; @@ -53,31 +52,6 @@ * case insensitivity and dots matching any character. * * - * {@nx.xml.usage #attributes - * toField="(toField name)" - * fieldGroup="(toField name match group index)" - * valueGroup="(value match group index)" - * {@nx.include com.norconex.commons.lang.map.PropertySetter#attributes} - * {@nx.include com.norconex.commons.lang.text.Regex#attributes} - * } - * - *- * The above are configurable attributes consuming classes can expect. - * The actual regular expression is expected to be the tag content. - * Many of the available attributes on XML configuration represent the - * regular expression flags as defined in {@link Pattern}. - *
- * - * {@nx.xml.example - *- * The above is configured to extract "DocNo" as the toField, and the following - * numeric characters will make up the value. - *
- * * @since 2.0.0 (moved from Norconex Importer RegexKeyValueExtractor) */ @SuppressWarnings("javadoc") diff --git a/src/main/java/com/norconex/commons/lang/text/StringUtil.java b/src/main/java/com/norconex/commons/lang/text/StringUtil.java index 86f5c74a..2c8b80ff 100644 --- a/src/main/java/com/norconex/commons/lang/text/StringUtil.java +++ b/src/main/java/com/norconex/commons/lang/text/StringUtil.java @@ -379,6 +379,7 @@ public static String singular(String plural) { * singular variant. You are encouraged to used a more sophisticated * approach if accuracy is important. * @param plural plural word + * @param defaultValue default value if singular can't be resolved * @return singular word ornull
* @since 3.0.0
*/
diff --git a/src/main/java/com/norconex/commons/lang/text/TextMatcher.java b/src/main/java/com/norconex/commons/lang/text/TextMatcher.java
index b15ffa89..b5ea8697 100644
--- a/src/main/java/com/norconex/commons/lang/text/TextMatcher.java
+++ b/src/main/java/com/norconex/commons/lang/text/TextMatcher.java
@@ -74,44 +74,6 @@
* {@link #replace(String, String)}.
*
*
- * {@nx.xml.usage #attributes
- * method="[basic|csv|wildcard|regex]"
- * ignoreCase="[false|true]"
- * ignoreDiacritic="[false|true]"
- * replaceAll="[false|true]"
- * partial="[false|true]"
- * trim="[false|true]"
- * matchEmpty="[false|true]"
- * }
- *
- * - * The above are configurable attributes consuming classes can expect. - * The actual expression is expected to be the tag content. - *
- * - *- * When simply matching (no replacements) the attributes are the same, - * minus the "replaceAll" (which is simply ignored): - *
- * {@nx.xml #matchAttributes - * method="[basic|csv|wildcard|regex]" - * ignoreCase="[false|true]" - * ignoreDiacritic="[false|true]" - * partial="[false|true]" - * trim="[false|true]" - * matchEmpty="[false|true]" - * } - * - * {@nx.xml.example - *- * Given a text of "It seems Paul and Marc are friends" and a replacement of - * "they", the above will result in "It seems they are friends.". - *
- * * @since 2.0.0 */ @ToString @@ -356,7 +318,7 @@ public boolean isNegateMatches() { * Sets whether to negates the result of invoking * {@link #matches(CharSequence)}. * Note: only applies to the {@link #matches(CharSequence)} method. - * @parm negateMatchestrue
to negate matches
+ * @param negateMatches true
to negate matches
* @return this
* @since 3.0.0
*/
@@ -382,6 +344,7 @@ public TextMatcher negateMatches() {
* Sets whether to negates the result of invoking
* {@link #matches(CharSequence)} on a copy of this instance.
* Note: only applies to the {@link #matches(CharSequence)} method.
+ * @param negateMatches true
to negate matches
* @return this
* @since 3.0.0
*/
diff --git a/src/main/java/com/norconex/commons/lang/version/SemanticVersion.java b/src/main/java/com/norconex/commons/lang/version/SemanticVersion.java
index de694b76..adaca742 100644
--- a/src/main/java/com/norconex/commons/lang/version/SemanticVersion.java
+++ b/src/main/java/com/norconex/commons/lang/version/SemanticVersion.java
@@ -20,7 +20,6 @@
import java.util.Comparator;
import java.util.Objects;
import java.util.function.Predicate;
-import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Stream;
@@ -97,38 +96,23 @@ static PreRelease of(String preRelease) {
/**
* Major version number. The first number of a semantic version.
- * @param major major number
- * @return {@code this}.
*/
- @SuppressWarnings("javadoc")
private final int major;
/**
* Minor version number. The second number of a semantic version.
- * @param minor minor number
- * @return {@code this}.
*/
- @SuppressWarnings("javadoc")
private final int minor;
/**
* Patch version number. The third number of a semantic version.
- * @param patch patch number
- * @return {@code this}.
*/
- @SuppressWarnings("javadoc")
private final int patch;
/**
* Optional pre-release indicator (M1, RC1, etc.).
- * @param preRelease pre-release indicator
- * @return {@code this}.
*/
- @SuppressWarnings("javadoc")
private final String preRelease;
/**
* Optional metadata associated with a build.
- * @param buildMetadata build metadata
- * @return {@code this}.
*/
- @SuppressWarnings("javadoc")
private final String buildMetadata;
/**
@@ -209,7 +193,7 @@ public int compareTo(SemanticVersion o) {
}
// Compare major.minor.patch
- int result = new CompareToBuilder()
+ var result = new CompareToBuilder()
.append(major, o.major)
.append(minor, o.minor)
.append(patch, o.patch)
@@ -219,8 +203,8 @@ public int compareTo(SemanticVersion o) {
}
// Compare pre-release
- String thisPrTxt = lowerCase(trimToNull(preRelease));
- String thatPrTxt = lowerCase(trimToNull(o.preRelease));
+ var thisPrTxt = lowerCase(trimToNull(preRelease));
+ var thatPrTxt = lowerCase(trimToNull(o.preRelease));
if (Objects.equals(thisPrTxt, thatPrTxt)) {
return 0;
@@ -231,16 +215,16 @@ public int compareTo(SemanticVersion o) {
}
// both pre-releases can't be null at this point
- PreRelease thisPr = PreRelease.of(thisPrTxt);
- PreRelease thatPr = PreRelease.of(thatPrTxt);
+ var thisPr = PreRelease.of(thisPrTxt);
+ var thatPr = PreRelease.of(thatPrTxt);
result = Integer.compare(thisPr.weight, thatPr.weight);
if (result != 0) {
return result;
}
// extract numerical values (if any) and compare them.
- Matcher thisMatcher = numberPattern.matcher(thisPrTxt);
- Matcher thatMatcher = numberPattern.matcher(thatPrTxt);
+ var thisMatcher = numberPattern.matcher(thisPrTxt);
+ var thatMatcher = numberPattern.matcher(thatPrTxt);
while (thisMatcher.find()) {
// if this matcher has more numbers, it is higher
if (!thatMatcher.find()) {
@@ -316,7 +300,7 @@ public boolean isLowerOrEquivalentTo(SemanticVersion other) {
*/
@Override
public String toString() {
- StringBuilder b = new StringBuilder()
+ var b = new StringBuilder()
.append(major).append('.')
.append(minor).append('.')
.append(patch);
diff --git a/src/main/java/com/norconex/commons/lang/version/SemanticVersionParser.java b/src/main/java/com/norconex/commons/lang/version/SemanticVersionParser.java
index f45292b8..3a7f1942 100644
--- a/src/main/java/com/norconex/commons/lang/version/SemanticVersionParser.java
+++ b/src/main/java/com/norconex/commons/lang/version/SemanticVersionParser.java
@@ -17,7 +17,6 @@
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
-import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.lang3.StringUtils;
@@ -37,9 +36,10 @@
*
* The maximum string length supported by this parser is 255 characters.
* Longer strings will throw a {@link SemanticVersionParserException}
- * except when {@link #ignoreLeadingCharacters} is true
. In such
- * case, it will try parsing longer strings, but will only
- * consider the last 255 characters.
+ * except when
+ * {@link SemanticVersionParserBuilder#ignoreLeadingCharacters(boolean)} is
+ * true
. In such case, it will try parsing longer strings, but
+ * will only consider the last 255 characters.
*
1.2
is interpreted as 1.2.0
3
is interpreted as 3.0.0
true
if minor and patch
- * numbers are optional
- * @return {@code this}.
*/
- @SuppressWarnings("javadoc")
private final boolean optionalMinorAndPatch;
/**
* @@ -123,11 +119,7 @@ public class SemanticVersionParser { *
1.2.3RC1
is interpreted as 1.2.3-RC1
1.2.3_M3
is interpreted as 1.2.3-M3
true
if pre-release prefix
- * presence is optional
- * @return {@code this}.
*/
- @SuppressWarnings("javadoc")
private final boolean optionalPreReleasePrefix;
/**
* @@ -139,11 +131,7 @@ public class SemanticVersionParser { *
v1.2.3
is interpreted as 1.2.3
some-library-1.2.3
is interpreted as 1.2.3
true
if ignoring leading
- * characters
- * @return {@code this}.
*/
- @SuppressWarnings("javadoc")
private final boolean ignoreLeadingCharacters;
/**
* @@ -155,10 +143,7 @@ public class SemanticVersionParser { *
1.2.3.jar
is interpreted as 1.2.3