I guess this is better?
This commit is contained in:
parent
7065b0d9dc
commit
38bd8f7f3e
|
|
@ -19,9 +19,10 @@
|
|||
package com.puppycrawl.tools.checkstyle;
|
||||
|
||||
import com.puppycrawl.tools.checkstyle.api.Context;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* A default implementation of the Context interface.
|
||||
|
|
@ -39,10 +40,9 @@ public final class DefaultContext implements Context
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public String[] getAttributeNames()
|
||||
public Collection<String> getAttributeNames()
|
||||
{
|
||||
final Set<String> keySet = mEntries.keySet();
|
||||
return keySet.toArray(new String[keySet.size()]);
|
||||
return Collections.unmodifiableCollection(mEntries.keySet());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ package com.puppycrawl.tools.checkstyle.api;
|
|||
import java.beans.PropertyDescriptor;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.StringTokenizer;
|
||||
import org.apache.commons.beanutils.BeanUtilsBean;
|
||||
|
|
@ -219,7 +220,7 @@ public class AutomaticBean
|
|||
final BeanUtilsBean beanUtils = createBeanUtilsBean();
|
||||
|
||||
// TODO: debug log messages
|
||||
final String[] attributes = aContext.getAttributeNames();
|
||||
final Collection<String> attributes = aContext.getAttributeNames();
|
||||
|
||||
for (final String key : attributes) {
|
||||
final Object value = aContext.get(key);
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
package com.puppycrawl.tools.checkstyle.api;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* A context to be used in subcomponents. The general idea of
|
||||
* Context/Contextualizable was taken from <a target="_top"
|
||||
|
|
@ -38,5 +40,5 @@ public interface Context
|
|||
* Returns the names of all atttributes of this context.
|
||||
* @return the names of all atttributes of this context.
|
||||
*/
|
||||
String[] getAttributeNames();
|
||||
Collection<String> getAttributeNames();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue