- From: Jean-Guilhem Rouel via cvs-syncmail <cvsmail@w3.org>
- Date: Tue, 11 Aug 2009 13:43:03 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2006/unicorn/org/w3c/unicorn/contract In directory hutz:/tmp/cvs-serv6157/org/w3c/unicorn/contract Modified Files: CallMethod.java InputMethod.java Observer.java WADLUnmarshaller.java CallParameter.java WADLUnmarshallerXPath.java Log Message: Code cleanup Index: Observer.java =================================================================== RCS file: /sources/public/2006/unicorn/org/w3c/unicorn/contract/Observer.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- Observer.java 19 Sep 2008 18:57:11 -0000 1.6 +++ Observer.java 11 Aug 2009 13:43:00 -0000 1.7 @@ -71,7 +71,7 @@ */ private Map<EnumInputMethod, InputMethod> mapOfInputMethod; - private List<MimeType> supportedMimeTypes; + private List<MimeType> supportedMimeTypes; /** * Creates the observer @@ -150,8 +150,9 @@ /** * Prints the object */ + @Override public String toString() { - final int sbSize = 1000; + final int sbSize = 1000; final String sVariableSeparator = "\n"; final StringBuffer aStringBuffer = new StringBuffer(sbSize); @@ -176,7 +177,7 @@ .append("]"); return aStringBuffer.toString(); - } + } public final Map<EnumInputMethod, InputMethod> getMapOfInputMethod() { return this.mapOfInputMethod; @@ -201,25 +202,25 @@ return this.mapOfInputMethod.get(aEnumInputMethod); } - public InputMethod getBestInputMethod(final EnumInputMethod preferred) { - // First try to get what caller would like - InputMethod im = getInputMethod(preferred); - if(im != null) { - return im; - } + public InputMethod getBestInputMethod(final EnumInputMethod preferred) { + // First try to get what caller would like + InputMethod im = getInputMethod(preferred); + if (im != null) { + return im; + } - // If not possible, grab another one - for (final EnumInputMethod aEIM : EnumInputMethod.values()) { - im = getInputMethod(aEIM); - if(im != null) { - return im; - } - } + // If not possible, grab another one + for (final EnumInputMethod aEIM : EnumInputMethod.values()) { + im = getInputMethod(aEIM); + if (im != null) { + return im; + } + } - // we should not arrive here (that would mean an observer doesn't - // have any input method - return null; - } + // we should not arrive here (that would mean an observer doesn't + // have any input method + return null; + } public CallMethod getCallMethod(final EnumInputMethod aEnumInputMethod) { return this.getInputMethod(aEnumInputMethod).getCallMethod(); @@ -230,29 +231,31 @@ } /** - * Returns <code>true</code> if the mime-type is supported - * by this observer + * Returns <code>true</code> if the mime-type is supported by this + * observer * * @param aMimeType * mime-type to check * @return whether or not the mime-type is handled */ - public boolean canHandleMimeType(final MimeType aMimeType) { - //return this.supportedMimeTypes.contains(aMimeType); - // equals and thus contains doesn't work :( - for (final MimeType mt : this.supportedMimeTypes) { - if(mt.match(aMimeType)) return true; - } - return false; + public boolean canHandleMimeType(final MimeType aMimeType) { + // return this.supportedMimeTypes.contains(aMimeType); + // equals and thus contains doesn't work :( + for (final MimeType mt : this.supportedMimeTypes) { + if (mt.match(aMimeType)) { + return true; + } + } + return false; } - public void setSupportedMimeTypes(List<MimeType> mimeTypes) { - this.supportedMimeTypes = mimeTypes; - } + public void setSupportedMimeTypes(List<MimeType> mimeTypes) { + this.supportedMimeTypes = mimeTypes; + } - public List<MimeType> getSupportedMimeTypes() { - return this.supportedMimeTypes; - } + public List<MimeType> getSupportedMimeTypes() { + return this.supportedMimeTypes; + } public String getResponseType() { return responseType; Index: CallParameter.java =================================================================== RCS file: /sources/public/2006/unicorn/org/w3c/unicorn/contract/CallParameter.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- CallParameter.java 17 Jun 2008 13:41:12 -0000 1.4 +++ CallParameter.java 11 Aug 2009 13:43:00 -0000 1.5 @@ -236,6 +236,7 @@ /** * Prints the object */ + @Override public String toString() { final int iSize = 1000; final String sVariableSeparator = "\n"; Index: CallMethod.java =================================================================== RCS file: /sources/public/2006/unicorn/org/w3c/unicorn/contract/CallMethod.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- CallMethod.java 17 Jun 2008 14:09:50 -0000 1.3 +++ CallMethod.java 11 Aug 2009 13:43:00 -0000 1.4 @@ -150,6 +150,7 @@ /** * Print the object */ + @Override public String toString() { final int iSize = 1000; final String sVariableSeparator = "\n"; Index: WADLUnmarshallerXPath.java =================================================================== RCS file: /sources/public/2006/unicorn/org/w3c/unicorn/contract/WADLUnmarshallerXPath.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- WADLUnmarshallerXPath.java 19 Sep 2008 18:57:12 -0000 1.9 +++ WADLUnmarshallerXPath.java 11 Aug 2009 13:43:01 -0000 1.10 @@ -113,7 +113,7 @@ WADLUnmarshallerXPath.logger.trace("Constructor"); this.aDocumentBuilderFactory = DocumentBuilderFactory.newInstance(); - + this.aDocumentBuilder = this.aDocumentBuilderFactory .newDocumentBuilder(); this.aXPath = new XPathFactoryImpl().newXPath(); @@ -123,7 +123,8 @@ /** * Get the document from an URL - * @throws SAXException + * + * @throws SAXException */ public void addURL(final URL aURL) throws IOException { @@ -135,7 +136,8 @@ try { this.aDocument = this.aDocumentBuilder.parse(aURL.openStream()); } catch (SAXException e) { - WADLUnmarshallerXPath.logger.error("Parsing error with SAX in WADLUnmarshaller",e); + WADLUnmarshallerXPath.logger.error( + "Parsing error with SAX in WADLUnmarshaller", e); e.printStackTrace(); } @@ -151,7 +153,7 @@ MimeTypeParseException { WADLUnmarshallerXPath.logger.trace("unmarshal"); this.parseDocsHeader(); - this.parseMethods(); + this.parseMethods(); } /** @@ -333,10 +335,11 @@ if ("title".equals(firstAttrName)) { String firstAttrValue = childMethod.getAttributes() .item(0).getNodeValue(); - if ("inputMethod".equals(firstAttrValue)) + if ("inputMethod".equals(firstAttrValue)) { sInputMethod = childMethod.getTextContent(); - else if ("inputParamName".equals(firstAttrValue)) + } else if ("inputParamName".equals(firstAttrValue)) { sInputParamName = childMethod.getTextContent(); + } } } } @@ -430,9 +433,9 @@ return responseType; } - public List<MimeType> getSupportedMimeTypes() { - return this.listOfMimeType; - } + public List<MimeType> getSupportedMimeTypes() { + return this.listOfMimeType; + } /** * Main method of the class only for testing purpose Index: InputMethod.java =================================================================== RCS file: /sources/public/2006/unicorn/org/w3c/unicorn/contract/InputMethod.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- InputMethod.java 19 Sep 2008 18:57:11 -0000 1.5 +++ InputMethod.java 11 Aug 2009 13:43:00 -0000 1.6 @@ -4,9 +4,6 @@ // Please first read the full copyright statement in file COPYRIGHT.html package org.w3c.unicorn.contract; -import java.util.ArrayList; -import java.util.List; - /** * @author Damien LEROY * @@ -23,25 +20,25 @@ */ private CallParameter aCallParameter = null; - private EnumInputMethod method; + private EnumInputMethod method; - public InputMethod(EnumInputMethod method) { - this.method = method; - } + public InputMethod(EnumInputMethod method) { + this.method = method; + } - public InputMethod(String method) { - if ("URI".equals(method)) { - this.method = EnumInputMethod.URI; - } else if ("UPLOAD".equals(method)) { - this.method = EnumInputMethod.UPLOAD; - } else if ("DIRECT".equals(method)) { - this.method = EnumInputMethod.DIRECT; - } - } + public InputMethod(String method) { + if ("URI".equals(method)) { + this.method = EnumInputMethod.URI; + } else if ("UPLOAD".equals(method)) { + this.method = EnumInputMethod.UPLOAD; + } else if ("DIRECT".equals(method)) { + this.method = EnumInputMethod.DIRECT; + } + } - public EnumInputMethod getMethod() { - return this.method; - } + public EnumInputMethod getMethod() { + return this.method; + } /** * Get the current calling method @@ -95,6 +92,7 @@ /** * Prints the object */ + @Override public final String toString() { final int iStringBufferSize = 1000; final String sVariableSeparator = "\n"; Index: WADLUnmarshaller.java =================================================================== RCS file: /sources/public/2006/unicorn/org/w3c/unicorn/contract/WADLUnmarshaller.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- WADLUnmarshaller.java 19 Sep 2008 18:57:11 -0000 1.5 +++ WADLUnmarshaller.java 11 Aug 2009 13:43:00 -0000 1.6 @@ -7,11 +7,11 @@ import java.util.List; import java.util.Map; +import javax.activation.MimeType; + import org.w3c.unicorn.util.LocalizedString; import org.w3c.unicorn.util.Unmarshaller; -import javax.activation.MimeType; - /** * WADLUnmarshallerXPath<br /> * Created: May 24, 2006 12:34:38 PM<br /> @@ -39,6 +39,6 @@ public String getResponseType(); - public List<MimeType> getSupportedMimeTypes(); + public List<MimeType> getSupportedMimeTypes(); }
Received on Tuesday, 11 August 2009 13:43:42 UTC