/driver-core/src/main/com/mongodb/internal/VisibleForTesting.java

https://github.com/jyemin/mongo-java-driver · Java · 47 lines · 17 code · 3 blank · 27 comment · 0 complexity · f4c0af9201f746732e9889126a12fb9c MD5 · raw file

  1. /*
  2. * Copyright 2008-present MongoDB, Inc.
  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 com.mongodb.internal;
  17. import java.lang.annotation.Documented;
  18. import java.lang.annotation.ElementType;
  19. import java.lang.annotation.Retention;
  20. import java.lang.annotation.RetentionPolicy;
  21. import java.lang.annotation.Target;
  22. /**
  23. * Denotes that the annotated program element is made more accessible than otherwise necessary for the purpose of testing.
  24. * The annotated program element must be used as if it had the {@linkplain #otherwise() intended} access modifier
  25. * for any purpose other than testing.
  26. */
  27. @Documented
  28. @Retention(RetentionPolicy.SOURCE)
  29. @Target({ElementType.TYPE, ElementType.CONSTRUCTOR, ElementType.METHOD, ElementType.FIELD})
  30. public @interface VisibleForTesting {
  31. /**
  32. * The intended {@link AccessModifier}.
  33. */
  34. AccessModifier otherwise();
  35. /**
  36. * A subset of <a href="https://docs.oracle.com/javase/specs/jls/se8/html/jls-6.html#jls-6.6.1">access modifiers</a>
  37. * that includes only values relevant to be used as the {@linkplain #otherwise() intended} access modifier.
  38. */
  39. enum AccessModifier {
  40. PRIVATE,
  41. PACKAGE,
  42. PROTECTED
  43. }
  44. }