Class TaxModelRegistry
java.lang.Object
neqsim.process.fielddevelopment.economics.TaxModelRegistry
Registry of tax model parameters for different countries and regions.
This class provides a centralized database of fiscal regime parameters for various oil and gas producing countries. Parameters are loaded from a JSON resource file at startup and can be extended with custom parameters at runtime.
Data Source
Parameters are loaded from data/fiscal/fiscal_parameters.json in the classpath. If the
file is not found or cannot be parsed, hardcoded defaults are used as fallback.
Predefined Countries
- NO - Norway (Norwegian Continental Shelf)
- UK - United Kingdom (UKCS)
- US-GOM - United States (Gulf of Mexico)
- BR - Brazil (Concession regime)
- BR-PSA - Brazil (Pre-Salt Production Sharing Agreement)
- BR-DW - Brazil (Deep Water with Special Participation)
- AO - Angola
- NG - Nigeria
- AU - Australia
- MY - Malaysia
- ID - Indonesia
- AE - United Arab Emirates
- CA-AB - Canada (Alberta)
- GY - Guyana
- EG - Egypt
- KZ - Kazakhstan
Example Usage
// Get Norway parameters
FiscalParameters norway = TaxModelRegistry.getParameters("NO");
// Create a tax model
TaxModel model = TaxModelRegistry.createModel("NO");
// Get all available countries
List<String> countries = TaxModelRegistry.getAvailableCountries();
// Register custom parameters
FiscalParameters custom = FiscalParameters.builder("CUSTOM").countryName("Custom Country")
.corporateTaxRate(0.30).build();
TaxModelRegistry.register(custom);
Customization
To add or modify country parameters:
- Edit the
data/fiscal/fiscal_parameters.jsonfile in resources - Or call
register(FiscalParameters)at runtime - Or call
loadFromJson(InputStream)to load a custom JSON file
Note: These parameters are for screening purposes only and should be validated against current regulations before making investment decisions.
- Version:
- 1.0
- Author:
- ESOL
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final StringPath to the JSON resource file.private static final org.apache.logging.log4j.LoggerLogger for this class.private static final Map<String, FiscalParameters> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic TaxModelcreateModel(String countryCode) Creates a tax model for a country.static Map<String, FiscalParameters> Gets all registered parameters.Gets list of available country codes.private static booleangetBooleanOrDefault(com.google.gson.JsonObject json, String key, boolean defaultValue) private static doublegetDoubleOrDefault(com.google.gson.JsonObject json, String key, double defaultValue) private static intgetIntOrDefault(com.google.gson.JsonObject json, String key, int defaultValue) static FiscalParametersgetParameters(String countryCode) Gets fiscal parameters for a country.static FiscalParametersgetParametersOrDefault(String countryCode, FiscalParameters fallback) Gets fiscal parameters for a country, with fallback.static intGets the number of registered countries.private static StringgetStringOrDefault(com.google.gson.JsonObject json, String key, String defaultValue) static StringGets a summary table of all registered countries.private static voidInitializes hardcoded default countries (fallback if JSON fails).static booleanisRegistered(String countryCode) Checks if a country is registered.static intloadFromJson(InputStream inputStream) Loads fiscal parameters from a JSON input stream.private static booleanLoads parameters from the default resource file.private static intparseAndRegisterJson(String jsonContent) Parses JSON content and registers all countries.private static FiscalParametersparseCountryJson(com.google.gson.JsonObject json) Parses a single country JSON object into FiscalParameters.private static FiscalParameters.DepreciationMethodparseDepreciationMethod(String value) private static FiscalParameters.FiscalSystemTypeparseFiscalSystemType(String value) private static FiscalParameters.RingFenceLevelparseRingFenceLevel(String value) static voidregister(FiscalParameters parameters) Registers custom fiscal parameters.static booleanreload()Reloads parameters from the resource file.private static StringrepeatChar(char c, int n) Repeats a character n times (Java 8 compatible).private static StringTruncates a string.
-
Field Details
-
logger
private static final org.apache.logging.log4j.Logger loggerLogger for this class. -
JSON_RESOURCE_PATH
-
REGISTRY
-
-
Constructor Details
-
TaxModelRegistry
private TaxModelRegistry()
-
-
Method Details
-
getParameters
Gets fiscal parameters for a country.- Parameters:
countryCode- country code (e.g., "NO", "UK", "US-GOM")- Returns:
- fiscal parameters, or null if not found
-
getParametersOrDefault
public static FiscalParameters getParametersOrDefault(String countryCode, FiscalParameters fallback) Gets fiscal parameters for a country, with fallback.- Parameters:
countryCode- country codefallback- fallback parameters if country not found- Returns:
- fiscal parameters
-
createModel
Creates a tax model for a country.- Parameters:
countryCode- country code- Returns:
- tax model instance
- Throws:
IllegalArgumentException- if country not found
-
register
Registers custom fiscal parameters.- Parameters:
parameters- parameters to register
-
getAvailableCountries
-
getAllParameters
Gets all registered parameters.- Returns:
- unmodifiable map of all parameters
-
isRegistered
Checks if a country is registered.- Parameters:
countryCode- country code- Returns:
- true if registered
-
getRegisteredCount
public static int getRegisteredCount()Gets the number of registered countries.- Returns:
- number of countries
-
reload
public static boolean reload()Reloads parameters from the resource file.- Returns:
- true if successfully loaded
-
loadFromJson
Loads fiscal parameters from a JSON input stream.This method can be used to load parameters from a custom JSON file.
- Parameters:
inputStream- JSON input stream- Returns:
- number of countries loaded
- Throws:
IllegalArgumentException- if JSON is invalid
-
loadFromResource
private static boolean loadFromResource()Loads parameters from the default resource file.- Returns:
- true if loaded successfully
-
parseAndRegisterJson
Parses JSON content and registers all countries.- Parameters:
jsonContent- JSON string- Returns:
- number of countries registered
-
parseCountryJson
Parses a single country JSON object into FiscalParameters.- Parameters:
json- country JSON object- Returns:
- FiscalParameters instance
-
getStringOrDefault
-
getDoubleOrDefault
private static double getDoubleOrDefault(com.google.gson.JsonObject json, String key, double defaultValue) -
getIntOrDefault
-
getBooleanOrDefault
private static boolean getBooleanOrDefault(com.google.gson.JsonObject json, String key, boolean defaultValue) -
parseFiscalSystemType
-
parseDepreciationMethod
-
parseRingFenceLevel
-
initializeHardcodedDefaults
private static void initializeHardcodedDefaults()Initializes hardcoded default countries (fallback if JSON fails). -
getSummaryTable
Gets a summary table of all registered countries.- Returns:
- formatted table string
-
repeatChar
Repeats a character n times (Java 8 compatible).- Parameters:
c- character to repeatn- number of times- Returns:
- repeated string
-
truncate
-