Refactored some code
This commit is contained in:
parent
4b79f6c1d5
commit
9bf5a75e2c
4 changed files with 18 additions and 13 deletions
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright 2007 Apache Software Foundation
|
||||
*
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. The ASF licenses this file to You
|
||||
* under the Apache License, Version 2.0 (the "License"); you may not
|
||||
|
@ -27,6 +27,7 @@ import com.sun.syndication.feed.module.Module;
|
|||
* ROME Extension Module to Atom protocol extensions to Atom format.
|
||||
*/
|
||||
public interface AppModule extends Module {
|
||||
|
||||
public static final String URI = "http://www.w3.org/2007/app";
|
||||
|
||||
/** True if entry is a draft */
|
||||
|
|
|
@ -91,7 +91,7 @@ public interface AtomRequest {
|
|||
* Returns an Enumeration of String objects containing the names of the parameters contained in
|
||||
* this request.
|
||||
*/
|
||||
public Enumeration getParameterNames();
|
||||
public Enumeration<String> getParameterNames();
|
||||
|
||||
/**
|
||||
* Returns an array of String objects containing all of the values the given request parameter
|
||||
|
@ -123,12 +123,12 @@ public interface AtomRequest {
|
|||
/**
|
||||
* Returns all the values of the specified request header as an Enumeration of String objects.
|
||||
*/
|
||||
public Enumeration getHeaders(String arg0);
|
||||
public Enumeration<String> getHeaders(String arg0);
|
||||
|
||||
/**
|
||||
* Returns an enumeration of all the header names this request contains.
|
||||
*/
|
||||
public Enumeration getHeaderNames();
|
||||
public Enumeration<String> getHeaderNames();
|
||||
|
||||
/**
|
||||
* Returns the value of the specified request header as an int.
|
||||
|
|
|
@ -89,7 +89,8 @@ public class AtomRequestImpl implements AtomRequest {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Enumeration getParameterNames() {
|
||||
@SuppressWarnings("unchecked")
|
||||
public Enumeration<String> getParameterNames() {
|
||||
return wrapped.getParameterNames();
|
||||
}
|
||||
|
||||
|
@ -99,6 +100,7 @@ public class AtomRequestImpl implements AtomRequest {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public Map<String, Object> getParameterMap() {
|
||||
return wrapped.getParameterMap();
|
||||
}
|
||||
|
@ -119,12 +121,14 @@ public class AtomRequestImpl implements AtomRequest {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Enumeration getHeaders(final String arg0) {
|
||||
@SuppressWarnings("unchecked")
|
||||
public Enumeration<String> getHeaders(final String arg0) {
|
||||
return wrapped.getHeaders(arg0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enumeration getHeaderNames() {
|
||||
@SuppressWarnings("unchecked")
|
||||
public Enumeration<String> getHeaderNames() {
|
||||
return wrapped.getHeaderNames();
|
||||
}
|
||||
|
||||
|
|
|
@ -408,7 +408,7 @@ public class MetaWeblogBlog implements Blog {
|
|||
private int pos = 0;
|
||||
private boolean eod = false;
|
||||
private static final int BUFSIZE = 30;
|
||||
private List results = null;
|
||||
private List<Map<String, Object>> results = null;
|
||||
|
||||
/**
|
||||
* Iterator for looping over MetaWeblog API entries.
|
||||
|
@ -436,9 +436,7 @@ public class MetaWeblogBlog implements Blog {
|
|||
*/
|
||||
@Override
|
||||
public BlogEntry next() {
|
||||
@SuppressWarnings("unchecked")
|
||||
final Map<String, Object> entryHash = (Map<String, Object>) results.get(pos++);
|
||||
return new MetaWeblogEntry(MetaWeblogBlog.this, entryHash);
|
||||
return new MetaWeblogEntry(MetaWeblogBlog.this, results.get(pos++));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -451,8 +449,10 @@ public class MetaWeblogBlog implements Blog {
|
|||
private void getNextEntries() throws BlogClientException {
|
||||
final int requestSize = pos + BUFSIZE;
|
||||
try {
|
||||
final Object[] resultsArray = (Object[]) getXmlRpcClient().execute("metaWeblog.getRecentPosts",
|
||||
new Object[] { blogid, userName, password, new Integer(requestSize) });
|
||||
final Object[] params = new Object[] { blogid, userName, password, new Integer(requestSize) };
|
||||
final Object response = getXmlRpcClient().execute("metaWeblog.getRecentPosts", params);
|
||||
@SuppressWarnings("unchecked")
|
||||
final Map<String, Object>[] resultsArray = (Map<String, Object>[]) response;
|
||||
results = Arrays.asList(resultsArray);
|
||||
} catch (final Exception e) {
|
||||
throw new BlogClientException("ERROR: XML-RPC error getting entry", e);
|
||||
|
|
Loading…
Reference in a new issue