Skip to content

Commit

Permalink
Removed some inline XML in javadoc.
Browse files Browse the repository at this point in the history
  • Loading branch information
essiembre committed Aug 29, 2024
1 parent 571bf50 commit 47b1a28
Show file tree
Hide file tree
Showing 18 changed files with 152 additions and 397 deletions.
4 changes: 2 additions & 2 deletions src/main/java/com/norconex/commons/lang/bean/BeanMapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@
* treated as if annotated with <code>{@literal @}valid</code>. That
* configuration class will be populated without the need for "configuration"
* wrapper elements (automatically adds <code>{@literal @}JsonUnwrapped</code>
* This behavior can be turned off with {@link #configurableDetectionDisabled}
* This behavior can be turned off with
* {@link BeanMapperBuilder#configurableDetectionDisabled(boolean)}
* </p>
* @since 3.0.0
*/
Expand Down Expand Up @@ -486,7 +487,6 @@ public ObjectMapper toObjectMapper(Format format) {
});
}

// @JsonIgnoreType // <-- messes up nested object deserializing since update of Jackson
abstract static class ConfigurableMixIn<T> {
@JsonUnwrapped
@Valid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
import com.fasterxml.jackson.dataformat.xml.util.DefaultXmlPrettyPrinter;

/**
* Version of {@link XmlFactory} that configures a {@link XmlPrettyPrinter}
* Version of {@link XmlFactory} that configures a
* {@link com.fasterxml.jackson.dataformat.xml.XmlPrettyPrinter}
* to write "empty" objects with a closing tag instead of self-closing.
* Self-closing are treated as <code>null</code> and a pair of tags witn
* no content is treated as empty.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -332,11 +331,9 @@ public XML toXml(
* @param type class of the object to create and populate
* @param <T> type of returned object
* @return new object
* @throws IOException
* @since 3.0.0
*/
public <T> T toObject(@NonNull Path configFile, Class<T> type)
throws IOException {
public <T> T toObject(@NonNull Path configFile, Class<T> type) {
return beanMapper.read(
type,
new StringReader(toString(configFile)),
Expand All @@ -356,11 +353,9 @@ public <T> T toObject(@NonNull Path configFile, Class<T> type)
* Loads an XML configuration file and populates a given object.
* @param configFile XML configuration file
* @param object object to populate
* @throws IOException
* @since 3.0.0
*/
public void toObject(@NonNull Path configFile, @NonNull Object object)
throws IOException {
public void toObject(@NonNull Path configFile, @NonNull Object object) {
beanMapper.read(
object,
new StringReader(toString(configFile)),
Expand Down
15 changes: 3 additions & 12 deletions src/main/java/com/norconex/commons/lang/event/Event.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,27 +39,18 @@ public class Event extends EventObjectAdapter {

private static final long serialVersionUID = 1L;
/**
* Gets the event name (never <code>null</code>).
* @param name the event name
* @return event name
* The event name (never <code>null</code>).
*/
@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 <code>null</code> 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 <code>null</code>.
* @param exception an exception
* @return event message
* The exception associated with this event, or <code>null</code>.
*/
@SuppressWarnings("javadoc")
private final transient Throwable exception;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,10 @@ public class FlowMapperConfig {
private final FlowPolymorphicType<FlowConsumerAdapter<?>> consumerType =
new FlowPolymorphicType<>();
/**
* Provide a custom name to be used when a consumer is being serialized.
* A function that takes a consumer about to be serialize and returns
* a custom name for it.
* When not specified or returning <code>null</code>, the default is
* "consumer".
* @param consumerNameProvider name provider
* @return consumer name
*/
@SuppressWarnings("javadoc")
private Function<Consumer<?>, String> consumerNameProvider;
}
6 changes: 0 additions & 6 deletions src/main/java/com/norconex/commons/lang/jar/JarCopier.java
Original file line number Diff line number Diff line change
Expand Up @@ -525,17 +525,11 @@ static TargetAction of(int option) {

/**
* Action to perform (or not) on source file.
* @param sourceAction source action
* @return {@code this}.
*/
@SuppressWarnings("javadoc")
private final SourceAction sourceAction;
/**
* Action to perform (or not) on target file.
* @param targetAction target action
* @return {@code this}.
*/
@SuppressWarnings("javadoc")
private final TargetAction targetAction;

public OnJarConflict() {
Expand Down
5 changes: 0 additions & 5 deletions src/main/java/com/norconex/commons/lang/net/Host.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@

/**
* Holds a host name and port.
*
* {@nx.xml.usage
* <name>(host name)</name>
* <port>(host port)</port>
* }
* @since 2.0.0
*/
@EqualsAndHashCode
Expand Down
119 changes: 29 additions & 90 deletions src/main/java/com/norconex/commons/lang/net/ProxySettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,51 +24,44 @@
import com.norconex.commons.lang.bean.BeanUtil;
import com.norconex.commons.lang.security.Credentials;

import lombok.AccessLevel;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import lombok.experimental.FieldNameConstants;
import lombok.Data;
import lombok.experimental.Accessors;
import lombok.extern.slf4j.Slf4j;

/**
* <p>
* Convenience class for implementation requiring proxy settings.
* </p>
*
* {@nx.include com.norconex.commons.lang.security.Credentials#doc}
*
* {@nx.xml.usage
* <host>
* {@nx.include [email protected]}
* </host>
* <scheme>(Default is "http")</scheme>
* <realm>(Authentication realm. Default is any.)</realm>
* <credentials>
* {@nx.include [email protected]}
* </credentials>
* }
* <p>The above can be found under any parent tag. See consuming class
* documentation for exact usage.</p>
*
* @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), or <code>null</code> 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 <code>null</code>.
* @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() {
Expand All @@ -82,54 +75,6 @@ public ProxySettings(Host host) {
this.host = host;
}

/**
* Gets the proxy host.
* @return proxy host or <code>null</code> 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 <code>null</code>)
* @since 2.0.0
*/
public Credentials getCredentials() {
return credentials;
}

/**
* Sets the proxy credentials.
* @param credentials proxy credentials
Expand All @@ -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
* <code>null</code> and also configured.
* @return <code>true</code> 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);
}
Expand Down
40 changes: 5 additions & 35 deletions src/main/java/com/norconex/commons/lang/security/Credentials.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,39 +73,10 @@
* </p>
* }
*
* {@nx.xml.usage
* <username>(the username)</username>
* <password>(the optionally encrypted password)</password>
* <passwordKey>
* <value>(The actual password encryption key or a reference to it.)</value>
* <source>[key|file|environment|property]</source>
* <size>(Size in bits of encryption key. Default is 128.)</size>
* </passwordKey>
* }
* <p>
* The expected parent tag name is defined by the consuming classes.
* </p>
*
* {@nx.xml.example
* <sampleConfig>
* <username>goldorak</username>
* <password>3ncryp73d</password>
* <passwordKey>
* <value>/path/to/my.key</value>
* <source>file</source>
* </passwordKey>
* </sampleConfig>
* }
* <p>
* The above example has the password encrypted with a key. The encryption
* key is stored in a file (required to decrypt the password).
* </p>
*
* @since 2.0.0
* @see EncryptionKey
* @see EncryptionUtil
*/
@SuppressWarnings("javadoc")
@FieldNameConstants(level = AccessLevel.PRIVATE)
@Data
@Accessors(chain = true)
Expand All @@ -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;

Expand Down Expand Up @@ -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.
* @return <code>true</code> if set
*/
public boolean isSet() {
return !isEmpty();
}
Expand Down
Loading

0 comments on commit 47b1a28

Please sign in to comment.