org.nakedobjects.metamodel.facets.PropertyOrCollectionIdentifyingFacetFactory Maven / Gradle / Ivy
package org.nakedobjects.metamodel.facets;
import java.lang.reflect.Method;
import java.util.List;
import org.nakedobjects.metamodel.spec.feature.OneToManyAssociation;
import org.nakedobjects.metamodel.spec.feature.OneToOneAssociation;
/**
* A {@link FacetFactory} implementation that is able to identify a property or collection.
*
*
* For example, a getter method is most commonly used to represent either a property (value or
* reference) or a collection, with the return type indicating which.
*
*
* Used by the Java5 Reflector's ProgrammingModel to determine which facet factories to ask whether a {@link Method}
* represents a property or a collection.
*
*/
public interface PropertyOrCollectionIdentifyingFacetFactory extends FacetFactory {
/**
* Whether (this facet is able to determine that) the supplied {@link Method} possibly represents the
* accessor of either a {@link ValueAssociation value property}, {@link OneToOneAssociation reference
* property} or a {@link OneToManyAssociation collection}.
*
*
* For example, if a method name has a prefix of get or alternatively has a prefix of is
* and returns a boolean, then it would be a candidate.
*/
public boolean isPropertyOrCollectionAccessorCandidate(Method method);
/**
* Whether (this facet is able to determine that) the supplied {@link Method} represents either a
* {@link ValueAssociation value property} or a {@link OneToOneAssociation reference property}.
*/
public boolean isPropertyAccessor(Method method);
/**
* Whether (this facet is able to determine that) the supplied {@link Method} represents a
* {@link OneToManyAssociation collection}.
*/
public boolean isCollectionAccessor(Method method);
/**
* Use the provided {@link MethodRemover} to remove all reference property accessors, and append them to
* the supplied methodList.
*/
public void findAndRemovePropertyAccessors(MethodRemover methodRemover, List methodListToAppendTo);
/**
* Use the provided {@link MethodRemover} to remove all collection accessors, and append them to the
* supplied methodList.
*/
public void findAndRemoveCollectionAccessors(MethodRemover methodRemover, List methodListToAppendTo);
}