Skip to content

Commit

Permalink
Polish code (#631)
Browse files Browse the repository at this point in the history
  • Loading branch information
antoniosanct authored Mar 12, 2023
1 parent f84d9c4 commit 7e5cf65
Show file tree
Hide file tree
Showing 76 changed files with 144 additions and 203 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,10 @@
import com.rometools.rome.feed.synd.SyndPerson;
import com.rometools.rome.feed.synd.SyndPersonImpl;

import java.io.Serializable;
import java.util.LinkedList;
import java.util.List;

public class AtomLinkModuleImpl implements AtomLinkModule, Cloneable, Serializable {
public class AtomLinkModuleImpl implements AtomLinkModule {

private List<Link> links = new LinkedList<Link>();
private List<SyndPerson> authors = new LinkedList<SyndPerson>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ public Module parse(final Element element, final Locale locale) {
} else if (type.equals("string")) {
tags.add(new CustomTagImpl(child.getName(), child.getText()));
} else if (type.equals("int")) {
tags.add(new CustomTagImpl(child.getName(), new Integer(child.getTextTrim())));
tags.add(new CustomTagImpl(child.getName(), Integer.valueOf(child.getTextTrim())));
} else if (type.equals("float")) {
tags.add(new CustomTagImpl(child.getName(), new Float(child.getTextTrim())));
tags.add(new CustomTagImpl(child.getName(), Float.valueOf(child.getTextTrim())));
} else if (type.equals("intUnit")) {
tags.add(new CustomTagImpl(child.getName(), new IntUnit(child.getTextTrim())));
} else if (type.equals("floatUnit")) {
Expand Down Expand Up @@ -99,7 +99,7 @@ public Module parse(final Element element, final Locale locale) {
LOG.warn("Unable to parse URL type on " + child.getName(), e);
}
} else if (type.equals("boolean")) {
tags.add(new CustomTagImpl(child.getName(), new Boolean(child.getTextTrim().toLowerCase())));
tags.add(new CustomTagImpl(child.getName(), Boolean.valueOf(child.getTextTrim().toLowerCase())));
} else if (type.equals("location")) {
tags.add(new CustomTagImpl(child.getName(), new CustomTagImpl.Location(child.getText())));
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,15 +142,15 @@ private void handleTag(final Element tag, final PropertyDescriptor pd, final Goo
Object tagValue = null;

if (pd.getPropertyType() == Integer.class || pd.getPropertyType().getComponentType() == Integer.class) {
tagValue = new Integer(GoogleBaseParser.stripNonValidCharacters(GoogleBaseParser.INTEGER_CHARS, tag.getText()));
tagValue = Integer.valueOf(GoogleBaseParser.stripNonValidCharacters(GoogleBaseParser.INTEGER_CHARS, tag.getText()));
} else if (pd.getPropertyType() == Float.class || pd.getPropertyType().getComponentType() == Float.class) {
tagValue = new Float(GoogleBaseParser.stripNonValidCharacters(GoogleBaseParser.FLOAT_CHARS, tag.getText()));
tagValue = Float.valueOf(GoogleBaseParser.stripNonValidCharacters(GoogleBaseParser.FLOAT_CHARS, tag.getText()));
} else if (pd.getPropertyType() == String.class || pd.getPropertyType().getComponentType() == String.class) {
tagValue = tag.getText();
} else if (pd.getPropertyType() == URL.class || pd.getPropertyType().getComponentType() == URL.class) {
tagValue = new URL(tag.getText().trim());
} else if (pd.getPropertyType() == Boolean.class || pd.getPropertyType().getComponentType() == Boolean.class) {
tagValue = new Boolean(tag.getText().trim());
tagValue = Boolean.valueOf(tag.getText().trim());
} else if (pd.getPropertyType() == Date.class || pd.getPropertyType().getComponentType() == Date.class) {
final String text = tag.getText().trim();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,12 @@

package com.rometools.modules.feedburner;

import java.io.Serializable;

import com.rometools.rome.feed.module.Module;

/**
* Interface for the FeedBurner RSS extension.
*/
public interface FeedBurner extends Module, Serializable, Cloneable {
public interface FeedBurner extends Module {

public static final String URI = "http://rssnamespace.org/feedburner/ext/1.0";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@
*/
package com.rometools.modules.feedpress.modules;

import com.rometools.rome.feed.CopyFrom;
import com.rometools.rome.feed.module.Module;

/**
* This is a ROME module that provides support for the <a href="https://feed.press/xmlns">https://feed.press/xmlns</a> namespace.
*/
public interface FeedpressModule extends Module, CopyFrom {
public interface FeedpressModule extends Module {

/**
* The URI of the namespace. (<a href="https://feed.press/xmlns">https://feed.press/xmlns</a>)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@
import com.rometools.rome.feed.impl.ToStringBean;
import com.rometools.rome.feed.module.ModuleImpl;

import java.io.Serializable;

public class FeedpressModuleImpl
extends ModuleImpl
implements FeedpressModule, Cloneable, Serializable {
implements FeedpressModule {

private String newsletterId;
private String locale;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@
*/
package com.rometools.modules.fyyd.modules;

import com.rometools.rome.feed.CopyFrom;
import com.rometools.rome.feed.module.Module;

/**
* This is a ROME module that provides support for the <a href="https://fyyd.de/fyyd-ns/">https://fyyd.de/fyyd-ns/</a> namespace.
*/
public interface FyydModule extends Module, CopyFrom {
public interface FyydModule extends Module {

/**
* The URI of the namespace. (<a href="https://fyyd.de/fyyd-ns/">https://fyyd.de/fyyd-ns/</a>)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,9 @@
import com.rometools.rome.feed.impl.ToStringBean;
import com.rometools.rome.feed.module.ModuleImpl;

import java.io.Serializable;

public class FyydModuleImpl
extends ModuleImpl
implements FyydModule, Cloneable, Serializable {
implements FyydModule {

private String verify;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* GeoRSSModule is the main georss interface defining the methods to produce and consume georss
* elements.
*/
public abstract class GeoRSSModule extends ModuleImpl implements Cloneable {
public abstract class GeoRSSModule extends ModuleImpl {

private static final long serialVersionUID = 1L;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
/**
* Polygon, a surface object bounded by one external ring and zero or more internal rings
*/
public final class Polygon extends AbstractSurface implements Cloneable {
public final class Polygon extends AbstractSurface {

private static final long serialVersionUID = 1L;
private AbstractRing exterior;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* This is an abstract object that implements the attributes common across Feeds or Items in an
* iTunes compatible RSS feed.
*/
public abstract class AbstractITunesObject implements ITunes, java.lang.Cloneable {
public abstract class AbstractITunesObject implements ITunes {

private static final long serialVersionUID = 1L;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import com.rometools.modules.itunes.types.Duration;
import com.rometools.rome.feed.CopyFrom;

import java.net.URISyntaxException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
*/
package com.rometools.modules.itunes;

import java.net.URL;
import java.util.List;

import com.rometools.modules.itunes.types.Category;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package com.rometools.modules.itunes;

import java.net.MalformedURLException;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
package com.rometools.modules.itunes.io;

import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.Arrays;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
*/
package com.rometools.modules.mediarss;

import java.io.Serializable;

import com.rometools.modules.mediarss.types.MediaContent;
import com.rometools.modules.mediarss.types.MediaGroup;
import com.rometools.modules.mediarss.types.Metadata;
Expand All @@ -33,7 +31,7 @@
/**
* Represents information for an Entry/Item level.
*/
public class MediaEntryModuleImpl extends MediaModuleImpl implements MediaEntryModule, Cloneable, Serializable {
public class MediaEntryModuleImpl extends MediaModuleImpl implements MediaEntryModule {
private static final long serialVersionUID = 1L;

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
*/
package com.rometools.modules.mediarss;

import java.io.Serializable;

import com.rometools.modules.mediarss.types.Metadata;
import com.rometools.modules.mediarss.types.PlayerReference;
import com.rometools.rome.feed.CopyFrom;
Expand All @@ -33,7 +31,7 @@
*
* This class represents feed/channel level elements for MediaRSS
*/
public class MediaModuleImpl extends ModuleImpl implements MediaModule, Serializable {
public class MediaModuleImpl extends ModuleImpl implements MediaModule {
private static final long serialVersionUID = 1L;

private Metadata metadata;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ private MediaGroup[] parseGroup(final Element e, final Locale locale) {

for (int j = 0; j < g.getContents().length; j++) {
if (g.getContents()[j].isDefaultContent()) {
g.setDefaultContentIndex(new Integer(j));
g.setDefaultContentIndex(Integer.valueOf(j));

break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
*/
package com.rometools.modules.mediarss.types;

import java.io.Serializable;

import com.rometools.rome.feed.impl.EqualsBean;
import com.rometools.rome.feed.impl.ToStringBean;

Expand All @@ -46,7 +44,7 @@
* <em>algo</em> indicates the algorithm used to create the hash. Possible values are 'md5' and
* 'sha-1'. Default value is 'md5'. It is an optional attribute.
*/
public class Hash extends AbstractSchemeValue implements Serializable {
public class Hash extends AbstractSchemeValue {
private static final long serialVersionUID = 1L;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
*/
package com.rometools.modules.opensearch.impl;

import java.io.Serializable;
import java.util.LinkedList;
import java.util.List;

Expand All @@ -24,7 +23,7 @@
import com.rometools.rome.feed.atom.Link;
import com.rometools.rome.feed.module.ModuleImpl;

public class OpenSearchModuleImpl extends ModuleImpl implements OpenSearchModule, Serializable {
public class OpenSearchModuleImpl extends ModuleImpl implements OpenSearchModule {
private static final long serialVersionUID = 1L;
private static final Logger LOG = LoggerFactory.getLogger(OpenSearchModuleImpl.class);
private int totalResults = -1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.rometools.modules.photocast.types;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Date;

/**
Expand Down Expand Up @@ -66,8 +67,8 @@ public String toString() {
BigDecimal d = new BigDecimal(getTime());
d = d.subtract(new BigDecimal(Y2K));
d = d.multiply(new BigDecimal(1000000));
d = d.divide(new BigDecimal(DAY), BigDecimal.ROUND_HALF_UP);
return d.divide(new BigDecimal(1000000), 7, BigDecimal.ROUND_HALF_UP).toString();
d = d.divide(new BigDecimal(DAY), RoundingMode.HALF_UP);
return d.divide(new BigDecimal(1000000), 7, RoundingMode.HALF_UP).toString();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,14 @@
package com.rometools.modules.psc.modules;

import com.rometools.modules.psc.types.SimpleChapter;
import com.rometools.rome.feed.CopyFrom;
import com.rometools.rome.feed.module.Module;

import java.util.List;

/**
* An interface describing the item level data for Podlove Simple Chapters.
*/
public interface PodloveSimpleChapterModule extends Module, CopyFrom {
public interface PodloveSimpleChapterModule extends Module {

/** "http://podlove.org/simple-chapters". */
String URI = "http://podlove.org/simple-chapters";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import com.rometools.rome.feed.impl.ToStringBean;
import com.rometools.rome.feed.module.ModuleImpl;

import java.io.Serializable;
import java.util.LinkedList;
import java.util.List;

Expand All @@ -31,7 +30,7 @@
*/
public class PodloveSimpleChapterModuleImpl
extends ModuleImpl
implements PodloveSimpleChapterModule, Cloneable, Serializable {
implements PodloveSimpleChapterModule {

private List<SimpleChapter> chapters;

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

package com.rometools.modules.slash;

import java.io.Serializable;

import com.rometools.rome.feed.module.Module;

/**
* This interface represents the Slash RSS extension.
*/
public interface Slash extends Module, Serializable {
public interface Slash extends Module {

public static final String URI = "http://purl.org/rss/1.0/modules/slash/";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ public Module parse(final Element element, final Locale locale) {
final StringTokenizer tok = new StringTokenizer(tag.getText(), ",");
final Integer[] hp = new Integer[tok.countTokens()];
for (int i = 0; tok.hasMoreTokens(); i++) {
hp[i] = new Integer(tok.nextToken());
hp[i] = Integer.valueOf(tok.nextToken());
}
si.setHitParade(hp);
}
tag = null;
tag = element.getChild("comments", SlashModuleParser.NS);
if (tag != null && !tag.getText().trim().isEmpty()) {
si.setComments(new Integer(tag.getText().trim()));
si.setComments(Integer.valueOf(tag.getText().trim()));
}
tag = null;
tag = element.getChild("department", SlashModuleParser.NS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public Module parse(final Element element, final Locale locale) {
final String elementName = se.getAttributeValue("element");
final String label = se.getAttributeValue("label");
final String dataType = se.getAttributeValue("data-type");
final boolean defaultOrder = se.getAttributeValue("default") == null ? false : new Boolean(se.getAttributeValue("default")).booleanValue();
final boolean defaultOrder = se.getAttributeValue("default") == null ? false : Boolean.valueOf(se.getAttributeValue("default")).booleanValue();
values.add(new Sort(ns, elementName, dataType, label, defaultOrder));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ private Integer parseIntegerAttribute(final Element sharingChild, final String a
Integer integerAttr = null;
if (integerAttribute != null) {
try {
integerAttr = new Integer(integerAttribute.getIntValue());
integerAttr = Integer.valueOf(integerAttribute.getIntValue());
} catch (final DataConversionException e) {
// dont use the data
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
*/
package com.rometools.modules.sse.modules;

import java.lang.reflect.InvocationTargetException;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
Expand Down Expand Up @@ -59,11 +60,11 @@ public Class<? extends Module> getInterface() {
public Object clone() {
SSEModule clone = null;
try {
clone = this.getClass().newInstance();
clone = this.getClass().getDeclaredConstructor().newInstance();
clone.copyFrom(this);
} catch (final InstantiationException e) {
LOG.error("Error", e);
} catch (final IllegalAccessException e) {
} catch (final InstantiationException | IllegalAccessException |
IllegalArgumentException | InvocationTargetException |
NoSuchMethodException | SecurityException e) {
LOG.error("Error", e);
}
return clone;
Expand Down
Loading

0 comments on commit 7e5cf65

Please sign in to comment.