From 112230a1a480fabd4e1353a21864e134a78a8bba Mon Sep 17 00:00:00 2001 From: Uwe Schindler Date: Sun, 10 Jul 2011 08:59:41 +0000 Subject: [PATCH] LUCENE-3302: Replace legacy pre-java5-enum git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1144792 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/lucene/index/IndexReader.java | 36 +++++++------------ 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/lucene/src/java/org/apache/lucene/index/IndexReader.java b/lucene/src/java/org/apache/lucene/index/IndexReader.java index 6d94250e730..3bc2d472fe3 100644 --- a/lucene/src/java/org/apache/lucene/index/IndexReader.java +++ b/lucene/src/java/org/apache/lucene/index/IndexReader.java @@ -144,41 +144,31 @@ public abstract class IndexReader implements Cloneable,Closeable { * Constants describing field properties, for example used for * {@link IndexReader#getFieldNames(FieldOption)}. */ - public static final class FieldOption { - private String option; - private FieldOption() { } - private FieldOption(String option) { - this.option = option; - } - @Override - public String toString() { - return this.option; - } + public static enum FieldOption { /** All fields */ - public static final FieldOption ALL = new FieldOption ("ALL"); + ALL, /** All indexed fields */ - public static final FieldOption INDEXED = new FieldOption ("INDEXED"); + INDEXED, /** All fields that store payloads */ - public static final FieldOption STORES_PAYLOADS = new FieldOption ("STORES_PAYLOADS"); + STORES_PAYLOADS, /** All fields that omit tf */ - public static final FieldOption OMIT_TERM_FREQ_AND_POSITIONS = new FieldOption ("OMIT_TERM_FREQ_AND_POSITIONS"); + OMIT_TERM_FREQ_AND_POSITIONS, /** All fields which are not indexed */ - public static final FieldOption UNINDEXED = new FieldOption ("UNINDEXED"); + UNINDEXED, /** All fields which are indexed with termvectors enabled */ - public static final FieldOption INDEXED_WITH_TERMVECTOR = new FieldOption ("INDEXED_WITH_TERMVECTOR"); + INDEXED_WITH_TERMVECTOR, /** All fields which are indexed but don't have termvectors enabled */ - public static final FieldOption INDEXED_NO_TERMVECTOR = new FieldOption ("INDEXED_NO_TERMVECTOR"); + INDEXED_NO_TERMVECTOR, /** All fields with termvectors enabled. Please note that only standard termvector fields are returned */ - public static final FieldOption TERMVECTOR = new FieldOption ("TERMVECTOR"); + TERMVECTOR, /** All fields with termvectors with position values enabled */ - public static final FieldOption TERMVECTOR_WITH_POSITION = new FieldOption ("TERMVECTOR_WITH_POSITION"); + TERMVECTOR_WITH_POSITION, /** All fields with termvectors with offset values enabled */ - public static final FieldOption TERMVECTOR_WITH_OFFSET = new FieldOption ("TERMVECTOR_WITH_OFFSET"); + TERMVECTOR_WITH_OFFSET, /** All fields with termvectors with offset values and position values enabled */ - public static final FieldOption TERMVECTOR_WITH_POSITION_OFFSET = new FieldOption ("TERMVECTOR_WITH_POSITION_OFFSET"); + TERMVECTOR_WITH_POSITION_OFFSET, /** All fields holding doc values */ - public static final FieldOption DOC_VALUES = new FieldOption ("DOC_VALUES"); - + DOC_VALUES } private boolean closed;