LUCENE-6497: Allow subclasses of FieldType to check frozen state

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1681207 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Ryan Ernst 2015-05-22 19:27:34 +00:00
parent 71c454caed
commit 942ba07248
2 changed files with 9 additions and 2 deletions

View File

@ -218,6 +218,9 @@ API Changes
* LUCENE-6466: Moved SpanQuery.getSpans() and .extractTerms() to SpanWeight
(Alan Woodward)
* LUCENE-6497: Allow subclasses of FieldType to check frozen state
(Ryan Ernst)
Other
* LUCENE-6413: Test runner should report the number of suites completed/

View File

@ -32,7 +32,7 @@ public class FieldType implements IndexableFieldType {
/** Data type of the numeric value
* @since 3.2
*/
public static enum NumericType {
public enum NumericType {
/** 32-bit integer numeric type */
INT,
/** 64-bit long numeric type */
@ -80,7 +80,11 @@ public class FieldType implements IndexableFieldType {
public FieldType() {
}
private void checkIfFrozen() {
/**
* Throws an exception if this FieldType is frozen. Subclasses should
* call this within setters for additional state.
*/
protected void checkIfFrozen() {
if (frozen) {
throw new IllegalStateException("this FieldType is already frozen and cannot be changed");
}