JcrValue implements javax.jcr.Value { long getLength() throws RepositoryException { if (value == null) return 0L; if (type == PropertyType.BINARY) { return factories().getBinaryFactory().create(value).getSize(); } return getString().length(); } JcrValue( ValueFactories factories,
              int type,
              Object value );   JcrValue( ValueFactories factories,
              Value value ); @Override boolean getBoolean(); @Override Calendar getDate(); @Override BigDecimal getDecimal(); @Override double getDouble(); @Override long getLong(); @Override @SuppressWarnings("deprecation") InputStream getStream(); @Override BinaryValue getBinary(); @Override String getString(); @Override int getType(); @Override int hashCode(); @Override boolean equals( Object obj ); @Override String toString();  }
@Test public void shouldProvideLength() throws Exception { assertThat(new JcrValue(factories, PropertyType.STRING, "test").getLength(), is(4L)); assertThat(new JcrValue(factories, PropertyType.BINARY, "test").getLength(), is(4L)); }