diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2012-10-23 11:12:33 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2012-10-23 11:12:33 +0200 |
commit | 8a8788fb4e8eb083935fdca81884f21fb443d6a4 (patch) | |
tree | ec0cb8c97db35104b1ceb85562e08616cb1e676c | |
parent | c408b3c0bf41d1b897d58f394a9a7133f53bfd1e (diff) | |
download | sonarqube-8a8788fb4e8eb083935fdca81884f21fb443d6a4.tar.gz sonarqube-8a8788fb4e8eb083935fdca81884f21fb443d6a4.zip |
Fix quality flaws
19 files changed, 81 insertions, 81 deletions
diff --git a/sonar-channel/src/main/java/org/sonar/channel/Channel.java b/sonar-channel/src/main/java/org/sonar/channel/Channel.java index 29c3c635bb6..69323d47214 100644 --- a/sonar-channel/src/main/java/org/sonar/channel/Channel.java +++ b/sonar-channel/src/main/java/org/sonar/channel/Channel.java @@ -19,7 +19,7 @@ */ package org.sonar.channel; -public abstract class Channel<OUTPUT> { +public abstract class Channel<O> { /** * Tries to consume the character stream at the current reading cursor position (provided by the {@link org.sonar.channel.CodeReader}). If @@ -31,5 +31,5 @@ public abstract class Channel<OUTPUT> { * the OUTPUT that can be optionally fed by the Channel * @return false if the Channel doesn't want to consume the character stream, true otherwise. */ - public abstract boolean consume(CodeReader code, OUTPUT output); + public abstract boolean consume(CodeReader code, O output); } diff --git a/sonar-channel/src/main/java/org/sonar/channel/ChannelCodeReaderFilter.java b/sonar-channel/src/main/java/org/sonar/channel/ChannelCodeReaderFilter.java index 24a2c40dabc..4308a7ab7d9 100644 --- a/sonar-channel/src/main/java/org/sonar/channel/ChannelCodeReaderFilter.java +++ b/sonar-channel/src/main/java/org/sonar/channel/ChannelCodeReaderFilter.java @@ -27,10 +27,10 @@ import java.io.Reader; * declared for the CodeReader. * */ -public final class ChannelCodeReaderFilter<OUTPUT> extends CodeReaderFilter<OUTPUT> { +public final class ChannelCodeReaderFilter<O> extends CodeReaderFilter<O> { @SuppressWarnings("unchecked") - private Channel<OUTPUT>[] channels = new Channel[0]; + private Channel<O>[] channels = new Channel[0]; private CodeReader internalCodeReader; @@ -40,7 +40,7 @@ public final class ChannelCodeReaderFilter<OUTPUT> extends CodeReaderFilter<OUTP * @param channels * the different channels */ - public ChannelCodeReaderFilter(Channel<OUTPUT>... channels) { + public ChannelCodeReaderFilter(Channel<O>... channels) { super(); this.channels = channels; } @@ -54,7 +54,7 @@ public final class ChannelCodeReaderFilter<OUTPUT> extends CodeReaderFilter<OUTP * @param channels * the different channels */ - public ChannelCodeReaderFilter(OUTPUT output, Channel<OUTPUT>... channels) { + public ChannelCodeReaderFilter(O output, Channel<O>... channels) { super(output); this.channels = channels; } @@ -82,7 +82,7 @@ public final class ChannelCodeReaderFilter<OUTPUT> extends CodeReaderFilter<OUTP break; } boolean consumed = false; - for (Channel<OUTPUT> channel : channels) { + for (Channel<O> channel : channels) { if (channel.consume(internalCodeReader, getOutput())) { consumed = true; break; diff --git a/sonar-channel/src/main/java/org/sonar/channel/ChannelDispatcher.java b/sonar-channel/src/main/java/org/sonar/channel/ChannelDispatcher.java index dfe85838d16..57378283de3 100644 --- a/sonar-channel/src/main/java/org/sonar/channel/ChannelDispatcher.java +++ b/sonar-channel/src/main/java/org/sonar/channel/ChannelDispatcher.java @@ -27,12 +27,12 @@ import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class ChannelDispatcher<OUTPUT> extends Channel<OUTPUT> { +public class ChannelDispatcher<O> extends Channel<O> { private static final Logger LOG = LoggerFactory.getLogger(ChannelDispatcher.class); private final boolean failIfNoChannelToConsumeOneCharacter; - private final Channel<OUTPUT>[] channels; + private final Channel<O>[] channels; /** * @deprecated in version 2.9. Please use the builder() method @@ -68,11 +68,11 @@ public class ChannelDispatcher<OUTPUT> extends Channel<OUTPUT> { } @Override - public boolean consume(CodeReader code, OUTPUT output) { + public boolean consume(CodeReader code, O output) { int nextChar = code.peek(); while (nextChar != -1) { boolean characterConsumed = false; - for (Channel<OUTPUT> channel : channels) { + for (Channel<O> channel : channels) { if (channel.consume(code, output)) { characterConsumed = true; break; diff --git a/sonar-channel/src/main/java/org/sonar/channel/CodeReaderFilter.java b/sonar-channel/src/main/java/org/sonar/channel/CodeReaderFilter.java index d9d8f33433f..8f5e72039b8 100644 --- a/sonar-channel/src/main/java/org/sonar/channel/CodeReaderFilter.java +++ b/sonar-channel/src/main/java/org/sonar/channel/CodeReaderFilter.java @@ -33,18 +33,18 @@ import java.io.Reader; * @see CodeBufferTest#testSeveralCodeReaderFilter() * */ -public abstract class CodeReaderFilter<OUTPUT> { +public abstract class CodeReaderFilter<O> { private Reader reader; - private OUTPUT output; + private O output; private CodeReaderConfiguration configuration; public CodeReaderFilter() { } - public CodeReaderFilter(OUTPUT output) { + public CodeReaderFilter(O output) { this.output = output; } @@ -72,7 +72,7 @@ public abstract class CodeReaderFilter<OUTPUT> { * * @return the output */ - public OUTPUT getOutput() { + public O getOutput() { return output; } @@ -82,7 +82,7 @@ public abstract class CodeReaderFilter<OUTPUT> { * @param output * the output to set */ - public void setOutput(OUTPUT output) { + public void setOutput(O output) { this.output = output; } diff --git a/sonar-channel/src/main/java/org/sonar/channel/RegexChannel.java b/sonar-channel/src/main/java/org/sonar/channel/RegexChannel.java index 145230f1473..fbcd2cc757e 100644 --- a/sonar-channel/src/main/java/org/sonar/channel/RegexChannel.java +++ b/sonar-channel/src/main/java/org/sonar/channel/RegexChannel.java @@ -25,7 +25,7 @@ import java.util.regex.Pattern; /** * The RegexChannel can be used to be called each time the next characters in the character stream match a regular expression */ -public abstract class RegexChannel<OUTPUT> extends Channel<OUTPUT> { +public abstract class RegexChannel<O> extends Channel<O> { private final StringBuilder tmpBuilder = new StringBuilder(); private final Matcher matcher; @@ -41,7 +41,7 @@ public abstract class RegexChannel<OUTPUT> extends Channel<OUTPUT> { } @Override - public final boolean consume(CodeReader code, OUTPUT output) { + public final boolean consume(CodeReader code, O output) { if (code.popTo(matcher, tmpBuilder) > 0) { consume(tmpBuilder, output); tmpBuilder.delete(0, tmpBuilder.length()); @@ -59,6 +59,6 @@ public abstract class RegexChannel<OUTPUT> extends Channel<OUTPUT> { * @param the * OUPUT object which can be optionally fed */ - protected abstract void consume(CharSequence token, OUTPUT output); + protected abstract void consume(CharSequence token, O output); } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/checks/CheckFactory.java b/sonar-plugin-api/src/main/java/org/sonar/api/checks/CheckFactory.java index b6c039e15c8..f4f9f81d514 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/checks/CheckFactory.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/checks/CheckFactory.java @@ -29,10 +29,10 @@ import java.util.Map; /** * @since 2.3 */ -public abstract class CheckFactory<CHECK> { +public abstract class CheckFactory<C> { - private Map<ActiveRule, CHECK> checkByActiveRule = Maps.newIdentityHashMap(); - private Map<CHECK, ActiveRule> activeRuleByCheck = Maps.newIdentityHashMap(); + private Map<ActiveRule, C> checkByActiveRule = Maps.newIdentityHashMap(); + private Map<C, ActiveRule> activeRuleByCheck = Maps.newIdentityHashMap(); private RulesProfile profile; private String repositoryKey; @@ -45,27 +45,27 @@ public abstract class CheckFactory<CHECK> { checkByActiveRule.clear(); activeRuleByCheck.clear(); for (ActiveRule activeRule : profile.getActiveRulesByRepository(repositoryKey)) { - CHECK check = createCheck(activeRule); + C check = createCheck(activeRule); checkByActiveRule.put(activeRule, check); activeRuleByCheck.put(check, activeRule); } } - abstract CHECK createCheck(ActiveRule activeRule); + abstract C createCheck(ActiveRule activeRule); public final String getRepositoryKey() { return repositoryKey; } - public final Collection<CHECK> getChecks() { + public final Collection<C> getChecks() { return checkByActiveRule.values(); } - public final CHECK getCheck(ActiveRule activeRule) { + public final C getCheck(ActiveRule activeRule) { return checkByActiveRule.get(activeRule); } - public final ActiveRule getActiveRule(CHECK check) { + public final ActiveRule getActiveRule(C check) { return activeRuleByCheck.get(check); } } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/measures/PropertiesBuilder.java b/sonar-plugin-api/src/main/java/org/sonar/api/measures/PropertiesBuilder.java index d95034ed39c..1adff64c5cb 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/measures/PropertiesBuilder.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/measures/PropertiesBuilder.java @@ -27,30 +27,30 @@ import java.util.TreeMap; /** * @since 1.10 */ -public class PropertiesBuilder<KEY, VALUE> { +public class PropertiesBuilder<K, V> { private Metric metric; - private Map<KEY, VALUE> props; + private Map<K, V> props; - public PropertiesBuilder(Metric metric, Map<KEY, VALUE> map) { - this.props = new TreeMap<KEY, VALUE>(map); + public PropertiesBuilder(Metric metric, Map<K, V> map) { + this.props = new TreeMap<K, V>(map); this.metric = metric; } public PropertiesBuilder(Metric metric) { - this.props = new TreeMap<KEY, VALUE>(); + this.props = new TreeMap<K, V>(); this.metric = metric; } public PropertiesBuilder() { - this.props = new TreeMap<KEY, VALUE>(); + this.props = new TreeMap<K, V>(); } - public PropertiesBuilder<KEY, VALUE> clear() { + public PropertiesBuilder<K, V> clear() { this.props.clear(); return this; } - public Map<KEY, VALUE> getProps() { + public Map<K, V> getProps() { return props; } @@ -58,17 +58,17 @@ public class PropertiesBuilder<KEY, VALUE> { return metric; } - public PropertiesBuilder<KEY, VALUE> setMetric(Metric metric) { + public PropertiesBuilder<K, V> setMetric(Metric metric) { this.metric = metric; return this; } - public PropertiesBuilder<KEY, VALUE> add(KEY key, VALUE value) { + public PropertiesBuilder<K, V> add(K key, V value) { props.put(key, value); return this; } - public PropertiesBuilder<KEY, VALUE> addAll(Map<KEY, VALUE> map) { + public PropertiesBuilder<K, V> addAll(Map<K, V> map) { props.putAll(map); return this; } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/KeyValueFormat.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/KeyValueFormat.java index 4b413525d63..411d9dbdce7 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/KeyValueFormat.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/KeyValueFormat.java @@ -326,11 +326,11 @@ public final class KeyValueFormat { * @deprecated since 2.7 */ @Deprecated - public static <KEY, VALUE> Map<KEY, VALUE> parse(String data, Transformer<KEY, VALUE> transformer) { + public static <K, V> Map<K, V> parse(String data, Transformer<K, V> transformer) { Map<String, String> rawData = parse(data); - Map<KEY, VALUE> map = new HashMap<KEY, VALUE>(); + Map<K, V> map = new HashMap<K, V>(); for (Map.Entry<String, String> entry : rawData.entrySet()) { - KeyValue<KEY, VALUE> keyVal = transformer.transform(entry.getKey(), entry.getValue()); + KeyValue<K, V> keyVal = transformer.transform(entry.getKey(), entry.getValue()); if (keyVal != null) { map.put(keyVal.getKey(), keyVal.getValue()); } diff --git a/sonar-squid/src/main/java/org/sonar/squid/Squid.java b/sonar-squid/src/main/java/org/sonar/squid/Squid.java index 2d9ae8ca20a..246a54d82e5 100644 --- a/sonar-squid/src/main/java/org/sonar/squid/Squid.java +++ b/sonar-squid/src/main/java/org/sonar/squid/Squid.java @@ -74,12 +74,12 @@ public class Squid implements DirectedGraphAccessor<SourceCode, SourceCodeEdge>, externalCodeVisitors.add(pico.getComponent(visitor)); } - public <SCANNER extends CodeScanner> SCANNER register(Class<SCANNER> scannerClass) { + public <S extends CodeScanner> S register(Class<S> scannerClass) { if(pico.getComponent(scannerClass) != null){ throw new IllegalStateException("The Squid SCANNER '" + scannerClass.getName() + "' can't be registered multiple times."); } addToPicocontainer(scannerClass); - SCANNER scanner = pico.getComponent(scannerClass); + S scanner = pico.getComponent(scannerClass); for (Object clazz : scanner.getVisitorClasses()) { addToPicocontainer((Class) clazz); scanner.accept(pico.<CodeVisitor> getComponent((Class) clazz)); diff --git a/sonar-squid/src/main/java/org/sonar/squid/api/CodeScanner.java b/sonar-squid/src/main/java/org/sonar/squid/api/CodeScanner.java index 4eba556a2fa..b7ad8ceebba 100644 --- a/sonar-squid/src/main/java/org/sonar/squid/api/CodeScanner.java +++ b/sonar-squid/src/main/java/org/sonar/squid/api/CodeScanner.java @@ -24,17 +24,17 @@ import java.util.ArrayList; import java.util.Collection; import java.util.List; -public abstract class CodeScanner<VISITOR extends CodeVisitor> { +public abstract class CodeScanner<V extends CodeVisitor> { private List<CodeVisitor> visitors = new ArrayList<CodeVisitor>(); - public abstract Collection<Class<? extends VISITOR>> getVisitorClasses(); + public abstract Collection<Class<? extends V>> getVisitorClasses(); public void accept(CodeVisitor visitor) { visitors.add(visitor); } - public List<VISITOR> getVisitors() { - return (List<VISITOR>) visitors; + public List<V> getVisitors() { + return (List<V>) visitors; } } diff --git a/sonar-squid/src/main/java/org/sonar/squid/api/SourceCode.java b/sonar-squid/src/main/java/org/sonar/squid/api/SourceCode.java index cc48228ebf6..a20544e7bce 100644 --- a/sonar-squid/src/main/java/org/sonar/squid/api/SourceCode.java +++ b/sonar-squid/src/main/java/org/sonar/squid/api/SourceCode.java @@ -203,20 +203,20 @@ public abstract class SourceCode implements Measurable, Comparable<SourceCode> { return this; } - public <SOURCECODE extends SourceCode> SOURCECODE getParent(Class<SOURCECODE> sourceCode) { + public <S extends SourceCode> S getParent(Class<S> sourceCode) { if (parent == null) { return null; } if (parent.getClass().equals(sourceCode)) { - return (SOURCECODE) parent; + return (S) parent; } return parent.getParent(sourceCode); } - public <SOURCECODE extends SourceCode> SOURCECODE getAncestor(Class<SOURCECODE> withClass) { - SOURCECODE ancestor = getParent(withClass); + public <S extends SourceCode> S getAncestor(Class<S> withClass) { + S ancestor = getParent(withClass); if (ancestor!=null) { - SOURCECODE parentAncestor = ancestor.getAncestor(withClass); + S parentAncestor = ancestor.getAncestor(withClass); if (parentAncestor!=null) { ancestor = parentAncestor; } diff --git a/sonar-testing-harness/src/main/java/org/sonar/test/channel/ChannelMatchers.java b/sonar-testing-harness/src/main/java/org/sonar/test/channel/ChannelMatchers.java index 3fa1d962e90..56506285771 100644 --- a/sonar-testing-harness/src/main/java/org/sonar/test/channel/ChannelMatchers.java +++ b/sonar-testing-harness/src/main/java/org/sonar/test/channel/ChannelMatchers.java @@ -26,12 +26,12 @@ public final class ChannelMatchers { private ChannelMatchers() { } - public static <OUTPUT> ChannelMatcher<OUTPUT> consume(String sourceCode, OUTPUT output) { - return new ChannelMatcher<OUTPUT>(sourceCode, output); + public static <O> ChannelMatcher<O> consume(String sourceCode, O output) { + return new ChannelMatcher<O>(sourceCode, output); } - public static <OUTPUT> ChannelMatcher<OUTPUT> consume(CodeReader codeReader, OUTPUT output) { - return new ChannelMatcher<OUTPUT>(codeReader, output); + public static <O> ChannelMatcher<O> consume(CodeReader codeReader, O output) { + return new ChannelMatcher<O>(codeReader, output); } public static ReaderHasNextCharMatcher hasNextChar(char nextChar) { diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/Sonar.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/Sonar.java index b41b73b32c7..ed6d749220f 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/Sonar.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/Sonar.java @@ -45,12 +45,12 @@ public class Sonar { return connector; } - public <MODEL extends Model> MODEL find(Query<MODEL> query) { + public <M extends Model> M find(Query<M> query) { String json = connector.execute(query); - MODEL result = null; + M result = null; if (json != null) { try { - Unmarshaller<MODEL> unmarshaller = Unmarshallers.forModel(query.getModelClass()); + Unmarshaller<M> unmarshaller = Unmarshallers.forModel(query.getModelClass()); result = unmarshaller.toModel(json); } catch (Exception e) { throw new UnmarshalException(query, json, e); @@ -59,14 +59,14 @@ public class Sonar { return result; } - public <MODEL extends Model> List<MODEL> findAll(Query<MODEL> query) { + public <M extends Model> List<M> findAll(Query<M> query) { String json = connector.execute(query); - List<MODEL> result; + List<M> result; if (json == null) { result = Collections.emptyList(); } else { try { - Unmarshaller<MODEL> unmarshaller = Unmarshallers.forModel(query.getModelClass()); + Unmarshaller<M> unmarshaller = Unmarshallers.forModel(query.getModelClass()); result = unmarshaller.toModels(json); } catch (Exception e) { throw new UnmarshalException(query, json, e); @@ -75,12 +75,12 @@ public class Sonar { return result; } - public <MODEL extends Model> MODEL create(CreateQuery<MODEL> query) { + public <M extends Model> M create(CreateQuery<M> query) { String json = connector.execute(query); - MODEL result = null; + M result = null; if (json != null) { try { - Unmarshaller<MODEL> unmarshaller = Unmarshallers.forModel(query.getModelClass()); + Unmarshaller<M> unmarshaller = Unmarshallers.forModel(query.getModelClass()); result = unmarshaller.toModel(json); } catch (Exception e) { throw new UnmarshalException(query, json, e); diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/AbstractQuery.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/AbstractQuery.java index a63ad110dbe..3bf6f10b2f1 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/AbstractQuery.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/AbstractQuery.java @@ -24,7 +24,7 @@ import java.util.Date; /** * @since 2.2 */ -public abstract class AbstractQuery<MODEL extends Model> { +public abstract class AbstractQuery<M extends Model> { /** * Default timeout for waiting data, in milliseconds. @@ -72,7 +72,7 @@ public abstract class AbstractQuery<MODEL extends Model> { * * @since 2.10 */ - public final AbstractQuery<MODEL> setTimeoutMilliseconds(int i) { + public final AbstractQuery<M> setTimeoutMilliseconds(int i) { this.timeoutMilliseconds = (i < 0 ? 0 : i); return this; } @@ -91,7 +91,7 @@ public abstract class AbstractQuery<MODEL extends Model> { * * @since 2.10 */ - public final AbstractQuery<MODEL> setLocale(String locale) { + public final AbstractQuery<M> setLocale(String locale) { this.locale = locale; return this; } diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/CreateQuery.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/CreateQuery.java index a0ab64cafc9..8f8d5ef2057 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/CreateQuery.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/CreateQuery.java @@ -24,8 +24,8 @@ package org.sonar.wsclient.services; * * @since 2.2 */ -public abstract class CreateQuery<MODEL extends Model> extends AbstractQuery<MODEL> { +public abstract class CreateQuery<M extends Model> extends AbstractQuery<M> { - public abstract Class<MODEL> getModelClass(); + public abstract Class<M> getModelClass(); } diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Query.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Query.java index 11168d3a6e4..72c95c21990 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Query.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Query.java @@ -22,8 +22,8 @@ package org.sonar.wsclient.services; /** * @since 2.1 */ -public abstract class Query<MODEL extends Model> extends AbstractQuery<MODEL> { +public abstract class Query<M extends Model> extends AbstractQuery<M> { - public abstract Class<MODEL> getModelClass(); + public abstract Class<M> getModelClass(); }
\ No newline at end of file diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/UpdateQuery.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/UpdateQuery.java index 0e26c0b1a76..eecce8b992c 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/UpdateQuery.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/UpdateQuery.java @@ -24,8 +24,8 @@ package org.sonar.wsclient.services; * * @since 2.6 */ -public abstract class UpdateQuery<MODEL extends Model> extends AbstractQuery<MODEL> { +public abstract class UpdateQuery<M extends Model> extends AbstractQuery<M> { - public abstract Class<MODEL> getModelClass(); + public abstract Class<M> getModelClass(); } diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/AbstractUnmarshaller.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/AbstractUnmarshaller.java index 142dea0772e..0170c24e6c5 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/AbstractUnmarshaller.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/AbstractUnmarshaller.java @@ -25,11 +25,11 @@ import org.sonar.wsclient.services.WSUtils; import java.util.ArrayList; import java.util.List; -public abstract class AbstractUnmarshaller<MODEL extends Model> implements Unmarshaller<MODEL> { +public abstract class AbstractUnmarshaller<M extends Model> implements Unmarshaller<M> { - public final MODEL toModel(String json) { + public final M toModel(String json) { WSUtils utils = WSUtils.getINSTANCE(); - MODEL result = null; + M result = null; Object array = utils.parse(json); if (utils.getArraySize(array) >= 1) { Object elt = utils.getArrayElement(array, 0); @@ -41,9 +41,9 @@ public abstract class AbstractUnmarshaller<MODEL extends Model> implements Unmar } - public final List<MODEL> toModels(String json) { + public final List<M> toModels(String json) { WSUtils utils = WSUtils.getINSTANCE(); - List<MODEL> result = new ArrayList<MODEL>(); + List<M> result = new ArrayList<M>(); Object array = utils.parse(json); for (int i = 0; i < utils.getArraySize(array); i++) { Object elt = utils.getArrayElement(array, i); @@ -54,5 +54,5 @@ public abstract class AbstractUnmarshaller<MODEL extends Model> implements Unmar return result; } - protected abstract MODEL parse(Object elt); + protected abstract M parse(Object elt); } diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/Unmarshallers.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/Unmarshallers.java index b34d561fae5..d2bffdec7a5 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/Unmarshallers.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/Unmarshallers.java @@ -70,7 +70,7 @@ public final class Unmarshallers { unmarshallers.put(Authentication.class, new AuthenticationUnmarshaller()); } - public static <MODEL extends Model> Unmarshaller<MODEL> forModel(Class<MODEL> modelClass) { + public static <M extends Model> Unmarshaller<M> forModel(Class<M> modelClass) { return unmarshallers.get(modelClass); } } |