Skip to content

Commit 805431b

Browse files
committed
HV-1393 Removed Property Kind enum
1 parent cd139d0 commit 805431b

File tree

5 files changed

+7
-22
lines changed

5 files changed

+7
-22
lines changed

engine/src/main/java/org/hibernate/validator/internal/cfg/context/PropertyConstraintMappingContextImpl.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import org.hibernate.validator.internal.metadata.raw.ConstrainedProperty;
2424
import org.hibernate.validator.internal.properties.Callable;
2525
import org.hibernate.validator.internal.properties.Property;
26+
import org.hibernate.validator.internal.properties.javabean.JavaBeanField;
2627
import org.hibernate.validator.internal.util.TypeResolutionHelper;
2728

2829
/**
@@ -56,7 +57,7 @@ protected PropertyConstraintMappingContextImpl getThis() {
5657

5758
@Override
5859
public PropertyConstraintMappingContext constraint(ConstraintDef<?, ?> definition) {
59-
if ( property.getKind() == Property.Kind.FIELD ) {
60+
if ( property instanceof JavaBeanField ) {
6061
super.addConstraint(
6162
ConfiguredConstraint.forProperty(
6263
definition, property
@@ -110,7 +111,7 @@ public ContainerElementConstraintMappingContext containerElementType(int index,
110111
}
111112

112113
ConstrainedElement build(ConstraintHelper constraintHelper, TypeResolutionHelper typeResolutionHelper, ValueExtractorManager valueExtractorManager) {
113-
if ( property.getKind() == Property.Kind.FIELD ) {
114+
if ( property instanceof JavaBeanField ) {
114115
return ConstrainedProperty.forField(
115116
ConfigurationSource.API,
116117
property,

engine/src/main/java/org/hibernate/validator/internal/metadata/aggregated/PropertyCascadable.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import org.hibernate.validator.internal.engine.valueextraction.ValueExtractorManager;
1414
import org.hibernate.validator.internal.metadata.facets.Cascadable;
1515
import org.hibernate.validator.internal.properties.Property;
16+
import org.hibernate.validator.internal.properties.javabean.JavaBeanField;
1617

1718
/**
1819
* A {@link Cascadable} backed by a field of a Java bean.
@@ -31,7 +32,7 @@ public class PropertyCascadable implements Cascadable {
3132
this.property = property;
3233
this.cascadableType = property.getType();
3334
this.cascadingMetaData = cascadingMetaData;
34-
this.elementType = property.getKind() == Property.Kind.FIELD ? ElementType.FIELD : ElementType.METHOD;
35+
this.elementType = property instanceof JavaBeanField ? ElementType.FIELD : ElementType.METHOD;
3536
}
3637

3738
@Override

engine/src/main/java/org/hibernate/validator/internal/properties/Property.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,7 @@
1111
*/
1212
public interface Property extends Constrainable {
1313

14-
enum Kind {
15-
FIELD,
16-
GETTER,
17-
}
18-
1914
Object getValueFrom(Object bean);
2015

21-
Kind getKind();
22-
2316
String getPropertyName();
2417
}

engine/src/main/java/org/hibernate/validator/internal/properties/javabean/JavaBeanField.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,6 @@ public Object getValueFrom(Object bean) {
5858
return ReflectionHelper.getValue( field, bean );
5959
}
6060

61-
@Override
62-
public Kind getKind() {
63-
return Kind.FIELD;
64-
}
65-
6661
@Override
6762
public String getPropertyName() {
6863
return getName();
@@ -121,7 +116,7 @@ private static Field getAccessible(Field original) {
121116

122117
/**
123118
* Runs the given privileged action, using a privileged block if required.
124-
* <p>
119+
*
125120
* <b>NOTE:</b> This must never be changed into a publicly available method to avoid execution of arbitrary
126121
* privileged actions within HV's protection domain.
127122
*/

engine/src/main/java/org/hibernate/validator/internal/properties/javabean/JavaBeanGetter.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,6 @@ public Object getValueFrom(Object bean) {
3737
return ReflectionHelper.getValue( (Method) executable, bean );
3838
}
3939

40-
@Override
41-
public Kind getKind() {
42-
return Kind.GETTER;
43-
}
44-
4540
@Override
4641
public String getPropertyName() {
4742
return name;
@@ -120,7 +115,7 @@ private static Method getAccessible(Method original) {
120115

121116
/**
122117
* Runs the given privileged action, using a privileged block if required.
123-
* <p>
118+
*
124119
* <b>NOTE:</b> This must never be changed into a publicly available method to avoid execution of arbitrary
125120
* privileged actions within HV's protection domain.
126121
*/

0 commit comments

Comments
 (0)