@Test public void typeNamePropertyResultAttribute() { ResultAttribute typeAttr = ResultAttributes.forName("typeName.type"); assertThat(typeAttr.getName()).isEqualTo("typeName.type"); String type = typeAttr.get(result); assertThat(type).isEqualTo("Type1"); ResultAttribute nameAttr = ResultAttributes.forName("typeName.name"); assertThat(nameAttr.getName()).isEqualTo("typeName.name"); String name = nameAttr.get(result); assertThat(name).isEqualTo("Name1"); ResultAttribute notExistAttr = ResultAttributes.forName("typeName.notExist"); assertThat(notExistAttr.getName()).isEqualTo("typeName.notExist"); String notExist = notExistAttr.get(result); assertThat(notExist).isNull(); try { ResultAttributes.forName("notExist"); fail("Exception expected"); } catch (IllegalArgumentException e) { } }
public static ResultAttribute forName(@Nonnull String attributeName) { if (attributeName.startsWith(TypeNameProperty.PREFIX)) { return new TypeNameProperty(attributeName.substring(TypeNameProperty.PREFIX.length())); } String[] split = StringUtils.splitByCharacterTypeCamelCase(attributeName); StringBuilder sb = new StringBuilder(split[0].toUpperCase()).append("_").append(split[1].toUpperCase()); return valueOf(sb.toString()); }
ResultAttributes { public static ResultAttribute forName(@Nonnull String attributeName) { if (attributeName.startsWith(TypeNameProperty.PREFIX)) { return new TypeNameProperty(attributeName.substring(TypeNameProperty.PREFIX.length())); } String[] split = StringUtils.splitByCharacterTypeCamelCase(attributeName); StringBuilder sb = new StringBuilder(split[0].toUpperCase()).append("_").append(split[1].toUpperCase()); return valueOf(sb.toString()); } }
ResultAttributes { public static ResultAttribute forName(@Nonnull String attributeName) { if (attributeName.startsWith(TypeNameProperty.PREFIX)) { return new TypeNameProperty(attributeName.substring(TypeNameProperty.PREFIX.length())); } String[] split = StringUtils.splitByCharacterTypeCamelCase(attributeName); StringBuilder sb = new StringBuilder(split[0].toUpperCase()).append("_").append(split[1].toUpperCase()); return valueOf(sb.toString()); } private  ResultAttributes(); }
ResultAttributes { public static ResultAttribute forName(@Nonnull String attributeName) { if (attributeName.startsWith(TypeNameProperty.PREFIX)) { return new TypeNameProperty(attributeName.substring(TypeNameProperty.PREFIX.length())); } String[] split = StringUtils.splitByCharacterTypeCamelCase(attributeName); StringBuilder sb = new StringBuilder(split[0].toUpperCase()).append("_").append(split[1].toUpperCase()); return valueOf(sb.toString()); } private  ResultAttributes(); static ResultAttribute forName(@Nonnull String attributeName); static ImmutableSet<ResultAttribute> forNames(@Nonnull Collection<String> attributeNames); static ResultAttribute valueOf(@Nonnull String attributeName); static List<ResultAttribute> values(); }
ResultAttributes { public static ResultAttribute forName(@Nonnull String attributeName) { if (attributeName.startsWith(TypeNameProperty.PREFIX)) { return new TypeNameProperty(attributeName.substring(TypeNameProperty.PREFIX.length())); } String[] split = StringUtils.splitByCharacterTypeCamelCase(attributeName); StringBuilder sb = new StringBuilder(split[0].toUpperCase()).append("_").append(split[1].toUpperCase()); return valueOf(sb.toString()); } private  ResultAttributes(); static ResultAttribute forName(@Nonnull String attributeName); static ImmutableSet<ResultAttribute> forNames(@Nonnull Collection<String> attributeNames); static ResultAttribute valueOf(@Nonnull String attributeName); static List<ResultAttribute> values(); static final ResultAttribute TYPE_NAME; static final ResultAttribute OBJ_DOMAIN; static final ResultAttribute CLASS_NAME; static final ResultAttribute ATTRIBUTE_NAME; }