Separates apiGroupName for apiGroupName/apiGroupVersion combination.
@param apiVersion  The apiGroupVersion or apiGroupName/apiGroupVersion combo.
@return            Just the apiGroupName part without the apiGroupName, or null if no separator is found.
773830
private static String trimGroupOrNull(String apiVersion) {
    if (apiVersion != null && apiVersion.contains("/")) {
      String[] versionParts = apiVersion.split("/");
      return versionParts[0];
    }
    return null;
  }
628244
public static Version parseMavenVersion(String version) {
		if (Strings.isNullOrEmpty(version)) {
			return new Version(0, 0, 0);
		}

		// Detect the snapshot
		final boolean isSnapshot;
		final String coreVersion;
		Matcher matcher = Artifact.VERSION_FILE_PATTERN.matcher(version);
		if (matcher.matches()) {
			coreVersion = matcher.group(1);
			isSnapshot = true;
		} else {
			matcher = SNAPSHOT_VERSION_PATTERN.matcher(version);
			if (matcher.matches()) {
				coreVersion = matcher.group(1);
				isSnapshot = true;
			} else {
				coreVersion = version;
				isSnapshot = false;
			}
		}

		// Parse the numbers
		final String[] parts = coreVersion.split("[.]"); //$NON-NLS-1$
		final int[] numbers = new int[] {0, 0, 0};
		int i = 0;
		while (i < numbers.length && i < parts.length) {
			try {
				numbers[i] = Integer.parseInt(parts[i]);
				++i;
			} catch (Exception exception) {
				// Force the exit of the loop since a number cannot be find.
				i = numbers.length;
			}
		}
		// Reply
		if (isSnapshot) {
			return new Version(numbers[0], numbers[1], numbers[2], SNAPSHOT_QUALIFIER);
		}
		return new Version(numbers[0], numbers[1], numbers[2]);
	}
28291
public static ISEPAParser get(SepaVersion version) {
        ISEPAParser parser = null;

        String className = version.getParserClass();
        try {
            log.debug("trying to init SEPA parser: " + className);
            Class cl = Class.forName(className);
            parser = (ISEPAParser) cl.newInstance();
        } catch (Exception e) {
            String msg = "Error creating SEPA parser";
            throw new HBCI_Exception(msg, e);
        }
        return parser;
    }
842575
protected static String formatApiVersion(String version) {
        if (StringUtils.isBlank(version)) {
            return VERSION;
        } else {
            final Matcher matcher = VERSION_PATTERN.matcher(version);
            if (matcher.matches()) {
                return String.format("%s.%s", matcher.group(1), matcher.group(2));
            } else {
                return VERSION;
            }
        }
    }
1306189
public static String getVersion(Class<?> aClass, String groupId, String artifactId) {
        String version = null;
        // lets try find the maven property - as the Java API rarely works :)
        InputStream is = null;
        String fileName = "/META-INF/maven/" +
                groupId + "/" + artifactId +
                "/pom.properties";
        // try to load from maven properties first
        try {
            Properties p = new Properties();
            is = aClass.getResourceAsStream(fileName);
            if (is != null) {
                p.load(is);
                version = p.getProperty("version", "");
            }
        } catch (Exception e) {
            // ignore
        } finally {
            if (is != null) {
                IOHelper.close(is, fileName, LOG);
            }
        }
        if (version == null) {
            Package aPackage = aClass.getPackage();
            if (aPackage != null) {
                version = aPackage.getImplementationVersion();
                if (Strings.isBlank(version)) {
                    version = aPackage.getSpecificationVersion();
                }
            }
        }
        if (version == null) {
            Enumeration<URL> resources = null;
            try {
                resources = aClass.getClassLoader().getResources("META-INF/MANIFEST.MF");
            } catch (IOException e) {
                // ignore
            }
            if (resources != null) {
                String expectedBundleName = groupId + "." + artifactId;
                while (resources.hasMoreElements()) {
                    try {
                        Manifest manifest = new Manifest(resources.nextElement().openStream());
                        Attributes attributes = manifest.getMainAttributes();
                        String bundleName = attributes.getValue("Bundle-SymbolicName");
                        if (Objects.equals(expectedBundleName, bundleName)) {
                            version = attributes.getValue("Implementation-Version");
                            if (Strings.isNotBlank(version)) break;
                        }
                    } catch (IOException e) {
                        // ignore
                    }
                }
            }
        }
        return version;
    }
183798
public static Version parse(String version) {
        if (version == null) {
            throw new NullPointerException("version is null");
        }
        Version result = new Version();
        String[] numbers = version.split(".");
        for (int i = 0; i < numbers.length; i++) {
            String parts[] = numbers[i].split("-");
            int number = Integer.parseInt(parts[0]);
            StringBuilder label = new StringBuilder();
            for (int j = 1; j < parts.length; j++) {
                if ((i < numbers.length - 1) && (j < parts.length - 1)){
                    label.append('-').append(parts[j]);
                } else {
                    result.setSnapshot(parts[j].equalsIgnoreCase("SNAPSHOT"));
                }
            }
            result.append(number, label.toString());
        }
        return result;
    }
1087095
def _api_group_for_type(cls):
    
    _groups = {
        (u"v1beta1", u"Deployment"): u"extensions",
        (u"v1beta1", u"DeploymentList"): u"extensions",
        (u"v1beta1", u"ReplicaSet"): u"extensions",
        (u"v1beta1", u"ReplicaSetList"): u"extensions",
    }
    key = (
        cls.apiVersion,
        cls.__name__.rsplit(u".")[-1],
    )
    group = _groups.get(key, None)
    return group
928755
public static AddonId from(String name, String version, String apiVersion)
   {
      return AddonId.from(name, SingleVersion.valueOf(version),
                          apiVersion == null || apiVersion.trim().isEmpty() ?
                                  EmptyVersion.getInstance() :
                                  SingleVersion.valueOf(apiVersion));
   }
639854
public static short[] parseVersion(final String version) {
    final short[] values = new short[] {
        0, 0, 0, 0
    };
    if (version != null) {
      final StringBuffer buf = new StringBuffer(version);
      int start = 0;
      for (int i = 0; i < 4; i++) {
        int end = version.indexOf('.', start);
        if (end <= 0) {
          end = version.length();
          for (int j = end; j > start; j--) {
            final String part = buf.substring(start, end);
            try {
              values[i] = Short.parseShort(part);
              break;
            } catch (final NumberFormatException ex) {
              values[i] = 0;
            }
          }
          break;
        } else {
          final String part = buf.substring(start, end);
          try {
            values[i] = Short.parseShort(part);
            start = end + 1;
          } catch (final NumberFormatException ex) {
            break;
          }
        }
      }
    }
    return values;
  }
1192382
private String getApiIndex(String orgId, String apiId, String version) {
        return "API::" + orgId + "|" + apiId + "|" + version; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    }
366803
public <T> String resolveApitraryEntityId(T entity) {
		if (entity == null) {
			throw new ApitraryOrmIdDefinitionsException("Apitrary entity has not to be null.");
		}
		List<java.lang.reflect.Field> fields = ClassUtil.getAnnotatedFields(entity.getClass(), Id.class);
		if (fields.isEmpty()) {
			throw new ApitraryOrmIdDefinitionsException("Apitrary entity must own an annotated ID field.");
		}
		if (fields.size() > 1) {
			throw new ApitraryOrmIdDefinitionsException("Apitrary entity can not have more than one ID field.");
		}

		java.lang.reflect.Field field = fields.get(0);
		String id = ClassUtil.getValueOf(field, entity, entity.getClass(), String.class);
		if (id == null || id.isEmpty()) {
			throw new ApitraryOrmIdException("Entity lacks ID and is probably not persisted.");
		}
		return id;
	}
700770
@Override
	public List<CPSpecificationOption> findByGroupId(long groupId) {
		return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
	}
520457
private StringBuilder getAttributeGroupSignature(String[] interfaces, String apiName) {
        StringBuilder signature = new StringBuilder("<T::L" + elementType + "<TT;TZ;>;Z::" + elementTypeDesc + ">" + JAVA_OBJECT_DESC);

        if (interfaces.length == 0){
            signature.append("L").append(elementType).append("<TT;TZ;>;");
        } else {
            for (String anInterface : interfaces) {
                signature.append("L").append(getFullClassTypeName(anInterface, apiName)).append("<TT;TZ;>;");
            }
        }

        return signature;
    }
338910
public MockitoBundlesOption version( final String version )
    {
        ( (MavenArtifactUrlReference) ( (WrappedUrlProvisionOption) getDelegate() ).getUrlReference() ).version(
            version
        );
        return this;
    }
894617
protected String getApiId(String orgId, String apiId, String version) {
        return orgId + "|" + apiId + "|" + version; //$NON-NLS-1$ //$NON-NLS-2$
    }
24728
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;
   }
853135
public List<String> findObjectsInGroup(String groupName) {
        if (getObjectGroups().containsKey(groupName)) {
            return getObjectGroups().get(groupName);
        } else {
            return Collections.emptyList();
        }
    }