4747import java .util .function .Consumer ;
4848
4949/**
50- * Factory for building {@link JsonSchema } instances. The factory should be
50+ * Factory for building {@link Schema } instances. The factory should be
5151 * typically be created using {@link #getInstance(Version, Consumer)} and
5252 * should be cached for performance.
5353 * <p>
@@ -196,7 +196,7 @@ public JsonSchemaFactory build() {
196196 private final SchemaMappers .Builder schemaMappersBuilder ;
197197 private final SchemaLoader schemaLoader ;
198198 private final ConcurrentMap <String , Dialect > metaSchemas ;
199- private final ConcurrentMap <SchemaLocation , JsonSchema > schemaCache = new ConcurrentHashMap <>();
199+ private final ConcurrentMap <SchemaLocation , Schema > schemaCache = new ConcurrentHashMap <>();
200200 private final boolean enableSchemaCache ;
201201 private final DialectRegistry metaSchemaFactory ;
202202
@@ -333,9 +333,9 @@ public static Builder builder(final JsonSchemaFactory blueprint) {
333333 * @param config the config to use
334334 * @return the schema
335335 */
336- protected JsonSchema newJsonSchema (final SchemaLocation schemaUri , final JsonNode schemaNode , final SchemaValidatorsConfig config ) {
336+ protected Schema newJsonSchema (final SchemaLocation schemaUri , final JsonNode schemaNode , final SchemaValidatorsConfig config ) {
337337 final ValidationContext validationContext = createValidationContext (schemaNode , config );
338- JsonSchema jsonSchema = doCreate (validationContext , getSchemaLocation (schemaUri ),
338+ Schema jsonSchema = doCreate (validationContext , getSchemaLocation (schemaUri ),
339339 new JsonNodePath (validationContext .getConfig ().getPathType ()), schemaNode , null , false );
340340 preload (jsonSchema , config );
341341 return jsonSchema ;
@@ -347,7 +347,7 @@ protected JsonSchema newJsonSchema(final SchemaLocation schemaUri, final JsonNod
347347 * @param jsonSchema the schema to preload
348348 * @param config containing the configuration option
349349 */
350- private void preload (JsonSchema jsonSchema , SchemaValidatorsConfig config ) {
350+ private void preload (Schema jsonSchema , SchemaValidatorsConfig config ) {
351351 if (config .isPreloadJsonSchema ()) {
352352 try {
353353 /*
@@ -365,12 +365,12 @@ private void preload(JsonSchema jsonSchema, SchemaValidatorsConfig config) {
365365 }
366366 }
367367
368- public JsonSchema create (ValidationContext validationContext , SchemaLocation schemaLocation , JsonNodePath evaluationPath , JsonNode schemaNode , JsonSchema parentSchema ) {
368+ public Schema create (ValidationContext validationContext , SchemaLocation schemaLocation , JsonNodePath evaluationPath , JsonNode schemaNode , Schema parentSchema ) {
369369 return doCreate (validationContext , schemaLocation , evaluationPath , schemaNode , parentSchema , false );
370370 }
371371
372- private JsonSchema doCreate (ValidationContext validationContext , SchemaLocation schemaLocation , JsonNodePath evaluationPath , JsonNode schemaNode , JsonSchema parentSchema , boolean suppressSubSchemaRetrieval ) {
373- return JsonSchema .from (withMetaSchema (validationContext , schemaNode ), schemaLocation , evaluationPath ,
372+ private Schema doCreate (ValidationContext validationContext , SchemaLocation schemaLocation , JsonNodePath evaluationPath , JsonNode schemaNode , Schema parentSchema , boolean suppressSubSchemaRetrieval ) {
373+ return Schema .from (withMetaSchema (validationContext , schemaNode ), schemaLocation , evaluationPath ,
374374 schemaNode , parentSchema , suppressSubSchemaRetrieval );
375375 }
376376
@@ -509,7 +509,7 @@ ObjectMapper getObjectMapper(InputFormat inputFormat) {
509509 * @param config the config
510510 * @return the schema
511511 */
512- public JsonSchema getSchema (final String schema , final SchemaValidatorsConfig config ) {
512+ public Schema getSchema (final String schema , final SchemaValidatorsConfig config ) {
513513 return getSchema (schema , InputFormat .JSON , config );
514514 }
515515
@@ -524,7 +524,7 @@ public JsonSchema getSchema(final String schema, final SchemaValidatorsConfig co
524524 * @param config the config
525525 * @return the schema
526526 */
527- public JsonSchema getSchema (final String schema , InputFormat inputFormat , final SchemaValidatorsConfig config ) {
527+ public Schema getSchema (final String schema , InputFormat inputFormat , final SchemaValidatorsConfig config ) {
528528 try {
529529 final JsonNode schemaNode = readTree (schema , inputFormat );
530530 return newJsonSchema (null , schemaNode , config );
@@ -544,7 +544,7 @@ public JsonSchema getSchema(final String schema, InputFormat inputFormat, final
544544 * @param schema the schema data as a string
545545 * @return the schema
546546 */
547- public JsonSchema getSchema (final String schema ) {
547+ public Schema getSchema (final String schema ) {
548548 return getSchema (schema , createSchemaValidatorsConfig ());
549549 }
550550
@@ -558,7 +558,7 @@ public JsonSchema getSchema(final String schema) {
558558 * @param inputFormat input format
559559 * @return the schema
560560 */
561- public JsonSchema getSchema (final String schema , InputFormat inputFormat ) {
561+ public Schema getSchema (final String schema , InputFormat inputFormat ) {
562562 return getSchema (schema , inputFormat , createSchemaValidatorsConfig ());
563563 }
564564
@@ -572,7 +572,7 @@ public JsonSchema getSchema(final String schema, InputFormat inputFormat) {
572572 * @param config the config
573573 * @return the schema
574574 */
575- public JsonSchema getSchema (final InputStream schemaStream , final SchemaValidatorsConfig config ) {
575+ public Schema getSchema (final InputStream schemaStream , final SchemaValidatorsConfig config ) {
576576 return getSchema (schemaStream , InputFormat .JSON , config );
577577 }
578578
@@ -587,7 +587,7 @@ public JsonSchema getSchema(final InputStream schemaStream, final SchemaValidato
587587 * @param config the config
588588 * @return the schema
589589 */
590- public JsonSchema getSchema (final InputStream schemaStream , InputFormat inputFormat , final SchemaValidatorsConfig config ) {
590+ public Schema getSchema (final InputStream schemaStream , InputFormat inputFormat , final SchemaValidatorsConfig config ) {
591591 try {
592592 final JsonNode schemaNode = readTree (schemaStream , inputFormat );
593593 return newJsonSchema (null , schemaNode , config );
@@ -606,7 +606,7 @@ public JsonSchema getSchema(final InputStream schemaStream, InputFormat inputFor
606606 * @param schemaStream the input stream with the schema data
607607 * @return the schema
608608 */
609- public JsonSchema getSchema (final InputStream schemaStream ) {
609+ public Schema getSchema (final InputStream schemaStream ) {
610610 return getSchema (schemaStream , createSchemaValidatorsConfig ());
611611 }
612612
@@ -617,8 +617,8 @@ public JsonSchema getSchema(final InputStream schemaStream) {
617617 * @param config the config
618618 * @return the schema
619619 */
620- public JsonSchema getSchema (final SchemaLocation schemaUri , final SchemaValidatorsConfig config ) {
621- JsonSchema schema = loadSchema (schemaUri , config );
620+ public Schema getSchema (final SchemaLocation schemaUri , final SchemaValidatorsConfig config ) {
621+ Schema schema = loadSchema (schemaUri , config );
622622 preload (schema , config );
623623 return schema ;
624624 }
@@ -630,12 +630,12 @@ public JsonSchema getSchema(final SchemaLocation schemaUri, final SchemaValidato
630630 * @param config the config
631631 * @return the schema
632632 */
633- public JsonSchema loadSchema (final SchemaLocation schemaUri , final SchemaValidatorsConfig config ) {
633+ public Schema loadSchema (final SchemaLocation schemaUri , final SchemaValidatorsConfig config ) {
634634 if (enableSchemaCache ) {
635635 // ConcurrentHashMap computeIfAbsent does not allow calls that result in a
636636 // recursive update to the map.
637637 // The getMapperSchema potentially recurses to call back to getSchema again
638- JsonSchema cachedUriSchema = schemaCache .get (schemaUri );
638+ Schema cachedUriSchema = schemaCache .get (schemaUri );
639639 if (cachedUriSchema == null ) {
640640 synchronized (this ) { // acquire lock on shared factory object to prevent deadlock
641641 cachedUriSchema = schemaCache .get (schemaUri );
@@ -670,7 +670,7 @@ protected SchemaValidatorsConfig createSchemaValidatorsConfig() {
670670 return new SchemaValidatorsConfig ();
671671 }
672672
673- protected JsonSchema getMappedSchema (final SchemaLocation schemaUri , SchemaValidatorsConfig config ) {
673+ protected Schema getMappedSchema (final SchemaLocation schemaUri , SchemaValidatorsConfig config ) {
674674 try (InputStream inputStream = this .schemaLoader .getSchema (schemaUri .getAbsoluteIri ()).getInputStream ()) {
675675 if (inputStream == null ) {
676676 throw new IOException ("Cannot load schema at " + schemaUri );
@@ -693,7 +693,7 @@ protected JsonSchema getMappedSchema(final SchemaLocation schemaUri, SchemaValid
693693 // Schema with fragment pointing to sub schema
694694 final ValidationContext validationContext = createValidationContext (schemaNode , config );
695695 SchemaLocation documentLocation = new SchemaLocation (schemaUri .getAbsoluteIri ());
696- JsonSchema document = doCreate (validationContext , documentLocation , evaluationPath , schemaNode , null , false );
696+ Schema document = doCreate (validationContext , documentLocation , evaluationPath , schemaNode , null , false );
697697 return document .getRefSchema (schemaUri .getFragment ());
698698 }
699699 } catch (IOException e ) {
@@ -710,7 +710,7 @@ protected JsonSchema getMappedSchema(final SchemaLocation schemaUri, SchemaValid
710710 * @param schemaUri the absolute IRI of the schema which can map to the retrieval IRI.
711711 * @return the schema
712712 */
713- public JsonSchema getSchema (final URI schemaUri ) {
713+ public Schema getSchema (final URI schemaUri ) {
714714 return getSchema (SchemaLocation .of (schemaUri .toString ()), createSchemaValidatorsConfig ());
715715 }
716716
@@ -722,7 +722,7 @@ public JsonSchema getSchema(final URI schemaUri) {
722722 * @param config the config
723723 * @return the schema
724724 */
725- public JsonSchema getSchema (final URI schemaUri , final JsonNode jsonNode , final SchemaValidatorsConfig config ) {
725+ public Schema getSchema (final URI schemaUri , final JsonNode jsonNode , final SchemaValidatorsConfig config ) {
726726 return newJsonSchema (SchemaLocation .of (schemaUri .toString ()), jsonNode , config );
727727 }
728728
@@ -733,7 +733,7 @@ public JsonSchema getSchema(final URI schemaUri, final JsonNode jsonNode, final
733733 * @param jsonNode the node
734734 * @return the schema
735735 */
736- public JsonSchema getSchema (final URI schemaUri , final JsonNode jsonNode ) {
736+ public Schema getSchema (final URI schemaUri , final JsonNode jsonNode ) {
737737 return newJsonSchema (SchemaLocation .of (schemaUri .toString ()), jsonNode , createSchemaValidatorsConfig ());
738738 }
739739
@@ -743,7 +743,7 @@ public JsonSchema getSchema(final URI schemaUri, final JsonNode jsonNode) {
743743 * @param schemaUri the absolute IRI of the schema which can map to the retrieval IRI.
744744 * @return the schema
745745 */
746- public JsonSchema getSchema (final SchemaLocation schemaUri ) {
746+ public Schema getSchema (final SchemaLocation schemaUri ) {
747747 return getSchema (schemaUri , createSchemaValidatorsConfig ());
748748 }
749749
@@ -755,7 +755,7 @@ public JsonSchema getSchema(final SchemaLocation schemaUri) {
755755 * @param config the config
756756 * @return the schema
757757 */
758- public JsonSchema getSchema (final SchemaLocation schemaUri , final JsonNode jsonNode , final SchemaValidatorsConfig config ) {
758+ public Schema getSchema (final SchemaLocation schemaUri , final JsonNode jsonNode , final SchemaValidatorsConfig config ) {
759759 return newJsonSchema (schemaUri , jsonNode , config );
760760 }
761761
@@ -766,7 +766,7 @@ public JsonSchema getSchema(final SchemaLocation schemaUri, final JsonNode jsonN
766766 * @param jsonNode the node
767767 * @return the schema
768768 */
769- public JsonSchema getSchema (final SchemaLocation schemaUri , final JsonNode jsonNode ) {
769+ public Schema getSchema (final SchemaLocation schemaUri , final JsonNode jsonNode ) {
770770 return newJsonSchema (schemaUri , jsonNode , createSchemaValidatorsConfig ());
771771 }
772772
@@ -783,7 +783,7 @@ public JsonSchema getSchema(final SchemaLocation schemaUri, final JsonNode jsonN
783783 * @param config the config
784784 * @return the schema
785785 */
786- public JsonSchema getSchema (final JsonNode jsonNode , final SchemaValidatorsConfig config ) {
786+ public Schema getSchema (final JsonNode jsonNode , final SchemaValidatorsConfig config ) {
787787 return newJsonSchema (null , jsonNode , config );
788788 }
789789
@@ -799,7 +799,7 @@ public JsonSchema getSchema(final JsonNode jsonNode, final SchemaValidatorsConfi
799799 * @param jsonNode the node
800800 * @return the schema
801801 */
802- public JsonSchema getSchema (final JsonNode jsonNode ) {
802+ public Schema getSchema (final JsonNode jsonNode ) {
803803 return newJsonSchema (null , jsonNode , createSchemaValidatorsConfig ());
804804 }
805805
0 commit comments