コード例 #1
0
  @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);
  }
コード例 #2
0
 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));
 }
コード例 #3
0
 @Override
 public ValueType describe(
     Optional<PropertyPath> path, TypeDescriptor type, DescribeContext context) {
   context.describeAsync(path.get().property("revision"), type.getField("revision"));
   return new VersionPropertyValueType();
 }