Class IPBlock
java.lang.Object
org.deltava.beans.system.IPBlock
- All Implemented Interfaces:
Serializable
,Comparable<IPBlock>
,GeoLocation
,Cacheable
A bean to store IP address block information.
- Since:
- 2.5
- Version:
- 10.3
- Author:
- Luke
- See Also:
-
Field Summary
Fields inherited from interface org.deltava.beans.GeoLocation
ALL, DEGREE_FEET, DEGREE_MILES, FEET_MILES, LAT_DIRECTIONS, LATITUDE, LON_DIRECTIONS, LONGITUDE, RADIAN_MILES
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncacheKey()
Returns the cache key for this object.int
boolean
Checks whether this IP block contains a specific IP address.Returns the base Address of the address block.int
getBits()
Returns the size of the address block.getCity()
Returns the city associated with this IP address.Returns the country associated with this IP address.int
getID()
Returns the block database ID.Returns the last Address of the address block.double
Returns the latitude of this location.Returns the city, region and country (if available).double
Returns the longitude of this location.int
Returns the geolocation accuracy radius.Returns the region/state associated with this IP address.int
getSize()
Returns the size of the block.getType()
Returns the IP address type.int
hashCode()
void
Updates the city associated with this address block.void
Updates the country associated with this address block.void
setLocation
(double lat, double lng) Updates the location of this address block.void
setRadius
(int radius) Sets the geolocaiton accuracy radius.void
Updates the region/state associated with this address block.toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.deltava.beans.GeoLocation
distanceFeet, distanceTo
-
Constructor Details
-
IPBlock
Initializes the bean.- Parameters:
id
- the block IDcidr
- the CIDRBlock address
-
-
Method Details
-
getAddress
Returns the base Address of the address block.- Returns:
- the base IP address
-
getLastAddress
Returns the last Address of the address block.- Returns:
- the last IP address
-
getBits
public int getBits()Returns the size of the address block.- Returns:
- the size of the block in bits
-
getID
public int getID()Returns the block database ID.- Returns:
- the ID
-
getSize
public int getSize()Returns the size of the block.- Returns:
- the number of addresses in the block
-
getType
-
getCountry
Returns the country associated with this IP address.- Returns:
- the Country
- See Also:
-
getRegion
Returns the region/state associated with this IP address.- Returns:
- the region name
- See Also:
-
getCity
Returns the city associated with this IP address.- Returns:
- the city name
- See Also:
-
getLocation
Returns the city, region and country (if available).- Returns:
- the location
-
getRadius
public int getRadius()Returns the geolocation accuracy radius.- Returns:
- the radius in miles
-
getLatitude
public double getLatitude()Description copied from interface:GeoLocation
Returns the latitude of this location.- Specified by:
getLatitude
in interfaceGeoLocation
- Returns:
- the latitude in degrees
-
getLongitude
public double getLongitude()Description copied from interface:GeoLocation
Returns the longitude of this location.- Specified by:
getLongitude
in interfaceGeoLocation
- Returns:
- the longitude in degrees
-
contains
Checks whether this IP block contains a specific IP address.- Parameters:
addr
- the IP address- Returns:
- TRUE if the block contains the address, otherwise FALSE
-
setCountry
Updates the country associated with this address block.- Parameters:
c
- the Country- See Also:
-
setRegion
Updates the region/state associated with this address block.- Parameters:
rgn
- the region name- See Also:
-
setCity
Updates the city associated with this address block.- Parameters:
city
- the city name- See Also:
-
setLocation
public void setLocation(double lat, double lng) Updates the location of this address block.- Parameters:
lat
- the latitude in degreeslng
- the longitude in degrees
-
setRadius
public void setRadius(int radius) Sets the geolocaiton accuracy radius.- Parameters:
radius
- the radius in miles
-
cacheKey
-
hashCode
-
toString
-
compareTo
- Specified by:
compareTo
in interfaceComparable<IPBlock>
-