1 /* Copyright (c) 2020 Matthias Bläsing, All Rights Reserved 2 * 3 * The contents of this file is dual-licensed under 2 4 * alternative Open Source/Free licenses: LGPL 2.1 or later and 5 * Apache License 2.0. (starting with JNA version 4.0.0). 6 * 7 * You can freely decide which license you want to apply to 8 * the project. 9 * 10 * You may obtain a copy of the LGPL License at: 11 * 12 * http://www.gnu.org/licenses/licenses.html 13 * 14 * A copy is also included in the downloadable source code package 15 * containing JNA, in file "LGPL2.1". 16 * 17 * You may obtain a copy of the Apache License at: 18 * 19 * http://www.apache.org/licenses/ 20 * 21 * A copy is also included in the downloadable source code package 22 * containing JNA, in file "AL2.0". 23 */ 24 25 package com.sun.jna.ant; 26 27 import java.util.HashSet; 28 import java.util.Set; 29 30 public class Opens { 31 private String packageName; 32 private String to; 33 getPackage()34 public String getPackage() { 35 return packageName; 36 } 37 setPackage(String packageName)38 public void setPackage(String packageName) { 39 this.packageName = packageName; 40 } 41 getBinaryPackageName()42 public String getBinaryPackageName() { 43 return packageName.replace(".", "/"); 44 } 45 getTo()46 public String getTo() { 47 return to; 48 } 49 setTo(String to)50 public void setTo(String to) { 51 this.to = to; 52 } 53 getToList()54 public String[] getToList() { 55 if(to == null) { 56 return null; 57 } else { 58 Set<String> toList = new HashSet<String>(); 59 for(String s: to.split(",")) { 60 String entry = s.trim(); 61 if(! entry.isEmpty()) { 62 toList.add(entry); 63 } 64 } 65 if(toList.isEmpty()) { 66 return null; 67 } else { 68 return toList.toArray(new String[0]); 69 } 70 } 71 } 72 73 @Override toString()74 public String toString() { 75 return "Opens{" + "packageName=" + packageName + ", to=" + to + '}'; 76 } 77 } 78