Skip to content

Commit

Permalink
Renamed a bunch of classes with acronyms in them to be consistent wit…
Browse files Browse the repository at this point in the history
…h upper/lower case.
  • Loading branch information
essiembre committed Aug 31, 2024
1 parent 979bdfc commit d76ca76
Show file tree
Hide file tree
Showing 93 changed files with 1,379 additions and 1,379 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,18 @@
* @since 2.0.0
*/
@Slf4j
public class OSResource<T> {
public class OsResource<T> {

private T resource;

public OSResource<T> win(T resource) {
public OsResource<T> win(T resource) {
if (SystemUtils.IS_OS_WINDOWS) {
this.resource = resource;
}
return this;
}

public OSResource<T> unix(T resource) {
public OsResource<T> unix(T resource) {
if (SystemUtils.IS_OS_UNIX
&& !SystemUtils.IS_OS_LINUX
&& !SystemUtils.IS_OS_MAC) {
Expand All @@ -56,14 +56,14 @@ public OSResource<T> unix(T resource) {
return this;
}

public OSResource<T> linux(T resource) {
public OsResource<T> linux(T resource) {
if (SystemUtils.IS_OS_LINUX) {
this.resource = resource;
}
return this;
}

public OSResource<T> mac(T resource) {
public OsResource<T> mac(T resource) {
if (SystemUtils.IS_OS_MAC) {
this.resource = resource;
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/norconex/commons/lang/PackageManifest.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import com.norconex.commons.lang.version.SemanticVersion;
import com.norconex.commons.lang.version.SemanticVersionParser;
import com.norconex.commons.lang.version.SemanticVersionParserException;
import com.norconex.commons.lang.xml.XML;
import com.norconex.commons.lang.xml.Xml;

import lombok.AccessLevel;
import lombok.Builder;
Expand Down Expand Up @@ -156,7 +156,7 @@ private static void fromUnpackedPomXml(
.map(url -> Failable.<URI, URISyntaxException>call(
() -> url.toURI().resolve("../../pom.xml")))
.map(uri -> new File(uri.getPath()))
.map(pomFile -> XML.of(pomFile).create())
.map(pomFile -> Xml.of(pomFile).create())
.ifPresent(xml -> {
ifBlank(pmb.version, () -> pmb.version(
xml.getString("version")));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* Provides convenience methods complementing the SLF4J offerings.
* @since 2.0.0
*/
public final class SLF4JUtil {
public final class Slf4jUtil {

private static final Map<Level, LevelLogger> LL_MAP =
new EnumMap<>(Level.class);
Expand Down Expand Up @@ -62,7 +62,7 @@ public final class SLF4JUtil {
JAVA_LEVEL_MAP.put(java.util.logging.Level.SEVERE, Level.ERROR);
}

private SLF4JUtil() {
private Slf4jUtil() {
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

import com.norconex.commons.lang.bean.BeanMapper;
import com.norconex.commons.lang.bean.BeanMapper.Format;
import com.norconex.commons.lang.xml.XML;
import com.norconex.commons.lang.xml.Xml;

import jakarta.validation.ConstraintViolationException;
import lombok.AccessLevel;
Expand Down Expand Up @@ -276,25 +276,25 @@ public String toString(Path configFile) {
}

/**
* Loads an XML configuration file into an {@link XML} object, performing
* Loads an XML configuration file into an {@link Xml} object, performing
* variable interpolation and handling any other Velocity directives.
* @param configFile XML configuration file
* @return XML
* @since 3.0.0 renamed from <code>loadXML(Path)</code>
*/
public XML toXml(Path configFile) {
public Xml toXml(Path configFile) {
return toXml(configFile, null);
}

/**
* Loads an XML configuration file into an {@link XML} object, performing
* Loads an XML configuration file into an {@link Xml} object, performing
* variable interpolation and handling any other Velocity directives.
* @param configFile XML configuration file
* @param errorHandler XML error handler
* @return XML
* @since 3.0.0 renamed from <code>loadXML(Path, ErrorHandler)</code>
*/
public XML toXml(
public Xml toXml(
Path configFile, ErrorHandler errorHandler) {
if (configFile == null || !configFile.toFile().exists()) {
return null;
Expand All @@ -307,7 +307,7 @@ public XML toXml(
// as they are not necessary to parse configs.
xml = Pattern.compile("((?!^)<\\?xml.*?\\?>|<\\!DOCTYPE[^>]*>)")
.matcher(xml).replaceAll("");
return XML.of(xml).setErrorHandler(errorHandler).create();
return Xml.of(xml).setErrorHandler(errorHandler).create();
} catch (Exception e) {
throw new ConfigurationException(
"Cannot load configuration file: \"" + configFile + "\". "
Expand Down Expand Up @@ -370,7 +370,7 @@ public void toObject(@NonNull Path configFile, @NonNull Object object) {
* @deprecated Use {@link #toXml(Path)} instead.
*/
@Deprecated(since = "3.0.0")
public XML loadXML(Path configFile) {
public Xml loadXML(Path configFile) {
return loadXML(configFile, null);
}

Expand All @@ -383,7 +383,7 @@ public XML loadXML(Path configFile) {
* @deprecated Use {@link #toXml(Path, ErrorHandler)} instead.
*/
@Deprecated(since = "3.0.0")
public XML loadXML(
public Xml loadXML(
Path configFile, ErrorHandler errorHandler) {
if (configFile == null || !configFile.toFile().exists()) {
return null;
Expand All @@ -396,7 +396,7 @@ public XML loadXML(
// as they are not necessary to parse configs.
xml = Pattern.compile("((?!^)<\\?xml.*?\\?>|<\\!DOCTYPE[^>]*>)")
.matcher(xml).replaceAll("");
return XML.of(xml).setErrorHandler(errorHandler).create();
return Xml.of(xml).setErrorHandler(errorHandler).create();
} catch (Exception e) {
throw new ConfigurationException(
"Cannot load configuration file: \"" + configFile + "\". "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ private static Map<Class<?>, Converter> createDefaultConverters() {
cc.put(char.class, new CharacterConverter());
cc.put(Class.class, new ClassConverter());
cc.put(String.class, new StringConverter());
cc.put(URL.class, new URLConverter());
cc.put(URL.class, new UrlConverter());
cc.put(Duration.class, new DurationConverter());
cc.put(ContentType.class, new ContentTypeConverter());
cc.put(Charset.class, new CharsetConverter());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* {@link URL} converter.
* @since 2.0.0
*/
public class URLConverter extends AbstractConverter {
public class UrlConverter extends AbstractConverter {

@Override
protected String nullSafeToString(Object object) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import org.slf4j.event.Level;

import com.norconex.commons.lang.ExceptionUtil;
import com.norconex.commons.lang.SLF4JUtil;
import com.norconex.commons.lang.Slf4jUtil;
import com.norconex.commons.lang.bean.BeanUtil;

import lombok.Getter;
Expand Down Expand Up @@ -222,11 +222,11 @@ public void log(Event event, Level level) {
+ "." + event.getName());
Level safeLevel = ObjectUtils.defaultIfNull(level, Level.INFO);
if (stacktraceLoggingDisabled && event.getException() != null) {
SLF4JUtil.log(log, safeLevel, event.toString()
Slf4jUtil.log(log, safeLevel, event.toString()
+ " Cause:\n{}",
ExceptionUtil.getFormattedMessages(event.getException()));
} else {
SLF4JUtil.log(
Slf4jUtil.log(
log, safeLevel, event.toString(), event.getException());
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/norconex/commons/lang/file/WebFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.norconex.commons.lang.url.URLStreamer;
import com.norconex.commons.lang.url.UrlStreamer;

/**
* Access a web-based file as a local file.
Expand Down Expand Up @@ -213,7 +213,7 @@ protected void download(URL url, Path localFile) {
targetURL = new URL("jar:" + url);
}
FileUtils.copyInputStreamToFile(
URLStreamer.stream(targetURL), localFile.toFile());
UrlStreamer.stream(targetURL), localFile.toFile());
LOG.debug("Web file downloaded from \"{}\" to \"{}\"",
url, localFile);
} catch (IOException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
/**
* I/O related utility methods.
*/
public final class IOUtil {
public final class IoUtil {

/** Empty strings. */
private static final String[] EMPTY_STRINGS = {};
Expand All @@ -55,7 +55,7 @@ public final class IOUtil {
/**
* Constructor.
*/
private IOUtil() {
private IoUtil() {
}

/**
Expand All @@ -72,7 +72,7 @@ public static boolean startsWith(
if (is == null || bytes == null) {
return false;
}
var head = IOUtil.borrowBytes(is, bytes.length);
var head = IoUtil.borrowBytes(is, bytes.length);
return Arrays.equals(bytes, head);
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/norconex/commons/lang/io/TextReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public TextReader(Reader reader, int maxReadSize,
boolean removeTrailingDelimiter) {
super();
this.maxReadSize = maxReadSize;
this.reader = IOUtil.toBufferedReader(reader);
this.reader = IoUtil.toBufferedReader(reader);
this.removeTrailingDelimiter = removeTrailingDelimiter;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@

import static org.apache.commons.text.StringEscapeUtils.escapeXml11;

import com.norconex.commons.lang.xml.XMLFormatter;
import com.norconex.commons.lang.xml.XMLFormatter.Builder.AttributeWrap;
import com.norconex.commons.lang.xml.XmlFormatter;
import com.norconex.commons.lang.xml.XmlFormatter.Builder.AttributeWrap;

/**
* <p>{&#64;nx.html} HTML beautifier with enhanced functionality.
* HTML has to follow basic XML syntax.</p>
*
* @since 2.0.0
*/
public class HTMLTaglet extends AbstractInlineTaglet {
public class HtmlTaglet extends AbstractInlineTaglet {

public static final String NAME = "nx.html";
public static final XMLFormatter FORMATTER = XMLFormatter.builder()
public static final XmlFormatter FORMATTER = XmlFormatter.builder()
.maxLineLength(80)
.minTextLength(40)
.attributeWrapping(AttributeWrap.ALL)
Expand All @@ -38,7 +38,7 @@ public class HTMLTaglet extends AbstractInlineTaglet {
.closeWrappingTagOnOwnLine()
.build();

public HTMLTaglet() {
public HtmlTaglet() {
super(NAME);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
* The text to be included is taken from the declared type JavaDoc comment of
* the referenced class source file. The given text needs to be wrapped by
* a block tag such as {@link BlockTaglet},
* {@link HTMLTaglet}, {@link JSONTaglet}, {@link XMLTaglet}, etc.
* {@link HtmlTaglet}, {@link JsonTaglet}, {@link XmlTaglet}, etc.
* </p>
* <p>
* If you have multiple blocks of text to include from a JavaDoc comment,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
*
* @since 2.0.0
*/
public class JSONTaglet extends AbstractInlineTaglet {
public class JsonTaglet extends AbstractInlineTaglet {

public static final String NAME = "nx.json";

Expand All @@ -62,7 +62,7 @@ public class JSONTaglet extends AbstractInlineTaglet {

private static final Wrapper NO_WRAPPER = new Wrapper(s -> s, s -> s);

public JSONTaglet() {
public JsonTaglet() {
super(NAME);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
*
* @since 2.0.0
*/
public class XMLExampleTaglet extends XMLTaglet {
public class XmlExampleTaglet extends XmlTaglet {

public static final String NAME = "nx.xml.example";

public XMLExampleTaglet() {
public XmlExampleTaglet() {
super(NAME, tag -> "<h4 id=\"nx-xml-" + orDefaultId(tag.getReference())
+ "-heading\">XML usage example:</h4>\n");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

import java.util.function.Function;

import com.norconex.commons.lang.xml.XMLFormatter;
import com.norconex.commons.lang.xml.XMLFormatter.Builder.AttributeWrap;
import com.norconex.commons.lang.xml.XmlFormatter;
import com.norconex.commons.lang.xml.XmlFormatter.Builder.AttributeWrap;

/**
* <p>{&#64;nx.xml} XML beautifier with enhanced functionality.</p>
Expand All @@ -43,10 +43,10 @@
*
* @since 2.0.0
*/
public class XMLTaglet extends AbstractInlineTaglet {
public class XmlTaglet extends AbstractInlineTaglet {

public static final String NAME = "nx.xml";
public static final XMLFormatter FORMATTER = XMLFormatter.builder()
public static final XmlFormatter FORMATTER = XmlFormatter.builder()
.maxLineLength(80)
.minTextLength(40)
.attributeWrapping(AttributeWrap.ALL)
Expand All @@ -56,11 +56,11 @@ public class XMLTaglet extends AbstractInlineTaglet {
.selfCloseEmptyElements()
.build();

public XMLTaglet() {
public XmlTaglet() {
super(NAME);
}

protected XMLTaglet(String name,
protected XmlTaglet(String name,
Function<TagContent, String> headingProvider) {
super(name, headingProvider);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
*
* @since 2.0.0
*/
public class XMLUsageTaglet extends XMLTaglet {
public class XmlUsageTaglet extends XmlTaglet {

public static final String NAME = "nx.xml.usage";

public XMLUsageTaglet() {
public XmlUsageTaglet() {
super(NAME, tag -> "<h3 id=\"nx-xml-" + orDefaultId(tag.getReference())
+ "-heading\">XML configuration usage:</h3>\n");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.apache.commons.lang3.StringUtils;

import com.norconex.commons.lang.collection.CollectionUtil;
import com.norconex.commons.lang.xml.XML;
import com.norconex.commons.lang.xml.Xml;

/**
* <p>Convenient way of handling the different ways a value (or values) can
Expand Down Expand Up @@ -143,14 +143,14 @@ public static PropertySetter orReplace(PropertySetter setter) {
}

// Gets from XML, returns default value if not defined
public static PropertySetter fromXML(XML xml, PropertySetter defaultValue) {
public static PropertySetter fromXML(Xml xml, PropertySetter defaultValue) {
if (xml == null) {
return defaultValue;
}
return xml.getEnum("@onSet", PropertySetter.class, defaultValue);
}

public static void toXML(XML xml, PropertySetter setter) {
public static void toXML(Xml xml, PropertySetter setter) {
if (xml != null) {
xml.setAttribute("onSet", setter);
}
Expand Down
Loading

0 comments on commit d76ca76

Please sign in to comment.