/*
(non-Javadoc)

@see
javax.persistence.metamodel.IdentifiableType#getDeclaredVersion(java.
lang.Class)
435293
@Override
    public <Y> SingularAttribute<X, Y> getDeclaredVersion(Class<Y> paramClass)
    {
        // TODO: Versioning not yet supported.
        throw new UnsupportedOperationException("Method not supported");
    }
1008430
private Integer investigateVersionAndCheckForConflict(JPAObject newObject) throws EDBException {
        JPAEntry entry = newObject.getEntry(EDBConstants.MODEL_VERSION);
        String oid = newObject.getOID();
        Integer modelVersion = 0;

        if (entry != null) {
            modelVersion = Integer.parseInt(entry.getValue());
            Integer currentVersion = dao.getVersionOfOid(oid);
            if (!modelVersion.equals(currentVersion)) {
                try {
                    checkForConflict(newObject);
                } catch (EDBException e) {
                    LOGGER.info("conflict detected, user get informed");
                    throw new EDBException("conflict was detected. There is a newer version of the model with the oid "
                            + oid + " saved.");
                }
                modelVersion = currentVersion;
            }
        } else {
            modelVersion = dao.getVersionOfOid(oid);
        }

        return modelVersion;
    }
936191
public static Field getCasVersionColumn(Class<?> clazz) throws CasVersionNotMatchException {
		List<Field> fields = getColumns(clazz);
		Field casVersionField = null;
		for(Field field : fields) {
			Column column = field.getAnnotation(Column.class);
			if(column.casVersion()) {
				if(casVersionField != null) {
					throw new CasVersionNotMatchException("there are more than one casVersion column in a DO class");
				}
				casVersionField = field;
			}
		}
		return casVersionField;
	}
1290845
public static int getJavaCompilerVersion() {
		int cv = compilerVersion.get();
		if (cv != -1) return cv;
		
		/* Main algorithm: Use JavaCompiler's intended method to do this */ {
			Matcher m = VERSION_PARSER.matcher(JavaCompiler.version());
			if (m.matches()) {
				int major = Integer.parseInt(m.group(1));
				if (major == 1) {
					int minor = Integer.parseInt(m.group(2));
					return setVersion(minor);
				}
				if (major >= 9) return setVersion(major);
			}
		}
		
		/* Fallback algorithm one: Check Source's values. Lets hope oracle never releases a javac that recognizes future versions for -source */ {
			String name = Source.values()[Source.values().length - 1].name();
			Matcher m = SOURCE_PARSER.matcher(name);
			if (m.matches()) {
				int major = Integer.parseInt(m.group(1));
				if (major == 1) {
					int minor = Integer.parseInt(m.group(2));
					return setVersion(minor);
				}
				if (major >= 9) return setVersion(major);
			}
		}
		return setVersion(6);
	}
896292
@Override
    public int getDatabaseMajorVersion() throws SQLException
    {
        checkClosed();
        System.out.println("\n\n\nVERSION: " + versionString);
        return Integer.valueOf(versionString.split("\\.")[0]);
    }
945466
@Column(header = Messages.GUI_MODULES_HEADER_VERSION_0, width = 80, order = 30)
    public String getVersion() {

        return m_module.getVersion().toString();
    }
262325
public com.google.appengine.v1.VersionOrBuilder getVersionsOrBuilder(
      int index) {
    return versions_.get(index);
  }
429625
protected String getVersion() {

    Manifest manifest = ManifestLoader.loadManifest(getClass());
    String versionNumber = null;
    if (manifest != null) {
      versionNumber = ManifestLoader.getValue(manifest, Attributes.Name.IMPLEMENTATION_VERSION);
      if (versionNumber == null) {
        versionNumber = ManifestLoader.getValue(manifest, Attributes.Name.SPECIFICATION_VERSION);
      }
    }
    if (versionNumber == null) {
      versionNumber = SNAPSHOT;
    }
    return versionNumber;
  }
1278835
private static int getJavaVersion() {
		String version = System.getProperty("java.version");
		if (version == null) {
			return -1;
		} else {
			int index = version.indexOf('.');
			if (index > 0) {
				version = version.substring(0, index);
			}

			try {
				return Integer.parseInt(version);
			} catch (NumberFormatException ex) {
				return -1;
			}
		}
	}
148841
protected <Type extends JvmType> Type findDeclaredType(String clazzName, ITypeReferenceOwner owner) {
		@SuppressWarnings("unchecked")
		Type result = (Type) services.getTypeReferences().findDeclaredType(clazzName, owner.getContextResourceSet());
		return result;
	}
476473
public com.google.appengine.v1.Version getVersion() {
    return version_ == null ? com.google.appengine.v1.Version.getDefaultInstance() : version_;
  }
643029
public static VersionInfo getCLDRVersion() {
        // fetching this data should be idempotent.
        if(gCLDRVersion == null) {
            // from ZoneMeta.java
            UResourceBundle supplementalDataBundle = UResourceBundle.getBundleInstance(ICUData.ICU_BASE_NAME, "supplementalData", ICUResourceBundle.ICU_DATA_CLASS_LOADER);
            UResourceBundle cldrVersionBundle = supplementalDataBundle.get("cldrVersion");
            gCLDRVersion = VersionInfo.getInstance(cldrVersionBundle.getString());
        }
        return gCLDRVersion;
    }
1309568
public static String getVersion() {
		String version = EnvironmentInformation.class.getPackage().getImplementationVersion();
		return version != null ? version : UNKNOWN;
	}
300218
static int getMajorVersion(String javaSpecVersion) {
        try {
            if (javaSpecVersion.contains(".")) { //before jdk 9
                return Integer.parseInt(javaSpecVersion.split("\\.")[1]);
            } else {
                return Integer.parseInt(javaSpecVersion);
            }
        } catch (NumberFormatException e ){
            throw getUnableToParseVersionException(javaSpecVersion);
        }
    }
1055368
public ICalVersion toICalVersion() {
		if (minVersion == null && maxVersion != null) {
			return ICalVersion.get(maxVersion.toString());
		}
		return null;
	}
1363490
@Override
    public <Y> SingularAttribute<X, Y> getDeclaredId(Class<Y> paramClass)
    {
        if (idAttribute != null)
        {
            if (idAttribute.getJavaType().equals(paramClass) && !isIdClass)
            {
                return (SingularAttribute<X, Y>) idAttribute;
            }
        }

        onError();
        return null;
    }
606952
public static String getApplicationVersionFromJar(Class<?> _class, String _default) {
        try {
            Enumeration<URL> resources = _class.getClassLoader().getResources("META-INF/MANIFEST.MF");
            while (resources.hasMoreElements()) {

                Manifest manifest = new Manifest(resources.nextElement().openStream());
                Attributes attribs = manifest.getMainAttributes();
                String ver = attribs.getValue(Attributes.Name.IMPLEMENTATION_VERSION);
                if (ver == null) {
                	return _default;
                }

                String rev = attribs.getValue("Implementation-Revision");
                if (rev != null) {
                    ver += "-r" + rev;
                }
                return ver;

            }
        } catch (IOException _ex) {
        }

        return _default;
    }