Class DiscriminatedProperties<P>
java.lang.Object
com.broadleafcommerce.tax.autoconfigure.DiscriminatedProperties<P>
- Type Parameters:
P
-
- Direct Known Subclasses:
SimpleTaxProperties
,TaxDelegateProperties
Mechanism to allow us to specify tax properties defined for different tenants and/or
applications. This is useful when different tenants or applications use different tax providers,
or where they have different credentials or company identifiers with those tax providers.
- Author:
- Kelly Tisdell (ktisdell)
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected <T> T
getField
(String fieldName, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected <T> T
Looks for a property based first on the applicaionId and then the tenantId and then with no discrimination.void
setApplication
(Map<String, P> application) void
-
Constructor Details
-
DiscriminatedProperties
public DiscriminatedProperties()
-
-
Method Details
-
getField
protected <T> T getField(String fieldName, @Nullable String applicationId, @Nullable String tenantId) Looks for a property based first on the applicaionId and then the tenantId and then with no discrimination. Assuming a properties prefix of 'broadleaf.tax.provider.simple', if you pass in a fieldName of 'foo', an applicationId of 'abc', and a tenantId of '123, this will search for the following, in order:- broadleaf.tax.provider.simple.application.abc.foo
- broadleaf.tax.provider.simple.tenant.xyz.foo
- broadleaf.tax.provider.simple.foo
- broadleaf.tax.provider.simple.application.abc.username=abcUserName
- broadleaf.tax.provider.simple.username=genericUserName
- broadleaf.tax.provider.simple.password=genericPassword
getApplication()
andgetTenant()
directly to manually resolve properties as needed.- Type Parameters:
T
-- Parameters:
fieldName
-applicationId
-tenantId
-- Returns:
-
getField
protected <T> T getField(String fieldName, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
getApplication
-
setApplication
-
getTenant
-
setTenant
-