Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

HSEARCH-1222 #345

Closed
wants to merge 4 commits into from

3 participants

Michael Simons Sanne Grinovero Emmanuel Bernard
Michael Simons

Changes spatialName of @Latitude and @Longitude to just value.

michael-simons added some commits
Michael Simons michael-simons HSEARCH-1222: Renamed spatialName in Latitude and Longitude to value
Therefor the annotations be used just like @Latitude("work") which is better to read
defb351
Michael Simons michael-simons HSEARCH-1222
Fixed the tests / examples
e5eb436
Sanne Grinovero
Owner

Hi, welcome! great idea, especially about sending pull requests.

Could you please sign cla.jboss.org ? It's a simple statement we need; you just to click a checkbox to make sure you want to make this and future patches par of Hibernate, and entitles you bragging rights as Hibernate contributor ;)

michael-simons added some commits
Michael Simons michael-simons Fixed java doc b6a0eff
Michael Simons michael-simons HSEARCH-1222 Changed value to the more fluent name "of"
value should be free for future use. "of" is a more fluent label than spatialName and
well understandable (i.e. @Latitude(of="work"))
359aacb
Emmanuel Bernard

Closing as it is replaced by #359

Emmanuel Bernard

Thanks @michael-simons for your work. It's not lost, I've just spent a cycle to improve it further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 19, 2012
  1. Michael Simons

    HSEARCH-1222: Renamed spatialName in Latitude and Longitude to value

    michael-simons authored
    Therefor the annotations be used just like @Latitude("work") which is better to read
  2. Michael Simons

    HSEARCH-1222

    michael-simons authored
    Fixed the tests / examples
  3. Michael Simons

    Fixed java doc

    michael-simons authored
  4. Michael Simons

    HSEARCH-1222 Changed value to the more fluent name "of"

    michael-simons authored
    value should be free for future use. "of" is a more fluent label than spatialName and
    well understandable (i.e. @Latitude(of="work"))
This page is out of date. Refresh to see the latest.
4 hibernate-search-engine/src/main/java/org/hibernate/search/annotations/Latitude.java
View
@@ -37,8 +37,8 @@
@Documented
public @interface Latitude {
/**
- * @return the referred spatial annotation field name (defaults to the JavaBean property name)
+ * @return the referred spatial annotation field name (defaults to the empty string, corresponding to the default field name in {@link Spatial#name()})
*/
- String spatialName() default "";
+ String of() default "";
}
4 hibernate-search-engine/src/main/java/org/hibernate/search/annotations/Longitude.java
View
@@ -37,8 +37,8 @@
@Documented
public @interface Longitude {
/**
- * @return the referred spatial annotation field name (defaults to the JavaBean property name)
+ * @return the referred spatial annotation field name (defaults to the empty string, corresponding to the default field name in {@link Spatial#name()})
*/
- String spatialName() default "";
+ String of() default "";
}
2  hibernate-search-engine/src/main/java/org/hibernate/search/cfg/PropertyLatitudeMapping.java
View
@@ -48,7 +48,7 @@ public PropertyLatitudeMapping(PropertyDescriptor property, EntityDescriptor ent
}
public PropertyLatitudeMapping name(String fieldName) {
- latitude.put( "spatialName", fieldName );
+ latitude.put( "of", fieldName );
return this;
}
2  hibernate-search-engine/src/main/java/org/hibernate/search/cfg/PropertyLongitudeMapping.java
View
@@ -48,7 +48,7 @@ public PropertyLongitudeMapping(PropertyDescriptor property, EntityDescriptor en
}
public PropertyLongitudeMapping name(String fieldName) {
- longitude.put( "spatialName", fieldName );
+ longitude.put( "of", fieldName );
return this;
}
4 hibernate-search-engine/src/main/java/org/hibernate/search/engine/spi/AbstractDocumentBuilder.java
View
@@ -1006,13 +1006,13 @@ private void bindSpatialAnnotation(String prefix, PropertiesMetadata propertiesM
String latitudeField = null;
String longitudeField = null;
for ( XProperty property : propertyList ) {
- if ( property.isAnnotationPresent( Latitude.class ) && ( property.getAnnotation( Latitude.class ) ).spatialName().equals( ann.name() ) ) {
+ if ( property.isAnnotationPresent( Latitude.class ) && ( property.getAnnotation( Latitude.class ) ).of().equals( ann.name() ) ) {
if ( latitudeField != null ) {
throw log.ambiguousLatitudeDefinition( this.beanXClassName, latitudeField, property.getName() );
}
latitudeField = property.getName();
}
- if ( property.isAnnotationPresent( Longitude.class ) && ( property.getAnnotation( Longitude.class )).spatialName().equals( ann.name() ) ) {
+ if ( property.isAnnotationPresent( Longitude.class ) && ( property.getAnnotation( Longitude.class )).of().equals( ann.name() ) ) {
if ( longitudeField != null ) {
throw log.ambiguousLongitudeDefinition( this.beanXClassName, longitudeField, property.getName() );
}
4 hibernate-search-orm/src/test/java/org/hibernate/search/test/spatial/User.java
View
@@ -39,10 +39,10 @@
@Id
Integer id;
- @Latitude(spatialName="home")
+ @Latitude(of="home")
Double homeLatitude;
- @Longitude(spatialName="home")
+ @Longitude(of="home")
Double homeLongitude;
public User(Integer id, Double homeLatitude, Double homeLongitude) {
4 hibernate-search-orm/src/test/java/org/hibernate/search/test/spatial/UserEx.java
View
@@ -47,10 +47,10 @@
@Longitude
Double homeLongitude;
- @Latitude(spatialName="work")
+ @Latitude(of="work")
Double workLatitude;
- @Longitude(spatialName="work")
+ @Longitude(of="work")
Double workLongitude;
public UserEx(Integer id, Double homeLatitude, Double homeLongitude, Double workLatitude, Double workLongitude) {
Something went wrong with that request. Please try again.