package com.company.sakila.db0.sakila.address.generated;
import com.company.sakila.db0.sakila.address.Address;
import com.company.sakila.db0.sakila.city.City;
import com.speedment.common.annotation.GeneratedCode;
import com.speedment.runtime.config.identifier.ColumnIdentifier;
import com.speedment.runtime.config.identifier.TableIdentifier;
import com.speedment.runtime.core.manager.Manager;
import com.speedment.runtime.core.util.OptionalUtil;
import com.speedment.runtime.field.ComparableField;
import com.speedment.runtime.field.IntField;
import com.speedment.runtime.field.IntForeignKeyField;
import com.speedment.runtime.field.ReferenceField;
import com.speedment.runtime.field.StringField;
import com.speedment.runtime.typemapper.TypeMapper;
import java.sql.Blob;
import java.sql.Timestamp;
import java.util.Optional;
/**
* The generated base for the {@link
* com.company.sakila.db0.sakila.address.Address}-interface representing
* entities of the {@code address}-table in the database.
* <p>
* This file has been automatically generated by Speedment. Any changes made to
* it will be overwritten.
*
* @author Speedment
*/
@GeneratedCode("Speedment")
public interface GeneratedAddress {
/**
* This Field corresponds to the {@link Address} field that can be obtained
* using the {@link Address#getAddressId()} method.
*/
final IntField<Address, Integer> ADDRESS_ID = IntField.create(
Identifier.ADDRESS_ID,
Address::getAddressId,
Address::setAddressId,
TypeMapper.primitive(),
true
);
/**
* This Field corresponds to the {@link Address} field that can be obtained
* using the {@link Address#getAddress()} method.
*/
final StringField<Address, String> ADDRESS = StringField.create(
Identifier.ADDRESS,
Address::getAddress,
Address::setAddress,
TypeMapper.identity(),
false
);
/**
* This Field corresponds to the {@link Address} field that can be obtained
* using the {@link Address#getAddress2()} method.
*/
final StringField<Address, String> ADDRESS2 = StringField.create(
Identifier.ADDRESS2,
o -> OptionalUtil.unwrap(o.getAddress2()),
Address::setAddress2,
TypeMapper.identity(),
false
);
/**
* This Field corresponds to the {@link Address} field that can be obtained
* using the {@link Address#getDistrict()} method.
*/
final StringField<Address, String> DISTRICT = StringField.create(
Identifier.DISTRICT,
Address::getDistrict,
Address::setDistrict,
TypeMapper.identity(),
false
);
/**
* This Field corresponds to the {@link Address} field that can be obtained
* using the {@link Address#getCityId()} method.
*/
final IntForeignKeyField<Address, Integer, City> CITY_ID = IntForeignKeyField.create(
Identifier.CITY_ID,
Address::getCityId,
Address::setCityId,
City.CITY_ID,
TypeMapper.primitive(),
false
);
/**
* This Field corresponds to the {@link Address} field that can be obtained
* using the {@link Address#getPostalCode()} method.
*/
final StringField<Address, String> POSTAL_CODE = StringField.create(
Identifier.POSTAL_CODE,
o -> OptionalUtil.unwrap(o.getPostalCode()),
Address::setPostalCode,
TypeMapper.identity(),
false
);
/**
* This Field corresponds to the {@link Address} field that can be obtained
* using the {@link Address#getPhone()} method.
*/
final StringField<Address, String> PHONE = StringField.create(
Identifier.PHONE,
Address::getPhone,
Address::setPhone,
TypeMapper.identity(),
false
);
/**
* This Field corresponds to the {@link Address} field that can be obtained
* using the {@link Address#getLocation()} method.
*/
final ReferenceField<Address, Blob, Blob> LOCATION = ReferenceField.create(
Identifier.LOCATION,
Address::getLocation,
Address::setLocation,
TypeMapper.identity(),
false
);
/**
* This Field corresponds to the {@link Address} field that can be obtained
* using the {@link Address#getLastUpdate()} method.
*/
final ComparableField<Address, Timestamp, Timestamp> LAST_UPDATE = ComparableField.create(
Identifier.LAST_UPDATE,
Address::getLastUpdate,
Address::setLastUpdate,
TypeMapper.identity(),
false
);
/**
* Returns the addressId of this Address. The addressId field corresponds to
* the database column db0.sakila.address.address_id.
*
* @return the addressId of this Address
*/
int getAddressId();
/**
* Returns the address of this Address. The address field corresponds to the
* database column db0.sakila.address.address.
*
* @return the address of this Address
*/
String getAddress();
/**
* Returns the address2 of this Address. The address2 field corresponds to
* the database column db0.sakila.address.address2.
*
* @return the address2 of this Address
*/
Optional<String> getAddress2();
/**
* Returns the district of this Address. The district field corresponds to
* the database column db0.sakila.address.district.
*
* @return the district of this Address
*/
String getDistrict();
/**
* Returns the cityId of this Address. The cityId field corresponds to the
* database column db0.sakila.address.city_id.
*
* @return the cityId of this Address
*/
int getCityId();
/**
* Returns the postalCode of this Address. The postalCode field corresponds
* to the database column db0.sakila.address.postal_code.
*
* @return the postalCode of this Address
*/
Optional<String> getPostalCode();
/**
* Returns the phone of this Address. The phone field corresponds to the
* database column db0.sakila.address.phone.
*
* @return the phone of this Address
*/
String getPhone();
/**
* Returns the location of this Address. The location field corresponds to
* the database column db0.sakila.address.location.
*
* @return the location of this Address
*/
Blob getLocation();
/**
* Returns the lastUpdate of this Address. The lastUpdate field corresponds
* to the database column db0.sakila.address.last_update.
*
* @return the lastUpdate of this Address
*/
Timestamp getLastUpdate();
/**
* Sets the addressId of this Address. The addressId field corresponds to
* the database column db0.sakila.address.address_id.
*
* @param addressId to set of this Address
* @return this Address instance
*/
Address setAddressId(int addressId);
/**
* Sets the address of this Address. The address field corresponds to the
* database column db0.sakila.address.address.
*
* @param address to set of this Address
* @return this Address instance
*/
Address setAddress(String address);
/**
* Sets the address2 of this Address. The address2 field corresponds to the
* database column db0.sakila.address.address2.
*
* @param address2 to set of this Address
* @return this Address instance
*/
Address setAddress2(String address2);
/**
* Sets the district of this Address. The district field corresponds to the
* database column db0.sakila.address.district.
*
* @param district to set of this Address
* @return this Address instance
*/
Address setDistrict(String district);
/**
* Sets the cityId of this Address. The cityId field corresponds to the
* database column db0.sakila.address.city_id.
*
* @param cityId to set of this Address
* @return this Address instance
*/
Address setCityId(int cityId);
/**
* Sets the postalCode of this Address. The postalCode field corresponds to
* the database column db0.sakila.address.postal_code.
*
* @param postalCode to set of this Address
* @return this Address instance
*/
Address setPostalCode(String postalCode);
/**
* Sets the phone of this Address. The phone field corresponds to the
* database column db0.sakila.address.phone.
*
* @param phone to set of this Address
* @return this Address instance
*/
Address setPhone(String phone);
/**
* Sets the location of this Address. The location field corresponds to the
* database column db0.sakila.address.location.
*
* @param location to set of this Address
* @return this Address instance
*/
Address setLocation(Blob location);
/**
* Sets the lastUpdate of this Address. The lastUpdate field corresponds to
* the database column db0.sakila.address.last_update.
*
* @param lastUpdate to set of this Address
* @return this Address instance
*/
Address setLastUpdate(Timestamp lastUpdate);
/**
* Queries the specified manager for the referenced City. If no such City
* exists, an {@code NullPointerException} will be thrown.
*
* @param foreignManager the manager to query for the entity
* @return the foreign entity referenced
*/
City findCityId(Manager<City> foreignManager);
enum Identifier implements ColumnIdentifier<Address> {
ADDRESS_ID ("address_id"),
ADDRESS ("address"),
ADDRESS2 ("address2"),
DISTRICT ("district"),
CITY_ID ("city_id"),
POSTAL_CODE ("postal_code"),
PHONE ("phone"),
LOCATION ("location"),
LAST_UPDATE ("last_update");
private final String columnName;
private final TableIdentifier<Address> tableIdentifier;
Identifier(String columnName) {
this.columnName = columnName;
this.tableIdentifier = TableIdentifier.of( getDbmsName(),
getSchemaName(),
getTableName());
}
@Override
public String getDbmsName() {
return "db0";
}
@Override
public String getSchemaName() {
return "sakila";
}
@Override
public String getTableName() {
return "address";
}
@Override
public String getColumnName() {
return this.columnName;
}
@Override
public TableIdentifier<Address> asTableIdentifier() {
return this.tableIdentifier;
}
}
}