@ Requires ( "modifier != null" ) @ Ensures ( "getModifiers().contains(modifier)" ) public void addModifier ( ElementModifier modifier ) { switch ( modifier ) { case PRIVATE : case PACKAGE_PRIVATE : case PROTECTED : case PUBLIC : modifiers . remove ( ElementModifier . PRIVATE ) ; modifiers . remove ( ElementModifier . PACKAGE_PRIVATE ) ; modifiers . remove ( ElementModifier . PROTECTED ) ; modifiers . remove ( ElementModifier . PUBLIC ) ; } modifiers . add ( modifier ) ; }
Adds a modifier to this element . This method ensures that exactly one visibility modifier is set .