Package | Description |
---|---|
org.javalite.activejdbc |
ActiveJDBC - the agile Java ORM.
|
org.javalite.activejdbc.associations |
Contains classes describing various association types.
|
org.javalite.activejdbc.models |
Modifier and Type | Class and Description |
---|---|
class |
CallbackAdapter<T extends Model> |
interface |
CallbackListener<T extends Model> |
class |
LazyList<T extends Model>
While this class is public, it is never instantiated directly.
|
interface |
ModelListener<T extends Model> |
class |
Paginator<T extends Model>
This class supports pagination of result sets in ActiveJDBC.
|
static class |
Paginator.PaginatorBuilder<T extends Model>
Provides a builder pattern to create new instances of paginator.
|
class |
ScopeBuilder<T extends Model> |
class |
SuperLazyList<T extends Model>
The purpose of this class is to provide
toMaps() method in cases of eager loading of dependencies. |
Modifier and Type | Method and Description |
---|---|
<T extends Model> |
Model.addModels(List<T> models)
Convenience method.
|
<T extends Model> |
ScopeBuilder.all()
Use in case the scopes define all criteria you need.
|
static <T extends Model> |
ModelDelegate.create(Class<T> clazz,
Object... namesAndValues) |
static <T extends Model> |
Model.create(Object... namesAndValues)
This is a convenience method to create a model instance already initialized with values.
|
static <T extends Model> |
ModelDelegate.createIt(Class<T> clazz,
Object... namesAndValues) |
static <T extends Model> |
Model.createIt(Object... namesAndValues)
This is a convenience method to
create(Object...) . |
<T extends Model> |
Model.deleteChildrenShallow(Class<T> clazz)
Deletes immediate children (does not walk the dependency tree).
|
static <T extends Model> |
Model.find(String subquery,
Object... params)
Synonym of
where(String, Object...) |
static <T extends Model> |
Model.findAll()
This method returns all records from this table.
|
static <T extends Model> |
ModelDelegate.findAll(Class<T> clazz) |
static <T extends Model> |
ModelDelegate.findByCompositeKeys(Class<T> clazz,
Object... values) |
static <T extends Model> |
Model.findByCompositeKeys(Object... values)
Composite PK values in exactly the same order as specified in
CompositePK . |
static <T extends Model> |
ModelDelegate.findById(Class<T> clazz,
Object id) |
static <T extends Model> |
Model.findById(Object id) |
static <T extends Model> |
ModelDelegate.findBySql(Class<T> clazz,
String fullQuery,
Object... params) |
static <T extends Model> |
Model.findBySQL(String fullQuery,
Object... params)
Free form query finder.
|
static <T extends Model> |
ModelDelegate.findFirst(Class<T> clazz,
String subQuery,
Object... params) |
static <T extends Model> |
Model.findFirst(String subQuery,
Object... params)
Synonym of
first(String, Object...) . |
static <T extends Model> |
ModelDelegate.findOrCreateIt(Class<T> clazz,
boolean save,
Object... namesAndValues) |
static <T extends Model> |
ModelDelegate.findOrCreateIt(Class<T> clazz,
Object... namesAndValues) |
static <T extends Model> |
Model.findOrCreateIt(Object... namesAndValues)
A convenience method to fetch existing model from db or to create and insert new record with attribute values.
|
static <T extends Model> |
ModelDelegate.findOrInit(Class<T> clazz,
Object... namesAndValues) |
static <T extends Model> |
Model.findOrInit(Object... namesAndValues)
A convenience method to fetch existing model from db or to create a new instance in memory initialized with
some attribute values.
|
static <T extends Model,M extends T> |
ModelDelegate.findWith(Class<M> clazz,
ModelListener<T> listener,
String query,
Object... params) |
static <T extends Model> |
Model.first(String subQuery,
Object... params)
Returns a first result for this condition.
|
<T extends Model> |
Model.fromMap(Map input)
Overrides attribute values from input map.
|
<C extends Model> |
Model.get(Class<C> targetModelClass,
String criteria,
Object... params)
Provides a list of child models in one to many, many to many and polymorphic associations, but in addition also allows to filter this list
by criteria.
|
<C extends Model> |
Model.getAll(Class<C> clazz)
This methods supports one to many, many to many relationships as well as polymorphic associations.
|
<E extends Model> |
SuperLazyList.include(Class<? extends Model>... classes) |
<E extends Model> |
LazyList.include(Class<? extends Model>... classes)
This method includes associated objects.
|
static <E extends Model> |
Paginator.instance()
Use to create a paginator instance, and provide arguments as needed.
|
<E extends Model> |
SuperLazyList.limit(long limit) |
<E extends Model> |
LazyList.limit(long limit)
This method limits the number of results in the resultset.
|
<E extends Model> |
SuperLazyList.load() |
<E extends Model> |
LazyList.load()
This method exists to force immediate load from DB.
|
<E extends Model> |
SuperLazyList.offset(long offset) |
<E extends Model> |
LazyList.offset(long offset)
This method sets an offset of a resultset.
|
<E extends Model> |
SuperLazyList.orderBy(String orderBy) |
<E extends Model> |
LazyList.orderBy(String orderBy)
Use this method to order results by a column.
|
<P extends Model> |
Model.parent(Class<P> parentClass)
Returns parent of this model, assuming that this table represents a child.
|
<P extends Model> |
Model.parent(Class<P> parentClass,
boolean cache)
Same as
parent(Class) , with additional argument. |
static <T extends Model> |
Model.scope(String scope)
Allows to specify multiple scopes as filters such as:
|
static <T extends Model> |
Model.scopes(String... scopes)
Allows to specify multiple scopes as filters such as:
|
<T extends Model> |
Model.set(Object... namesAndValues)
This is a convenience method to set multiple values to a model.
|
<T extends Model> |
Model.set(String attributeName,
Object value)
Sets a value of an attribute.
|
<T extends Model> |
Model.setBigDecimal(String attributeName,
Object value)
Sets attribute value as
java.math.BigDecimal . |
<T extends Model> |
Model.setBoolean(String attributeName,
Object value)
Sets attribute value as
Boolean . |
<T extends Model> |
Model.setDate(String attributeName,
Object value)
Sets attribute value as
java.sql.Date . |
<T extends Model> |
Model.setDouble(String attributeName,
Object value)
Sets attribute value as
Double . |
<T extends Model> |
Model.setFloat(String attributeName,
Object value)
Sets attribute value as
Float . |
<T extends Model> |
Model.setId(Object id)
Convenience method, sets ID value on this model, equivalent to
set(getIdName(), id) . |
<T extends Model> |
Model.setInteger(String attributeName,
Object value)
Sets attribute value as
Integer . |
<T extends Model> |
Model.setLong(String attributeName,
Object value)
Sets attribute value as
Long . |
<T extends Model> |
Model.setShort(String attributeName,
Object value)
Sets attribute value as
Short . |
<T extends Model> |
Model.setString(String attributeName,
Object value)
Sets attribute value as
String . |
<T extends Model> |
Model.setTime(String attributeName,
Object value)
Sets attribute value as
java.sql.Time . |
<T extends Model> |
Model.setTimestamp(String attributeName,
Object value)
Sets attribute value as
java.sql.Timestamp . |
static <T extends Model> |
ModelDelegate.where(Class<T> clazz,
String subquery,
Object... params) |
static <T extends Model> |
Model.where(String subquery,
Object... params)
Finder method for DB queries based on table represented by this model.
|
<T extends Model> |
ScopeBuilder.where(String subquery,
Object... params)
Applies additional criteria to scopes defined in the model.
|
Modifier and Type | Method and Description |
---|---|
Class<? extends Model> |
MetaModel.getModelClass() |
protected Class<? extends Model> |
Registry.getModelClass(String table,
boolean suppressException)
Returns model class for a table name, null if not found.
|
protected static Set<Class<? extends Model>> |
ModelFinder.getModelsForDb(String dbName) |
Modifier and Type | Method and Description |
---|---|
void |
Model.add(Model child)
Adds a new child dependency.
|
void |
Model.copyFrom(Model other)
Copies all attribute values (except for ID, created_at and updated_at) from other instance to this one.
|
void |
Model.copyTo(Model other)
Copies all attribute values (except for ID, created_at and updated_at) from this instance to the other.
|
int |
Model.remove(Model child)
Removes associated child from this instance.
|
protected void |
Model.setCachedParent(Model parent) |
void |
Model.setParent(Model parent)
Sets a parent on this instance.
|
void |
Model.setParents(Model... parents)
Sets multiple parents on this instance.
|
Modifier and Type | Method and Description |
---|---|
static List<Association> |
ModelDelegate.associations(Class<? extends Model> clazz) |
static Set<String> |
ModelDelegate.attributeNames(Class<? extends Model> clazz) |
static boolean |
Model.belongsTo(Class<? extends Model> targetClass) |
static boolean |
ModelDelegate.belongsTo(Class<? extends Model> clazz,
Class<? extends Model> targetClass) |
static boolean |
ModelDelegate.belongsTo(Class<? extends Model> clazz,
Class<? extends Model> targetClass) |
static void |
ModelDelegate.blankToNull(Class<? extends Model> clazz,
String... attributeNames) |
static void |
ModelDelegate.callbackWith(Class<? extends Model> clazz,
CallbackListener... listeners) |
static void |
ModelDelegate.convertWith(Class<? extends Model> clazz,
Converter converter,
String... attributeNames) |
static Long |
ModelDelegate.count(Class<? extends Model> clazz) |
static Long |
ModelDelegate.count(Class<? extends Model> clazz,
String query,
Object... params) |
static void |
ModelDelegate.dateFormat(Class<? extends Model> clazz,
DateFormat format,
String... attributeNames) |
static void |
ModelDelegate.dateFormat(Class<? extends Model> clazz,
String pattern,
String... attributeNames) |
static int |
ModelDelegate.delete(Class<? extends Model> clazz,
String query,
Object... params) |
static int |
ModelDelegate.deleteAll(Class<? extends Model> clazz) |
static boolean |
ModelDelegate.exists(Class<? extends Model> clazz,
Object id) |
<A extends Association> |
MetaModel.getAssociationForTarget(Class<? extends Model> targetClass)
Returns association of this table with the target table.
|
<A extends Association> |
MetaModel.getAssociationForTarget(Class<? extends Model> targetModelClass,
Class<A> associationClass)
Returns association of this table with the target table.
|
List<Association> |
MetaModel.getAssociationsForTarget(Class<? extends Model> targetModelClass)
Returns associations of this table with the target table.
|
protected static String |
MetaModel.getDbName(Class<? extends Model> modelClass) |
MetaModel |
Registry.getMetaModel(Class<? extends Model> modelClass) |
protected String |
Registry.getTableName(Class<? extends Model> modelClass) |
static List<Validator> |
Model.getValidators(Class<? extends Model> clazz) |
protected boolean |
MetaModel.hasAssociation(Class<? extends Model> targetClass,
Class<? extends Association> associationClass) |
boolean |
MetaModel.isAssociatedTo(Class<? extends Model> targetModelClass)
Checks if there is association to the target model class.,
|
static MetaModel |
ModelDelegate.metaModelOf(Class<? extends Model> clazz)
Returns
MetaModel associated with model class. |
static void |
ModelDelegate.purgeCache(Class<? extends Model> clazz) |
void |
MetaModel.removeAssociationForTarget(Class<? extends Model> modelClass) |
static void |
ModelDelegate.removeValidator(Class<? extends Model> clazz,
Validator validator) |
protected void |
Model.setChildren(Class childClass,
List<Model> children) |
static String |
ModelDelegate.tableNameOf(Class<? extends Model> clazz) |
static void |
ModelDelegate.timestampFormat(Class<? extends Model> clazz,
DateFormat format,
String... attributeNames) |
static void |
ModelDelegate.timestampFormat(Class<? extends Model> clazz,
String pattern,
String... attributeNames) |
static int |
ModelDelegate.update(Class<? extends Model> clazz,
String updates,
String conditions,
Object... params) |
static int |
ModelDelegate.updateAll(Class<? extends Model> clazz,
String updates,
Object... params) |
static ValidationBuilder |
ModelDelegate.validateEmailOf(Class<? extends Model> clazz,
String attributeName) |
static NumericValidationBuilder |
ModelDelegate.validateNumericalityOf(Class<? extends Model> clazz,
String... attributeNames) |
static ValidationBuilder |
ModelDelegate.validatePresenceOf(Class<? extends Model> clazz,
String... attributeNames) |
static ValidationBuilder |
ModelDelegate.validateRange(Class<? extends Model> clazz,
String attributeName,
Number min,
Number max) |
static ValidationBuilder |
ModelDelegate.validateRegexpOf(Class<? extends Model> clazz,
String attributeName,
String pattern) |
static ValidationBuilder |
ModelDelegate.validateWith(Class<? extends Model> clazz,
Validator validator) |
static List<Validator> |
ModelDelegate.validatorsOf(Class<? extends Model> clazz) |
static void |
ModelDelegate.zeroToNull(Class<? extends Model> clazz,
String... attributeNames) |
Constructor and Description |
---|
FrozenException(Model model) |
Constructor and Description |
---|
MetaModel(String dbName,
Class<? extends Model> modelClass,
String dbType) |
Modifier and Type | Method and Description |
---|---|
Class<? extends Model> |
Association.getSourceClass()
Returns source class of this association.
|
Class<? extends Model> |
Association.getTargetClass()
Returns target class of this association.
|
Constructor and Description |
---|
Association(Class<? extends Model> source,
Class<? extends Model> target) |
Association(Class<? extends Model> source,
Class<? extends Model> target) |
BelongsToAssociation(Class<? extends Model> source,
Class<? extends Model> target,
String fkName) |
BelongsToAssociation(Class<? extends Model> source,
Class<? extends Model> target,
String fkName) |
BelongsToPolymorphicAssociation(Class<? extends Model> sourceModelClass,
Class<? extends Model> targetModelClass,
String typeLabel,
String parentClassName) |
BelongsToPolymorphicAssociation(Class<? extends Model> sourceModelClass,
Class<? extends Model> targetModelClass,
String typeLabel,
String parentClassName) |
Many2ManyAssociation(Class<? extends Model> sourceModelClass,
Class<? extends Model> targetModelClass,
String join,
String sourceFkName,
String targetFkName) |
Many2ManyAssociation(Class<? extends Model> sourceModelClass,
Class<? extends Model> targetModelClass,
String join,
String sourceFkName,
String targetFkName) |
Many2ManyAssociation(Class<? extends Model> source,
Class<? extends Model> target,
String join,
String sourceFkName,
String targetFkName,
String targetPk) |
Many2ManyAssociation(Class<? extends Model> source,
Class<? extends Model> target,
String join,
String sourceFkName,
String targetFkName,
String targetPk) |
NotAssociatedException(Class<? extends Model> sourceClass,
Class<? extends Model> targetClass) |
NotAssociatedException(Class<? extends Model> sourceClass,
Class<? extends Model> targetClass) |
OneToManyAssociation(Class<? extends Model> sourceModelClass,
Class<? extends Model> targetModelClass,
String fkName) |
OneToManyAssociation(Class<? extends Model> sourceModelClass,
Class<? extends Model> targetModelClass,
String fkName) |
OneToManyPolymorphicAssociation(Class<? extends Model> source,
Class<? extends Model> target,
String typeLabel) |
OneToManyPolymorphicAssociation(Class<? extends Model> source,
Class<? extends Model> target,
String typeLabel) |
Modifier and Type | Class and Description |
---|---|
class |
Book |
class |
Library |
class |
Reader |
Copyright © 2020 JavaLite. All rights reserved.