001package org.biopax.paxtools.controller; 002 003import org.biopax.paxtools.model.BioPAXElement; 004import org.biopax.paxtools.util.IllegalBioPAXArgumentException; 005 006import java.util.Collection; 007import java.util.Set; 008 009/** 010 * Allows generic access to the properties or a path of properties from a bean. 011 */ 012public interface PropertyAccessor<D extends BioPAXElement, R> 013{ 014 /** 015 * Returns the domain of the property. 016 * @return the domain of the editor 017 */ 018 Class<D> getDomain(); 019 020 /** 021 * Returns the range of the editor. 022 * @return a class 023 */ 024 Class<R> getRange(); 025 026 /** 027 * Checks if the property to which editor is assigned has multiple cardinality. 028 * @return true if editor belongs to a multiple cardinality property. 029 */ 030 boolean isMultipleCardinality(); 031 032 /** 033 * Returns the value of the <em>bean</em> using the default getMethod. 034 * 035 * @param bean the object whose property is requested 036 * @return an object as the value 037 */ 038 Set<? extends R> getValueFromBean(D bean) throws IllegalBioPAXArgumentException; 039 040 /** 041 * Returns the values for a collection of <em>beans</em> using the default getMethod. 042 * 043 * @param beans collection of BioPAX objects 044 * @return an object as the value 045 */ 046 Set<? extends R> getValueFromBeans(Collection<? extends D> beans) throws IllegalBioPAXArgumentException; 047 048 /** 049 * Checks if the <em>value</em> is unkown. In this context a <em>value</em> is regarded to be 050 * unknown if it is null (unset). 051 * @param value the value to be checked 052 * @return true if the value is unknown 053 */ 054 public boolean isUnknown(Object value); 055}