@Override public Optional<ValueType> describe( PropertyPath path, TypeContext typeContext, DescribeContext context) { if (!applies(path, typeContext)) { return Optional.empty(); } MappingResolver mappingResolver = context.getMappingResolver(); Map<String, TypeDescriptor> typesByAlias = new LinkedHashMap<>(); TypeDescriptor type = typeContext.type; String alias = Check.notNull(mappingResolver.alias(type).value, "alias"); typesByAlias.put(alias, type); registerSubclasses(mappingResolver, typesByAlias, mappingResolver.subclasses(type)); ObjectTypeMapping objectTypeMapping = new ObjectTypeMapping(typesByAlias); return objectTypeMapping.describe(path, typeContext, context); }
public static ValueType describeReference( PropertyPath path, TypeDescriptor type, String alias, DescribeContext context) { IdentifiableType identifiableType = (IdentifiableType) context.describeNow(targetPath(alias).index(""), type); return new ReferenceType(identifiableType, targetPath(alias)); }
@Override public ValueType describe( Optional<PropertyPath> path, TypeDescriptor type, DescribeContext context) { context.describeAsync(path.get().property("revision"), type.getField("revision")); return new VersionPropertyValueType(); }