All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.nakedobjects.noa.reflect.checks.CheckOneToOneAssociationInstanceNotDisabledImperatively Maven / Gradle / Ivy

The newest version!
package org.nakedobjects.noa.reflect.checks;

import org.nakedobjects.noa.adapter.Naked;
import org.nakedobjects.noa.reflect.Consent;
import org.nakedobjects.noa.reflect.OneToOneAssociationInstance;

/**
 * Checks that the {@link OneToOneAssociationInstance} is not disabled
 * imperatively (as per the disableXxx method, or equivalent).
 * 
 */
public class CheckOneToOneAssociationInstanceNotDisabledImperatively extends AbstractCheckOneToOneAssociationInstance {
    
    public CheckOneToOneAssociationInstanceNotDisabledImperatively(
            OneToOneAssociationInstance oneToOneAssociationInstance) {
        super(oneToOneAssociationInstance);
    }

    public String check(
            Naked[] values) {
        OneToOneAssociationInstance otoai = getOneToOneAssociationInstance();
        final Consent usable = otoai.getOneToOneAssociation().isUsable(otoai.getNakedObject());
        return usable.isAllowed()?null:usable.getReason();
    }

    
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy