[
https://issues.apache.org/jira/browse/FOP-2788?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
simon steiner updated FOP-2788:
-------------------------------
Summary: [PATCH] Inconsistent method names (was: Inconsistent method names)
> [PATCH] Inconsistent method names
> ---------------------------------
>
> Key: FOP-2788
> URL: https://issues.apache.org/jira/browse/FOP-2788
> Project: FOP
> Issue Type: Improvement
> Affects Versions: trunk
> Reporter: KuiLIU
> Priority: Major
> Attachments: rename-methods.patch
>
>
> The method closes a stream, but its name is "writetoStream". The method name
> "closeStream" should be better.
> {code:java}
> /**
> * Tells the streamer to write
> *
> * @throws IOException thrown if an I/O exception of some sort has
> occurred.
> */
> public void writeToStream() throws IOException {
> streamer.close();
> }
> {code}
> The method body code seems to add a new attribute to the parameter "handler".
> Identifier "addSAX" should be better than "toSAX" since 'toSAX' is prone to
> convert one thing to another.
> {code:java}
> /** {@inheritDoc} */
> public void toSAX(ContentHandler handler) throws SAXException {
> AttributesImpl atts = new AttributesImpl();
> if (name != null && name.length() > 0) {
> atts.addAttribute("", ATT_NAME, ATT_NAME, "CDATA", name);
> }
> if (this.src != null) {
> atts.addAttribute("", ATT_SRC, ATT_SRC, "CDATA",
> this.src.toASCIIString());
> }
> handler.startElement(CATEGORY, elementName, elementName, atts);
> handler.endElement(CATEGORY, elementName, elementName);
> }
> {code}
> The method just returns one field "params" of the current class, thus method
> name "getParams" should be better than "build".
> {code:java}
> /**
> * Returns the accumulated parameter map.
> * @return the accumulated parameter map
> */
> public Map<String, Object> build() {
> return this.params;
> }
> {code}
> The method seems to find an appropriate "Property" related to the
> fo.getNameId().
> Thus, identifier "find" should be better than "make".
> {code:java}
> /**
> * Set default precedence according to the parent FObj
> *
> * {@inheritDoc}
> */
> public Property make(PropertyList propertyList) throws PropertyException
> {
> FObj fo = propertyList.getFObj();
> switch (fo.getNameId()) {
> case Constants.FO_TABLE:
> return num6;
> case Constants.FO_TABLE_CELL:
> return num5;
> case Constants.FO_TABLE_COLUMN:
> return num4;
> case Constants.FO_TABLE_ROW:
> return num3;
> case Constants.FO_TABLE_BODY:
> return num2;
> case Constants.FO_TABLE_HEADER:
> return num1;
> case Constants.FO_TABLE_FOOTER:
> return num0;
> default:
> return null;
> }
> }
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)