@Test public void getAttributeNamesTest() { List<String> attrList = Lists.newArrayList("id", "name"); UseEntity entity = new UseEntity(); final String[] attrs = entity.attributeNames(); final String[] attrs2 = entity.attributeNames(); assertEquals(attrs == attrs2, true); assertEquals(2, attrs.length); assertTrue(attrList.contains(attrs[0])); assertTrue(attrList.contains(attrs[1])); }
public String[] attributeNames() { if (names != null) { return names; } names = fields.keySet().toArray(new String[fields.size()]); return names; }
BaseEntity implements Cloneable, Serializable { public String[] attributeNames() { if (names != null) { return names; } names = fields.keySet().toArray(new String[fields.size()]); return names; } }
BaseEntity implements Cloneable, Serializable { public String[] attributeNames() { if (names != null) { return names; } names = fields.keySet().toArray(new String[fields.size()]); return names; }  }
BaseEntity implements Cloneable, Serializable { public String[] attributeNames() { if (names != null) { return names; } names = fields.keySet().toArray(new String[fields.size()]); return names; }  String[] attributeNames(); @SuppressWarnings("unchecked") T attributeValue(final String fieldName); T attributeValue(final String fieldName, final T defaultValue); void setAttributeValue(final String fieldName, final Object value); void setAttributeValue(final String fieldName, final Object value, final boolean isCase); Map<String, Object> beanToMap(); static T mapToBean(Map<String, Object> beanMap, Class<T> beanType); static List<T> mapToBeans(final List<Map<String, Object>> beanMaps, final Class<T> beanType); static Map<String, Method> paramMethods(Class<?> cls); static Map<String, Field> paramFields(Class<?> cls); Collection<Method> methods(); Collection<Field> fields(); @Override BaseEntity clone(); @Override String toString(); }
BaseEntity implements Cloneable, Serializable { public String[] attributeNames() { if (names != null) { return names; } names = fields.keySet().toArray(new String[fields.size()]); return names; }  String[] attributeNames(); @SuppressWarnings("unchecked") T attributeValue(final String fieldName); T attributeValue(final String fieldName, final T defaultValue); void setAttributeValue(final String fieldName, final Object value); void setAttributeValue(final String fieldName, final Object value, final boolean isCase); Map<String, Object> beanToMap(); static T mapToBean(Map<String, Object> beanMap, Class<T> beanType); static List<T> mapToBeans(final List<Map<String, Object>> beanMaps, final Class<T> beanType); static Map<String, Method> paramMethods(Class<?> cls); static Map<String, Field> paramFields(Class<?> cls); Collection<Method> methods(); Collection<Field> fields(); @Override BaseEntity clone(); @Override String toString();  }