PropInfo { public PropertyState asPropertyState(@NotNull PropertyDefinition propertyDefinition) throws RepositoryException { List<Value> vs = getValues(getTargetType(propertyDefinition)); PropertyState propertyState; if (vs.size() == 1 && !propertyDefinition.isMultiple()) { propertyState = PropertyStates.createProperty(name, vs.get(0)); } else { propertyState = PropertyStates.createProperty(name, vs); } return propertyState; } PropInfo(@Nullable String name, int type, @NotNull TextValue value);  PropInfo(@Nullable String name, int type, @NotNull List<? extends TextValue> values);  PropInfo(@Nullable String name, int type,
                    @NotNull List<? extends TextValue> values,
                    @NotNull MultipleStatus multipleStatus); void dispose(); int getTargetType(PropertyDefinition def); @Nullable String getName(); int getType(); boolean isUnknownMultiple(); @NotNull TextValue getTextValue(); @NotNull List<? extends TextValue> getTextValues(); @NotNull Value getValue(int targetType); @NotNull List<Value> getValues(int targetType); PropertyState asPropertyState(@NotNull PropertyDefinition propertyDefinition);  }
@Test public void testAsPropertyStateSingleList() throws Exception { PropInfo propInfo = new PropInfo("strings", PropertyType.STRING, ImmutableList.of(mockTextValue("a", PropertyType.STRING)), PropInfo.MultipleStatus.MULTIPLE); PropertyState ps = propInfo.asPropertyState(mockPropDef(PropertyType.STRING, true)); assertTrue(ps.isArray()); assertEquals(1, ps.count()); }
@Test public void testAsPropertyStateMultiples() throws Exception { PropInfo propInfo = new PropInfo("strings", PropertyType.STRING, ImmutableList.of(mockTextValue("a", PropertyType.STRING), mockTextValue("b", PropertyType.STRING))); PropertyState ps = propInfo.asPropertyState(mockPropDef(PropertyType.STRING, true)); assertTrue(ps.isArray()); assertEquals(2, ps.count()); }