- All Implemented Interfaces:
Serializable,Cloneable,Map<String,,Object> org.refcodes.mixin.AliasAccessor,org.refcodes.mixin.ChildrenAccessor<Schema[]>,org.refcodes.mixin.DescriptionAccessor,org.refcodes.mixin.TypeAccessor
public class Schema
extends HashMap<String,Object>
implements org.refcodes.mixin.ChildrenAccessor<Schema[]>, org.refcodes.mixin.TypeAccessor, org.refcodes.mixin.AliasAccessor, org.refcodes.mixin.DescriptionAccessor
A
Schema describes a nested data structure (having 0..n
Schema children) whilst not being the data structure itself. A
documentation in JSON or XML notation can be produced from a Schema
instance for debugging or diagnostic purposes (see JsonVisitor as
well as XmlVisitor) by invoking the visit(SchemaVisitor)
method (also custom SchemaVisitor classes my be programmed).For
description purposes, any descriptive attribute can be added as a key with
the according value, as a Schema extends the Map interface. The
Schema is a useful base class when implementing a package's
Schema type. By default it's toString() method produces a
JSON alike String representation of this Schema instances
alongside its children by uses the JsonVisitor type applied to the
visit(SchemaVisitor) method.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K, V> Nested classes/interfaces inherited from interface org.refcodes.mixin.AliasAccessor
org.refcodes.mixin.AliasAccessor.AliasBuilder<B extends org.refcodes.mixin.AliasAccessor.AliasBuilder<B>>, org.refcodes.mixin.AliasAccessor.AliasMutator, org.refcodes.mixin.AliasAccessor.AliasPropertyNested classes/interfaces inherited from interface org.refcodes.mixin.ChildrenAccessor
org.refcodes.mixin.ChildrenAccessor.ChildrenBuilder<T,B extends org.refcodes.mixin.ChildrenAccessor.ChildrenBuilder<T, B>>, org.refcodes.mixin.ChildrenAccessor.ChildrenMutator<T>, org.refcodes.mixin.ChildrenAccessor.ChildrenProperty<T> Nested classes/interfaces inherited from interface org.refcodes.mixin.DescriptionAccessor
org.refcodes.mixin.DescriptionAccessor.DescriptionBuilder<B extends org.refcodes.mixin.DescriptionAccessor.DescriptionBuilder<B>>, org.refcodes.mixin.DescriptionAccessor.DescriptionMutator, org.refcodes.mixin.DescriptionAccessor.DescriptionPropertyNested classes/interfaces inherited from interface org.refcodes.mixin.TypeAccessor
org.refcodes.mixin.TypeAccessor.TypeBuilder<T,B extends org.refcodes.mixin.TypeAccessor.TypeBuilder<T, B>>, org.refcodes.mixin.TypeAccessor.TypeMutator<T>, org.refcodes.mixin.TypeAccessor.TypeProperty<T> -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstructs aSchemawith the provided arguments.Constructs aSchemawith the provided arguments.Constructs aSchemawith the provided arguments.Constructs aSchemawith the provided arguments.Constructs aSchemawith the provided arguments.Constructs aSchemawith the provided arguments. -
Method Summary
Modifier and TypeMethodDescriptiongetAlias()Schema[]Class<?> getType()toString()Uses theJsonVisitortype applied to thevisit(SchemaVisitor)method to produce a JSON alikeStringrepresentation of thisSchemainstances alongside its children.<T> Tvisit(SchemaVisitor<T> aVisitor) Visits thisSchemainstance, the providedSchemaVisitorvisitor is invoked with the result's of theSchemainstance's children (as ofvisit(SchemaVisitor)and thisSchemainstance to produce a result.Methods inherited from class java.util.HashMap
clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, newHashMap, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, valuesMethods inherited from class java.util.AbstractMap
equals, hashCode
-
Field Details
-
ALIAS
-
COMMENT
-
DESCRIPTION
-
EXCEPTION
-
KEY
-
TYPE
-
VALUE
-
VERBOSE
-
-
Constructor Details
-
Schema
-
Schema
-
Schema
Constructs aSchemawith the provided arguments. -
Schema
Constructs aSchemawith the provided arguments. -
Schema
Constructs aSchemawith the provided arguments.- Parameters:
aAlias- The alias (name) of the schema described by theSchemaproviding type.aType- The type providing the thisSchemainstance.aDescription- The description of the schema described by theSchemaproviding type.aChildren- The children'sSchemadescriptions representing part of theSchemaproviding type.
-
Schema
-
Schema
-
Schema
-
-
Method Details
-
getAlias
- Specified by:
getAliasin interfaceorg.refcodes.mixin.AliasAccessor
-
getType
- Specified by:
getTypein interfaceorg.refcodes.mixin.TypeAccessor
-
getDescription
- Specified by:
getDescriptionin interfaceorg.refcodes.mixin.DescriptionAccessor
-
getChildren
-
visit
Visits thisSchemainstance, the providedSchemaVisitorvisitor is invoked with the result's of theSchemainstance's children (as ofvisit(SchemaVisitor)and thisSchemainstance to produce a result. Therefore this method visits (invokes theSchemaVisitor.visit(Schema, java.util.Collection)method for) the leaves first, traversing down till the rootSchemainstance (the one where thevisit(SchemaVisitor)method was initially called).- Type Parameters:
T- The type of the value which the visitor produces.- Parameters:
aVisitor- TheSchemaVisitorvisitor to traverse thisSchemainstance.- Returns:
- The according result produced by the
SchemaVisitorinstance.
-
toString
Uses theJsonVisitortype applied to thevisit(SchemaVisitor)method to produce a JSON alikeStringrepresentation of thisSchemainstances alongside its children.- Overrides:
toStringin classAbstractMap<String,Object>
-