IP Intelligence services for 51Degrees Pipeline

fiftyone.ipintelligence.examples.shared.PropertyHelper Class Reference

Static Public Member Functions

static< T > AspectPropertyValue< T > tryGet (Supplier< AspectPropertyValue< T > > supplier)
 Try to carry out a 'get' on a property getter, and catch a PropertyMissingException to avoid the example breaking if the resource key, or data file are not configured correctly by the user.
static String asStringProperty (AspectPropertyValue< String > property)
 Helper to get the value of an IP Intelligence string property.
static String asIntegerProperty (AspectPropertyValue< Integer > property)
 Helper to get the value of an IP Intelligence integer property.
static String asFloatProperty (AspectPropertyValue< Float > property)
 Helper to get the value of an IP Intelligence float property.
static String asIPAddressProperty (AspectPropertyValue< java.net.InetAddress > property)
 Helper to get the value of an IP Intelligence InetAddress property.
static String asWktStringProperty (AspectPropertyValue< WktString > property)
 Helper to get the value of an IP Intelligence WktString property.
static< T > String asString (AspectPropertyValue< T > value)
 Generic helper to get the value of a property as a string.
static< T > T firstValue (AspectPropertyValue< T > property)
 Helper to get the first raw value of an IP Intelligence property.

Static Public Attributes

static final String PRICING_MESSAGE
 Advisory logged once when a property has no value, as this is commonly because the resource key in use does not include the property.

Member Function Documentation

◆ asFloatProperty()

String fiftyone.ipintelligence.examples.shared.PropertyHelper.asFloatProperty ( AspectPropertyValue< Float > property)
static

Helper to get the value of an IP Intelligence float property.

Handles runtime List<IWeightedValue> values due to type erasure.

◆ asIntegerProperty()

String fiftyone.ipintelligence.examples.shared.PropertyHelper.asIntegerProperty ( AspectPropertyValue< Integer > property)
static

Helper to get the value of an IP Intelligence integer property.

Handles runtime List<IWeightedValue> values due to type erasure.

◆ asIPAddressProperty()

String fiftyone.ipintelligence.examples.shared.PropertyHelper.asIPAddressProperty ( AspectPropertyValue< java.net.InetAddress > property)
static

Helper to get the value of an IP Intelligence InetAddress property.

Handles runtime List<IWeightedValue> values due to type erasure.

◆ asString()

static< T > String fiftyone.ipintelligence.examples.shared.PropertyHelper.asString ( AspectPropertyValue< T > value)
static

Generic helper to get the value of a property as a string.

Used primarily for testing and simple property display.

Parameters
valuethe property value
<T>the type
Returns
a string representation of the value or a "no value" message

◆ asStringProperty()

String fiftyone.ipintelligence.examples.shared.PropertyHelper.asStringProperty ( AspectPropertyValue< String > property)
static

Helper to get the value of an IP Intelligence string property.

Handles runtime List<IWeightedValue> values due to type erasure.

◆ asWktStringProperty()

String fiftyone.ipintelligence.examples.shared.PropertyHelper.asWktStringProperty ( AspectPropertyValue< WktString > property)
static

Helper to get the value of an IP Intelligence WktString property.

Handles runtime List<IWeightedValue> values due to type erasure.

◆ firstValue()

static< T > T fiftyone.ipintelligence.examples.shared.PropertyHelper.firstValue ( AspectPropertyValue< T > property)
static

Helper to get the first raw value of an IP Intelligence property.

Due to Java generics type erasure, the on-premise engine may return List<IWeightedValue<T>> even when the declared type is T. This method unwraps such values and returns the first one, which is useful when the typed value is needed for further calculation rather than for display.

Parameters
propertythe property value
<T>the declared type of the property
Returns
the first unwrapped value, or null when there is no value

◆ tryGet()

static< T > AspectPropertyValue< T > fiftyone.ipintelligence.examples.shared.PropertyHelper.tryGet ( Supplier< AspectPropertyValue< T > > supplier)
static

Try to carry out a 'get' on a property getter, and catch a PropertyMissingException to avoid the example breaking if the resource key, or data file are not configured correctly by the user.

Parameters
supplierto use e.g. IPIntelligenceData::getIsMobile()
Returns
value

Member Data Documentation

◆ PRICING_MESSAGE

final String fiftyone.ipintelligence.examples.shared.PropertyHelper.PRICING_MESSAGE
static
Initial value:
= "Some properties used " +
"by this example are not available with a free resource key. " +
"See /pricing?utm_source=code&utm_medium=example&utm_campaign=51degrees-java&utm_content=shared-src-main-java-fiftyone-ipintelligence-examples-shared-propertyhelper.java&utm_term=pricing_message to get a paid subscription " +
"with more properties."

Advisory logged once when a property has no value, as this is commonly because the resource key in use does not include the property.