com.neeve.adm.runtime
Class AdmCompatibility

java.lang.Object
  extended by com.neeve.adm.runtime.AdmCompatibility

public class AdmCompatibility
extends Object

Holds the COMPATIBILITY_LEVEL of the code generated from the AdmModel.

The current platform compatibility level is: "3.8.0"

The ADM compatibility level is of the form [MAJOR].[MINOR].[PATCH]. This version is added to the AdmGenerated annotation's compatLevel property. The ADM COMPATIBILITY_LEVEL is versioned separately from the rest of the and does not correspond directly to the platform version. Modules in platform code are corresponding versioned with their ADM api compatibility.

Bump in patch version

For the same major and minor versions, two differing patch versions must be API compatible at runtime even if the patch version differs. This relation holds true for platform code compiled as 2.0.0 and code generated by a later version of the platform at 2.0.1. The older platform code must be able to operate with the newer platform code.

A bump in patch version may be used by a newer version to indicate that the generated code supports additional APIs or capabilities. For example, perhaps in 2.0.1 messages are generated to implement new formatting in its Json representation or with some new accessor apis that are available by reflection.

Generated 2.0.0Generated 2.0.1
Platform 2.0.0
Platform 2.0.1

Bump in minor version

A bump in minor version indicates that newly generated code is not api compatible with previous versions of the platform, but that a newer version of the platform can still operate with previously generated code with the same MAJOR version.

An example of such a case would be when code generated with version 2.0.1 relies on new platform APIs that are not available in previous versions of the runtime and would thus fail with a NoSuchMethodException when operating with an older version of the platform. Another example of this case would be if the newer version of the code relies on some semantic behavior change in the existing platform API that would not be provided by an older version of the platform.

Generated 2.0.0Generated 2.1.0
Platform 2.0.0
Platform 2.1.0

Bump in major version

A bump in major version means that generated code is not backwards or forwards compatible with the platform. A newer version of the platform can't operate with code generated with an older major version and an older version of the platform can't operate with a newer version of generated code.

An example of this case would be where there are breaking API changes in the generated API, for example 3.0.0 might introduce a new method

Generated 2.0.0Generated 3.0.0
Platform 2.0.0
Platform 3.0.0


Field Summary
static String COMPATIBILITY_LEVEL
          The current ADM compatibility level ("3.8.0").
static String PROP_DISABLE_COMPATIBILITY_CHECKS
          Setting this property to true in the XRuntime will cause runtime compatibility checks to be skipped.
 
Constructor Summary
AdmCompatibility()
           
 
Method Summary
static void assertRuntimeCompatibility(String platformCompatLevel, Class<?> type)
          Assert that the given object is AdmGenerated and is compatible according to the specified platform compatibility level.
static void assertRuntimeCompatibility(String platformCompatLevel, Object object)
          Assert that the given object is AdmGenerated and is compatible according to the specified platform compatibility level.
static void getAdmGenerationDetails(Class<?> candidate, StringBuilder builder)
          Gets ADM Code generation details for the given class if available.
static boolean isRuntimeCompatible(String platformCompatLevel, String admCompatLevel)
          Assert that the given object is AdmGenerated and is compatible according to the specified platform compatibility level.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROP_DISABLE_COMPATIBILITY_CHECKS

public static final String PROP_DISABLE_COMPATIBILITY_CHECKS
Setting this property to true in the XRuntime will cause runtime compatibility checks to be skipped.

See Also:
Constant Field Values

COMPATIBILITY_LEVEL

public static final String COMPATIBILITY_LEVEL
The current ADM compatibility level ("3.8.0").

See Also:
AdmCompatibility, Constant Field Values
Constructor Detail

AdmCompatibility

public AdmCompatibility()
Method Detail

assertRuntimeCompatibility

public static final void assertRuntimeCompatibility(String platformCompatLevel,
                                                    Class<?> type)
Assert that the given object is AdmGenerated and is compatible according to the specified platform compatibility level.

Parameters:
platformCompatLevel - The platform compatibility level.
type - The AdmGenerated annotated class to check.

assertRuntimeCompatibility

public static final void assertRuntimeCompatibility(String platformCompatLevel,
                                                    Object object)
Assert that the given object is AdmGenerated and is compatible according to the specified platform compatibility level.

Parameters:
platformCompatLevel - The platform compatibility level.
object - The AdmGenerated annotated object to check.

isRuntimeCompatible

public static final boolean isRuntimeCompatible(String platformCompatLevel,
                                                String admCompatLevel)
Assert that the given object is AdmGenerated and is compatible according to the specified platform compatibility level.

Parameters:
platformCompatLevel - The platform compatibility level.
admCompatLevel - The admCompatLevel to check.

getAdmGenerationDetails

public static void getAdmGenerationDetails(Class<?> candidate,
                                           StringBuilder builder)
Gets ADM Code generation details for the given class if available.

Parameters:
candidate - The class for which to display the code generation details.
builder - The builder into which to print results.


Copyright © 2016 Neeve Research, LLC. All Rights Reserved.