1. /*
  2. * Copyright 2003-2004 The Apache Software Foundation
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. package org.apache.commons.attributes;
  17. /**
  18. * Marks an attribute class as being sealable. When an instance of an attribute
  19. * class is created it goes through the following phases:
  20. *
  21. * <ol>
  22. * <li>Its constructor is called with all non-named parameters in the attribute declaration.
  23. * <li>Its setters are called according to the named parameters in the declaration.
  24. * </ol>
  25. *
  26. * This alone poses a security risk, as a client can call setters on an attribute as well,
  27. * and thus make class attributes mutable. In order to notify the attribute class that construction
  28. * and initialization is completed, the attribute runtime system will test if it implements Sealable,
  29. * and of so, invoke {@link #seal()} on the attribute instance.
  30. *
  31. * @see DefaultSealable
  32. */
  33. public interface Sealable {
  34. /**
  35. * Called to indicate that construction and initialization of this attribute instance
  36. * is completed, and that the attribute instance should become read-only.
  37. */
  38. public void seal ();
  39. }