You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

PluginClasspath.java 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*
  2. * Copyright (C) 2012-present the original author or authors.
  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.pf4j;
  17. import java.util.Arrays;
  18. import java.util.Collection;
  19. import java.util.HashSet;
  20. import java.util.Set;
  21. /**
  22. * The classpath of the plugin.
  23. * It contains {@code classes} directories (directories that contain classes files)
  24. * and {@code jars} directories (directories that contain jars files).
  25. *
  26. * @author Decebal Suiu
  27. */
  28. public class PluginClasspath {
  29. private Set<String> classesDirectories = new HashSet<>();
  30. private Set<String> jarsDirectories = new HashSet<>();
  31. public Set<String> getClassesDirectories() {
  32. return classesDirectories;
  33. }
  34. public PluginClasspath addClassesDirectories(String... classesDirectories) {
  35. return addClassesDirectories(Arrays.asList(classesDirectories));
  36. }
  37. public PluginClasspath addClassesDirectories(Collection<String> classesDirectories) {
  38. this.classesDirectories.addAll(classesDirectories);
  39. return this;
  40. }
  41. public Set<String> getJarsDirectories() {
  42. return jarsDirectories;
  43. }
  44. public PluginClasspath addJarsDirectories(String... jarsDirectories) {
  45. return addJarsDirectories(Arrays.asList(jarsDirectories));
  46. }
  47. public PluginClasspath addJarsDirectories(Collection<String> jarsDirectories) {
  48. this.jarsDirectories.addAll(jarsDirectories);
  49. return this;
  50. }
  51. }