@Test public void testQValueString() throws Exception { final Name ntFoo = NameFactoryImpl.getInstance().create(Name.NS_NT_URI, "foo"); final QValue fooValue = QValueFactoryImpl.getInstance().create(ntFoo); assertEquals("fooValue name is name", "nt:foo", JsonCnd.qValueString(fooValue, resolver)); final Path pathFoo = PathFactoryImpl.getInstance().create(new Path.Element[]{ PathFactoryImpl.getInstance().getRootElement(), PathFactoryImpl.getInstance().createElement(ntFoo), PathFactoryImpl.getInstance().createElement(ntFoo) }); final QValue fooPathValue = QValueFactoryImpl.getInstance().create(pathFoo); assertEquals("path equals path", "/nt:foo/nt:foo", JsonCnd.qValueString(fooPathValue, resolver)); final QValue stringValue = QValueFactoryImpl.getInstance().create("some string", PropertyType.STRING); assertEquals("string equals string", "some string", JsonCnd.qValueString(stringValue, resolver)); }
static String qValueString(final @NotNull QValue qValue, final @NotNull NamePathResolver resolver) throws RepositoryException { switch (qValue.getType()) { case PropertyType.NAME: return resolver.getJCRName(qValue.getName()); case PropertyType.PATH: return resolver.getJCRPath(qValue.getPath()); default: return qValue.getString(); } }
JsonCnd { static String qValueString(final @NotNull QValue qValue, final @NotNull NamePathResolver resolver) throws RepositoryException { switch (qValue.getType()) { case PropertyType.NAME: return resolver.getJCRName(qValue.getName()); case PropertyType.PATH: return resolver.getJCRPath(qValue.getPath()); default: return qValue.getString(); } } }
JsonCnd { static String qValueString(final @NotNull QValue qValue, final @NotNull NamePathResolver resolver) throws RepositoryException { switch (qValue.getType()) { case PropertyType.NAME: return resolver.getJCRName(qValue.getName()); case PropertyType.PATH: return resolver.getJCRPath(qValue.getPath()); default: return qValue.getString(); } } private  JsonCnd(); }
JsonCnd { static String qValueString(final @NotNull QValue qValue, final @NotNull NamePathResolver resolver) throws RepositoryException { switch (qValue.getType()) { case PropertyType.NAME: return resolver.getJCRName(qValue.getName()); case PropertyType.PATH: return resolver.getJCRPath(qValue.getPath()); default: return qValue.getString(); } } private  JsonCnd(); @SuppressWarnings("WeakerAccess") static List<QNodeTypeDefinition> getQTypesFromJson(final @NotNull JsonObject json,
                      final @NotNull NamespaceMapping mapping); @SuppressWarnings("WeakerAccess") static List<PrivilegeDefinition> getPrivilegesFromJson(final @NotNull JsonValue json,
                          final @NotNull NamespaceMapping mapping); static JsonObject toJson(final @NotNull List<QNodeTypeDefinition> ntDefs,
                                    final @NotNull NamespaceMapping mapping); static JsonValue privilegesToJson(final @NotNull List<PrivilegeDefinition> privDefs,
                                             final @NotNull NamespaceMapping mapping); static List<JcrNs> toJcrNsList(final @NotNull NamespaceMapping mapping,
                                          final @NotNull NamespaceMappingRequest request); static Function<NodeTypeDefinition, QNodeTypeDefinition> adaptToQ(final @NotNull Session session); static Stream<Name> namedBy(final @NotNull QNodeTypeDefinition def); static Stream<Name> namedBy(final @NotNull PrivilegeDefinition def); static NamespaceMapping toNamespaceMapping(final List<JcrNs> jcrNsList); static @NotNull Stream<String> streamNsPrefix(final @NotNull String name); static List<Result<NodeTypeSet>> readNodeTypes(final @NotNull NamespaceMapping mapping,
                                                          final @NotNull List<URL> cndUrls); static NodeTypeSet aggregateNodeTypes(final @NotNull NamespaceMapping mapping,
                                                 final @NotNull List<NodeTypeSet> nodeTypeSets); }
JsonCnd { static String qValueString(final @NotNull QValue qValue, final @NotNull NamePathResolver resolver) throws RepositoryException { switch (qValue.getType()) { case PropertyType.NAME: return resolver.getJCRName(qValue.getName()); case PropertyType.PATH: return resolver.getJCRPath(qValue.getPath()); default: return qValue.getString(); } } private  JsonCnd(); @SuppressWarnings("WeakerAccess") static List<QNodeTypeDefinition> getQTypesFromJson(final @NotNull JsonObject json,
                      final @NotNull NamespaceMapping mapping); @SuppressWarnings("WeakerAccess") static List<PrivilegeDefinition> getPrivilegesFromJson(final @NotNull JsonValue json,
                          final @NotNull NamespaceMapping mapping); static JsonObject toJson(final @NotNull List<QNodeTypeDefinition> ntDefs,
                                    final @NotNull NamespaceMapping mapping); static JsonValue privilegesToJson(final @NotNull List<PrivilegeDefinition> privDefs,
                                             final @NotNull NamespaceMapping mapping); static List<JcrNs> toJcrNsList(final @NotNull NamespaceMapping mapping,
                                          final @NotNull NamespaceMappingRequest request); static Function<NodeTypeDefinition, QNodeTypeDefinition> adaptToQ(final @NotNull Session session); static Stream<Name> namedBy(final @NotNull QNodeTypeDefinition def); static Stream<Name> namedBy(final @NotNull PrivilegeDefinition def); static NamespaceMapping toNamespaceMapping(final List<JcrNs> jcrNsList); static @NotNull Stream<String> streamNsPrefix(final @NotNull String name); static List<Result<NodeTypeSet>> readNodeTypes(final @NotNull NamespaceMapping mapping,
                                                          final @NotNull List<URL> cndUrls); static NodeTypeSet aggregateNodeTypes(final @NotNull NamespaceMapping mapping,
                                                 final @NotNull List<NodeTypeSet> nodeTypeSets); static final NamespaceMapping BUILTIN_MAPPINGS; static final List<String> BUILTIN_NODETYPES; static final List<String> BUILTIN_PRIVILEGES; }