Skip to content

Commit

Permalink
HSEARCH-3310 Get our naming practices straight for implementations of…
Browse files Browse the repository at this point in the history
… contexts in the index field type DSL

This should make the next commit a bit clearer.
  • Loading branch information
yrodiere committed Oct 8, 2018
1 parent 85b4fd8 commit ca6b683
Show file tree
Hide file tree
Showing 16 changed files with 60 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
import org.hibernate.search.backend.elasticsearch.document.model.impl.ElasticsearchIndexSchemaNodeContributor;
import org.hibernate.search.backend.elasticsearch.document.model.impl.ElasticsearchIndexSchemaObjectNode;
import org.hibernate.search.backend.elasticsearch.document.model.impl.esnative.PropertyMapping;
import org.hibernate.search.backend.elasticsearch.types.dsl.impl.GeoPointIndexSchemaFieldContext;
import org.hibernate.search.backend.elasticsearch.types.dsl.impl.IntegerIndexSchemaFieldContext;
import org.hibernate.search.backend.elasticsearch.types.dsl.impl.JsonStringIndexSchemaFieldContext;
import org.hibernate.search.backend.elasticsearch.types.dsl.impl.LocalDateIndexSchemaFieldContext;
import org.hibernate.search.backend.elasticsearch.types.dsl.impl.StringIndexSchemaFieldContext;
import org.hibernate.search.backend.elasticsearch.types.dsl.impl.ElasticsearchGeoPointIndexSchemaFieldContextImpl;
import org.hibernate.search.backend.elasticsearch.types.dsl.impl.ElasticsearchIntegerIndexSchemaFieldContextImpl;
import org.hibernate.search.backend.elasticsearch.types.dsl.impl.JsonStringIndexSchemaFieldContextImpl;
import org.hibernate.search.backend.elasticsearch.types.dsl.impl.ElasticsearchLocalDateIndexSchemaFieldContextImpl;
import org.hibernate.search.backend.elasticsearch.types.dsl.impl.ElasticsearchStringIndexSchemaFieldContextImpl;
import org.hibernate.search.backend.elasticsearch.util.impl.ElasticsearchFields;
import org.hibernate.search.engine.logging.spi.EventContexts;
import org.hibernate.search.engine.spatial.GeoPoint;
Expand Down Expand Up @@ -70,27 +70,27 @@ else if ( GeoPoint.class.equals( inputType ) ) {

@Override
public StandardIndexSchemaFieldTypedContext<String> asString() {
return setDelegate( new StringIndexSchemaFieldContext( this, relativeFieldName ) );
return setDelegate( new ElasticsearchStringIndexSchemaFieldContextImpl( this, relativeFieldName ) );
}

@Override
public StandardIndexSchemaFieldTypedContext<Integer> asInteger() {
return setDelegate( new IntegerIndexSchemaFieldContext( this, relativeFieldName ) );
return setDelegate( new ElasticsearchIntegerIndexSchemaFieldContextImpl( this, relativeFieldName ) );
}

@Override
public StandardIndexSchemaFieldTypedContext<LocalDate> asLocalDate() {
return setDelegate( new LocalDateIndexSchemaFieldContext( this, relativeFieldName ) );
return setDelegate( new ElasticsearchLocalDateIndexSchemaFieldContextImpl( this, relativeFieldName ) );
}

@Override
public StandardIndexSchemaFieldTypedContext<GeoPoint> asGeoPoint() {
return setDelegate( new GeoPointIndexSchemaFieldContext( this, relativeFieldName ) );
return setDelegate( new ElasticsearchGeoPointIndexSchemaFieldContextImpl( this, relativeFieldName ) );
}

@Override
public IndexSchemaFieldTypedContext<String> asJsonString(String mappingJsonString) {
return setDelegate( new JsonStringIndexSchemaFieldContext( this, relativeFieldName, mappingJsonString ) );
return setDelegate( new JsonStringIndexSchemaFieldContextImpl( this, relativeFieldName, mappingJsonString ) );
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
/**
* @author Yoann Rodiere
*/
abstract class AbstractScalarFieldTypedContext<F> extends AbstractElasticsearchIndexSchemaFieldTypedContext<F> {
abstract class AbstractElasticsearchScalarFieldTypedContext<F> extends AbstractElasticsearchStandardIndexSchemaFieldTypedContext<F> {

private static final Log log = LoggerFactory.make( Log.class, MethodHandles.lookup() );

Expand All @@ -32,7 +32,7 @@ abstract class AbstractScalarFieldTypedContext<F> extends AbstractElasticsearchI
private Store store = Store.DEFAULT;
private Sortable sortable = Sortable.DEFAULT;

AbstractScalarFieldTypedContext(IndexSchemaContext schemaContext,
AbstractElasticsearchScalarFieldTypedContext(IndexSchemaContext schemaContext,
String relativeFieldName, Class<F> fieldType, DataType dataType) {
super( schemaContext, fieldType );
this.relativeFieldName = relativeFieldName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
/**
* @author Yoann Rodiere
*/
public abstract class AbstractElasticsearchIndexSchemaFieldTypedContext<F>
public abstract class AbstractElasticsearchStandardIndexSchemaFieldTypedContext<F>
implements ElasticsearchStandardIndexSchemaFieldTypedContext<F>,
ElasticsearchIndexSchemaNodeContributor<PropertyMapping> {

private final IndexSchemaFieldDefinitionHelper<F> helper;

AbstractElasticsearchIndexSchemaFieldTypedContext(IndexSchemaContext schemaContext, Class<F> fieldType) {
AbstractElasticsearchStandardIndexSchemaFieldTypedContext(IndexSchemaContext schemaContext, Class<F> fieldType) {
this.helper = new IndexSchemaFieldDefinitionHelper<>( schemaContext, fieldType );
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@
* @author Yoann Rodiere
* @author Guillaume Smet
*/
public class GeoPointIndexSchemaFieldContext extends AbstractScalarFieldTypedContext<GeoPoint> {
public class ElasticsearchGeoPointIndexSchemaFieldContextImpl extends
AbstractElasticsearchScalarFieldTypedContext<GeoPoint> {

private final String relativeFieldName;

public GeoPointIndexSchemaFieldContext(IndexSchemaContext schemaContext, String relativeFieldName) {
public ElasticsearchGeoPointIndexSchemaFieldContextImpl(IndexSchemaContext schemaContext, String relativeFieldName) {
super( schemaContext, relativeFieldName, GeoPoint.class, DataType.GEO_POINT );
this.relativeFieldName = relativeFieldName;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@
* @author Yoann Rodiere
* @author Guillaume Smet
*/
public class IntegerIndexSchemaFieldContext extends AbstractScalarFieldTypedContext<Integer> {
public class ElasticsearchIntegerIndexSchemaFieldContextImpl extends
AbstractElasticsearchScalarFieldTypedContext<Integer> {

private final String relativeFieldName;

public IntegerIndexSchemaFieldContext(IndexSchemaContext schemaContext, String relativeFieldName) {
public ElasticsearchIntegerIndexSchemaFieldContextImpl(IndexSchemaContext schemaContext, String relativeFieldName) {
super( schemaContext, relativeFieldName, Integer.class, DataType.INTEGER );
this.relativeFieldName = relativeFieldName;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
* @author Yoann Rodiere
* @author Guillaume Smet
*/
public class LocalDateIndexSchemaFieldContext extends AbstractScalarFieldTypedContext<LocalDate> {
public class ElasticsearchLocalDateIndexSchemaFieldContextImpl extends
AbstractElasticsearchScalarFieldTypedContext<LocalDate> {

private static final LocalDateFieldCodec DEFAULT_CODEC = new LocalDateFieldCodec(
new DateTimeFormatterBuilder()
Expand All @@ -52,7 +53,7 @@ public class LocalDateIndexSchemaFieldContext extends AbstractScalarFieldTypedCo
private final String relativeFieldName;
private final LocalDateFieldCodec codec = DEFAULT_CODEC; // TODO add method to allow customization

public LocalDateIndexSchemaFieldContext(IndexSchemaContext schemaContext, String relativeFieldName) {
public ElasticsearchLocalDateIndexSchemaFieldContextImpl(IndexSchemaContext schemaContext, String relativeFieldName) {
super( schemaContext, relativeFieldName, LocalDate.class, DataType.DATE );
this.relativeFieldName = relativeFieldName;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
* @author Yoann Rodiere
* @author Guillaume Smet
*/
public class StringIndexSchemaFieldContext extends AbstractElasticsearchIndexSchemaFieldTypedContext<String> {
public class ElasticsearchStringIndexSchemaFieldContextImpl extends AbstractElasticsearchStandardIndexSchemaFieldTypedContext<String> {

private static final Log log = LoggerFactory.make( Log.class, MethodHandles.lookup() );

Expand All @@ -42,7 +42,7 @@ public class StringIndexSchemaFieldContext extends AbstractElasticsearchIndexSch
private Store store = Store.DEFAULT;
private Sortable sortable = Sortable.DEFAULT;

public StringIndexSchemaFieldContext(IndexSchemaContext schemaContext, String relativeFieldName) {
public ElasticsearchStringIndexSchemaFieldContextImpl(IndexSchemaContext schemaContext, String relativeFieldName) {
super( schemaContext, String.class );
this.relativeFieldName = relativeFieldName;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
* @author Yoann Rodiere
* @author Guillaume Smet
*/
public class JsonStringIndexSchemaFieldContext implements IndexSchemaFieldTypedContext<String>,
public class JsonStringIndexSchemaFieldContextImpl implements IndexSchemaFieldTypedContext<String>,
ElasticsearchIndexSchemaNodeContributor<PropertyMapping> {

private static final Gson GSON = new GsonBuilder().create();
Expand All @@ -45,7 +45,7 @@ public class JsonStringIndexSchemaFieldContext implements IndexSchemaFieldTypedC

private final String mappingJsonString;

public JsonStringIndexSchemaFieldContext(IndexSchemaContext schemaContext, String relativeFieldName, String mappingJsonString) {
public JsonStringIndexSchemaFieldContextImpl(IndexSchemaContext schemaContext, String relativeFieldName, String mappingJsonString) {
this.helper = new IndexSchemaFieldDefinitionHelper<>( schemaContext, String.class );
this.relativeFieldName = relativeFieldName;
this.mappingJsonString = mappingJsonString;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
/**
* @author Guillaume Smet
*/
public interface LuceneIndexSchemaFieldTypedContext<F> extends StandardIndexSchemaFieldTypedContext<F> {
public interface LuceneStandardIndexSchemaFieldTypedContext<F> extends StandardIndexSchemaFieldTypedContext<F> {

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
import org.hibernate.search.backend.lucene.document.model.impl.LuceneIndexSchemaNodeCollector;
import org.hibernate.search.backend.lucene.document.model.impl.LuceneIndexSchemaNodeContributor;
import org.hibernate.search.backend.lucene.document.model.impl.LuceneIndexSchemaObjectNode;
import org.hibernate.search.backend.lucene.types.dsl.impl.GeoPointIndexSchemaFieldContext;
import org.hibernate.search.backend.lucene.types.dsl.impl.IntegerIndexSchemaFieldContext;
import org.hibernate.search.backend.lucene.types.dsl.impl.LocalDateIndexSchemaFieldContext;
import org.hibernate.search.backend.lucene.types.dsl.impl.LuceneFieldIndexSchemaFieldContext;
import org.hibernate.search.backend.lucene.types.dsl.impl.StringIndexSchemaFieldContext;
import org.hibernate.search.backend.lucene.types.dsl.impl.LuceneGeoPointIndexSchemaFieldContextImpl;
import org.hibernate.search.backend.lucene.types.dsl.impl.LuceneIntegerIndexSchemaFieldContextImpl;
import org.hibernate.search.backend.lucene.types.dsl.impl.LuceneLocalDateIndexSchemaFieldContextImpl;
import org.hibernate.search.backend.lucene.types.dsl.impl.LuceneFieldIndexSchemaFieldContextImpl;
import org.hibernate.search.backend.lucene.types.dsl.impl.LuceneStringIndexSchemaFieldContextImpl;
import org.hibernate.search.backend.lucene.util.impl.LuceneFields;
import org.hibernate.search.util.EventContext;
import org.hibernate.search.engine.logging.spi.EventContexts;
Expand Down Expand Up @@ -71,22 +71,22 @@ else if ( GeoPoint.class.equals( inputType ) ) {

@Override
public StandardIndexSchemaFieldTypedContext<String> asString() {
return setDelegate( new StringIndexSchemaFieldContext( this, relativeFieldName ) );
return setDelegate( new LuceneStringIndexSchemaFieldContextImpl( this, relativeFieldName ) );
}

@Override
public StandardIndexSchemaFieldTypedContext<Integer> asInteger() {
return setDelegate( new IntegerIndexSchemaFieldContext( this, relativeFieldName ) );
return setDelegate( new LuceneIntegerIndexSchemaFieldContextImpl( this, relativeFieldName ) );
}

@Override
public StandardIndexSchemaFieldTypedContext<LocalDate> asLocalDate() {
return setDelegate( new LocalDateIndexSchemaFieldContext( this, relativeFieldName ) );
return setDelegate( new LuceneLocalDateIndexSchemaFieldContextImpl( this, relativeFieldName ) );
}

@Override
public StandardIndexSchemaFieldTypedContext<GeoPoint> asGeoPoint() {
return setDelegate( new GeoPointIndexSchemaFieldContext( this, relativeFieldName ) );
return setDelegate( new LuceneGeoPointIndexSchemaFieldContextImpl( this, relativeFieldName ) );
}

@Override
Expand All @@ -99,7 +99,7 @@ public void contribute(LuceneIndexSchemaNodeCollector collector, LuceneIndexSche
@Override
public <F> IndexSchemaFieldTerminalContext<F> asLuceneField(LuceneFieldContributor<F> fieldContributor,
LuceneFieldValueExtractor<F> fieldValueExtractor) {
return setDelegate( new LuceneFieldIndexSchemaFieldContext<>(
return setDelegate( new LuceneFieldIndexSchemaFieldContextImpl<>(
this, relativeFieldName, fieldContributor, fieldValueExtractor
) );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import org.hibernate.search.engine.backend.document.model.dsl.StandardIndexSchemaFieldTypedContext;
import org.hibernate.search.engine.backend.document.model.dsl.Store;
import org.hibernate.search.engine.backend.document.spi.IndexSchemaFieldDefinitionHelper;
import org.hibernate.search.backend.lucene.document.model.dsl.LuceneIndexSchemaFieldTypedContext;
import org.hibernate.search.backend.lucene.document.model.dsl.LuceneStandardIndexSchemaFieldTypedContext;
import org.hibernate.search.backend.lucene.document.model.impl.LuceneIndexSchemaNodeCollector;
import org.hibernate.search.backend.lucene.document.model.impl.LuceneIndexSchemaNodeContributor;
import org.hibernate.search.backend.lucene.document.model.impl.LuceneIndexSchemaObjectNode;
Expand All @@ -25,8 +25,8 @@
/**
* @author Guillaume Smet
*/
public abstract class AbstractLuceneIndexSchemaFieldTypedContext<F>
implements LuceneIndexSchemaFieldTypedContext<F>, LuceneIndexSchemaNodeContributor {
public abstract class AbstractLuceneStandardIndexSchemaFieldTypedContext<F>
implements LuceneStandardIndexSchemaFieldTypedContext<F>, LuceneIndexSchemaNodeContributor {

private static final Log log = LoggerFactory.make( Log.class, MethodHandles.lookup() );

Expand All @@ -38,7 +38,7 @@ public abstract class AbstractLuceneIndexSchemaFieldTypedContext<F>

private Store store = Store.DEFAULT;

protected AbstractLuceneIndexSchemaFieldTypedContext(LuceneIndexSchemaContext schemaContext, String relativeFieldName,
protected AbstractLuceneStandardIndexSchemaFieldTypedContext(LuceneIndexSchemaContext schemaContext, String relativeFieldName,
Class<F> fieldType) {
this.schemaContext = schemaContext;
this.helper = new IndexSchemaFieldDefinitionHelper<>( schemaContext, fieldType );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
/**
* @author Guillaume Smet
*/
public class LuceneFieldIndexSchemaFieldContext<F>
public class LuceneFieldIndexSchemaFieldContextImpl<F>
implements IndexSchemaFieldTerminalContext<F>, LuceneIndexSchemaNodeContributor {

private static final ToIndexFieldValueConverter<Object, Object> TO_INDEX_FIELD_VALUE_CONVERTER =
Expand Down Expand Up @@ -55,7 +55,7 @@ private static <F> ToIndexFieldValueConverter<F, F> getToIndexFieldValueConverte
private final LuceneFieldContributor<F> fieldContributor;
private final LuceneFieldValueExtractor<F> fieldValueExtractor;

public LuceneFieldIndexSchemaFieldContext(IndexSchemaContext schemaContext, String relativeFieldName,
public LuceneFieldIndexSchemaFieldContextImpl(IndexSchemaContext schemaContext, String relativeFieldName,
LuceneFieldContributor<F> fieldContributor, LuceneFieldValueExtractor<F> fieldValueExtractor) {
this.helper = new IndexSchemaFieldDefinitionHelper<>( schemaContext, getToIndexFieldValueConverter() );
this.relativeFieldName = relativeFieldName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,17 @@
/**
* @author Guillaume Smet
*/
public class GeoPointIndexSchemaFieldContext extends AbstractLuceneIndexSchemaFieldTypedContext<GeoPoint> {
public class LuceneGeoPointIndexSchemaFieldContextImpl extends
AbstractLuceneStandardIndexSchemaFieldTypedContext<GeoPoint> {

private Sortable sortable = Sortable.DEFAULT;

public GeoPointIndexSchemaFieldContext(LuceneIndexSchemaContext schemaContext, String relativeFieldName) {
public LuceneGeoPointIndexSchemaFieldContextImpl(LuceneIndexSchemaContext schemaContext, String relativeFieldName) {
super( schemaContext, relativeFieldName, GeoPoint.class );
}

@Override
public GeoPointIndexSchemaFieldContext sortable(Sortable sortable) {
public LuceneGeoPointIndexSchemaFieldContextImpl sortable(Sortable sortable) {
this.sortable = sortable;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,17 @@
/**
* @author Guillaume Smet
*/
public class IntegerIndexSchemaFieldContext extends AbstractLuceneIndexSchemaFieldTypedContext<Integer> {
public class LuceneIntegerIndexSchemaFieldContextImpl extends
AbstractLuceneStandardIndexSchemaFieldTypedContext<Integer> {

private Sortable sortable = Sortable.DEFAULT;

public IntegerIndexSchemaFieldContext(LuceneIndexSchemaContext schemaContext, String relativeFieldName) {
public LuceneIntegerIndexSchemaFieldContextImpl(LuceneIndexSchemaContext schemaContext, String relativeFieldName) {
super( schemaContext, relativeFieldName, Integer.class );
}

@Override
public IntegerIndexSchemaFieldContext sortable(Sortable sortable) {
public LuceneIntegerIndexSchemaFieldContextImpl sortable(Sortable sortable) {
this.sortable = sortable;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,17 @@
/**
* @author Guillaume Smet
*/
public class LocalDateIndexSchemaFieldContext extends AbstractLuceneIndexSchemaFieldTypedContext<LocalDate> {
public class LuceneLocalDateIndexSchemaFieldContextImpl extends
AbstractLuceneStandardIndexSchemaFieldTypedContext<LocalDate> {

private Sortable sortable = Sortable.DEFAULT;

public LocalDateIndexSchemaFieldContext(LuceneIndexSchemaContext schemaContext, String relativeFieldName) {
public LuceneLocalDateIndexSchemaFieldContextImpl(LuceneIndexSchemaContext schemaContext, String relativeFieldName) {
super( schemaContext, relativeFieldName, LocalDate.class );
}

@Override
public LocalDateIndexSchemaFieldContext sortable(Sortable sortable) {
public LuceneLocalDateIndexSchemaFieldContextImpl sortable(Sortable sortable) {
this.sortable = sortable;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
/**
* @author Guillaume Smet
*/
public class StringIndexSchemaFieldContext extends AbstractLuceneIndexSchemaFieldTypedContext<String> {
public class LuceneStringIndexSchemaFieldContextImpl extends
AbstractLuceneStandardIndexSchemaFieldTypedContext<String> {

private static final Log log = LoggerFactory.make( Log.class, MethodHandles.lookup() );

Expand All @@ -44,7 +45,7 @@ public class StringIndexSchemaFieldContext extends AbstractLuceneIndexSchemaFiel

private Sortable sortable = Sortable.DEFAULT;

public StringIndexSchemaFieldContext(LuceneIndexSchemaContext schemaContext, String relativeFieldName) {
public LuceneStringIndexSchemaFieldContextImpl(LuceneIndexSchemaContext schemaContext, String relativeFieldName) {
super( schemaContext, relativeFieldName, String.class );
}

Expand All @@ -69,7 +70,7 @@ public StandardIndexSchemaFieldTypedContext<String> normalizer(String normalizer
}

@Override
public StringIndexSchemaFieldContext sortable(Sortable sortable) {
public LuceneStringIndexSchemaFieldContextImpl sortable(Sortable sortable) {
this.sortable = sortable;
return this;
}
Expand Down

0 comments on commit ca6b683

Please sign in to comment.