Skip to content

Commit

Permalink
HSEARCH-3311 Add toString() implementations to PojoElementAccessor
Browse files Browse the repository at this point in the history
  • Loading branch information
yrodiere authored and fax4ever committed Jul 31, 2020
1 parent 71bfeeb commit c832677
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
Expand Up @@ -62,7 +62,7 @@ public void contributeDependencies(PojoIndexingDependencyCollectorTypeNode<T> de

@Override
PojoElementAccessor<P> doCreateAccessor() {
return new PojoPropertyElementAccessor<>( parent.createAccessor(), getHandle() );
return new PojoPropertyElementAccessor<>( parent.createAccessor(), getHandle(), modelPath.toUnboundPath() );
}

@Override
Expand Down
Expand Up @@ -7,6 +7,7 @@
package org.hibernate.search.mapper.pojo.model.impl;

import org.hibernate.search.mapper.pojo.model.PojoElementAccessor;
import org.hibernate.search.mapper.pojo.model.path.PojoModelPathValueNode;
import org.hibernate.search.util.common.reflect.spi.ValueReadHandle;

/**
Expand All @@ -16,10 +17,20 @@ class PojoPropertyElementAccessor<P> implements PojoElementAccessor<P> {

private final PojoElementAccessor<?> parent;
private final ValueReadHandle<P> handle;
private final PojoModelPathValueNode path;

PojoPropertyElementAccessor(PojoElementAccessor<?> parent, ValueReadHandle<P> handle) {
PojoPropertyElementAccessor(PojoElementAccessor<?> parent, ValueReadHandle<P> handle,
PojoModelPathValueNode path) {
this.parent = parent;
this.handle = handle;
this.path = path;
}

@Override
public String toString() {
return getClass().getSimpleName() + "["
+ "path=" + path
+ "]";
}

@Override
Expand Down
Expand Up @@ -16,6 +16,11 @@ class PojoRootElementAccessor<T> implements PojoElementAccessor<T> {
PojoRootElementAccessor() {
}

@Override
public String toString() {
return getClass().getSimpleName();
}

@Override
@SuppressWarnings("unchecked") // By construction, this accessor will only be passed PojoElement returning type T
public T read(Object parentElement) {
Expand Down

0 comments on commit c832677

Please sign in to comment.