/** * Create an {@link AddonId} from the given name, {@link Version}, and API {@link Version}. */ public static AddonId from(String name, Version version, Version apiVersion) { Assert.notNull(name, "Name cannot be null."); if (name.trim().isEmpty()) throw new IllegalArgumentException("Name cannot be empty."); Assert.notNull(version, "Version cannot be null."); if (version.toString().trim().isEmpty()) throw new IllegalArgumentException("Version cannot be empty."); AddonId id = new AddonId(); id.name = name; id.version = version; if (apiVersion == null || apiVersion.toString().trim().isEmpty()) id.apiVersion = EmptyVersion.getInstance(); else id.apiVersion = apiVersion; return id; }
/** * Create an {@link AddonId} from the given name, version, and API version. */ public static AddonId from(String name, String version, String apiVersion) { Assert.notNull(name, "Name cannot be null."); if (name.trim().isEmpty()) throw new IllegalArgumentException("Name cannot be empty."); Assert.notNull(version, "Version cannot be null."); if (version.trim().isEmpty()) throw new IllegalArgumentException("Version cannot be empty."); AddonId id = new AddonId(); id.name = name; id.version = SingleVersion.valueOf(version); if (apiVersion == null || apiVersion.trim().isEmpty()) id.apiVersion = EmptyVersion.getInstance(); else id.apiVersion = SingleVersion.valueOf(apiVersion); return id; }