1 package org.jahia.services.search; 2 3 import java.util.*; 4 5 15 public class ParsedObjectImpl implements ParsedObject { 16 17 private float score; 18 private Hashtable fields; 19 20 public ParsedObjectImpl(){ 21 fields = new Hashtable(); 22 } 23 24 public ParsedObjectImpl(float score, Hashtable fields){ 25 this.score = score; 26 this.fields = fields; 27 if ( this.fields == null ){ 28 fields = new Hashtable(); 29 } 30 } 31 32 37 public float getScore(){ 38 return this.score; 39 } 40 41 46 public void setScore(float score){ 47 this.score = score; 48 } 49 50 58 public Hashtable getFields (){ 59 if ( this.fields == null ){ 60 this.fields = new Hashtable(); 61 } 62 return this.fields; 63 } 64 65 public void setFields (Hashtable fields){ 66 this.fields = fields; 67 } 68 69 74 public String [] getValues(String fieldName){ 75 String [] values = new String [0]; 76 if ( fieldName != null ){ 77 values = (String [])getFields().get(fieldName); 78 } 79 if ( values == null ){ 80 values = new String [0]; 81 } 82 return values; 83 } 84 85 89 public String getValue(String fieldName){ 90 String [] values = getValues(fieldName); 91 if ( values.length == 0 ){ 92 return null; 93 } 94 return values[0]; 95 } 96 97 } 98 | Popular Tags |