Home » lucene-3.0.1-src » org.apache.lucene.queryParser.core.config » [javadoc | source]

    1   package org.apache.lucene.queryParser.core.config;
    2   
    3   /**
    4    * Licensed to the Apache Software Foundation (ASF) under one or more
    5    * contributor license agreements.  See the NOTICE file distributed with
    6    * this work for additional information regarding copyright ownership.
    7    * The ASF licenses this file to You under the Apache License, Version 2.0
    8    * (the "License"); you may not use this file except in compliance with
    9    * the License.  You may obtain a copy of the License at
   10    *
   11    *     http://www.apache.org/licenses/LICENSE-2.0
   12    *
   13    * Unless required by applicable law or agreed to in writing, software
   14    * distributed under the License is distributed on an "AS IS" BASIS,
   15    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   16    * See the License for the specific language governing permissions and
   17    * limitations under the License.
   18    */
   19   
   20   import org.apache.lucene.util.AttributeSource;
   21   
   22   /**
   23    * This class represents a field configuration. Every configuration should be
   24    * set using the methods inherited from {@link AttributeSource}.
   25    * 
   26    * @see QueryConfigHandler
   27    * @see org.apache.lucene.util.Attribute
   28    */
   29   public class FieldConfig extends AttributeSource {
   30   
   31     private CharSequence fieldName;
   32   
   33     /**
   34      * Constructs a {@link FieldConfig}
   35      * 
   36      * @param fieldName
   37      *          the field name, it cannot be null
   38      * @throws IllegalArgumentException
   39      *           if the field name is null
   40      */
   41     public FieldConfig(CharSequence fieldName) {
   42   
   43       if (fieldName == null) {
   44         throw new IllegalArgumentException("field name should not be null!");
   45       }
   46   
   47       this.fieldName = fieldName;
   48   
   49     }
   50   
   51     /**
   52      * Returns the field name this configuration represents.
   53      * 
   54      * @return the field name
   55      */
   56     public CharSequence getFieldName() {
   57       return this.fieldName;
   58     }
   59     
   60     @Override
   61     public String toString(){
   62       return "<fieldconfig name=\"" + this.fieldName + "\" attributes=\"" + super.toString() + "\"/>";
   63     }
   64   
   65   }

Home » lucene-3.0.1-src » org.apache.lucene.queryParser.core.config » [javadoc | source]