001/* 002 * Copyright 2015 Anyware Services 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.ametys.cms.search.model; 017 018import org.ametys.cms.repository.Content; 019import org.ametys.cms.search.SearchField; 020 021/** 022 * Represents a Field to be returned by a search. 023 */ 024public interface ResultField extends Field 025{ 026 027 /** 028 * Get the result field ID. 029 * @return the result field ID. 030 */ 031 String getId(); 032 033 /** 034 * Get the value represented by this field in the given result content. 035 * @param content the result content. 036 * @return the content field value (cast to the appropriate object). 037 */ 038 Object getValue(Content content); 039 040 /** 041 * Get the value represented by this field in the given result content. 042 * @param content the result content. 043 * @return the content field value (cast to the appropriate object). 044 */ 045 default Object getFullValue(Content content) 046 { 047 // Defaults to the same value. 048 return getValue(content); 049 } 050 051 /** 052 * Get the {@link SearchField} representing this result field. 053 * @return The {@link SearchField} representing this result field. 054 */ 055 SearchField getSearchField(); 056 057}