Search in sources :

Example 1 with NotMappableException

use of dev.morphia.mapping.NotMappableException in project morphia by mongodb.

the class PathTarget method resolveProperty.

@Nullable
private PropertyModel resolveProperty(String segment) {
    if (context != null) {
        PropertyModel model = context.getProperty(segment);
        if (model == null) {
            Iterator<EntityModel> subTypes = context.getSubtypes().iterator();
            while (model == null && subTypes.hasNext()) {
                context = subTypes.next();
                model = resolveProperty(segment);
            }
        }
        if (model != null) {
            try {
                context = mapper.getEntityModel(model.getNormalizedType());
            } catch (NotMappableException ignored) {
                context = null;
            }
        }
        return model;
    } else {
        return null;
    }
}
Also used : NotMappableException(dev.morphia.mapping.NotMappableException) PropertyModel(dev.morphia.mapping.codec.pojo.PropertyModel) EntityModel(dev.morphia.mapping.codec.pojo.EntityModel) Nullable(com.mongodb.lang.Nullable)

Aggregations

Nullable (com.mongodb.lang.Nullable)1 NotMappableException (dev.morphia.mapping.NotMappableException)1 EntityModel (dev.morphia.mapping.codec.pojo.EntityModel)1 PropertyModel (dev.morphia.mapping.codec.pojo.PropertyModel)1