EOEnterpriseObjectClazz< T extends EOEnterpriseObject > Class Reference
List of all members.
|
Classes |
| interface | ClazzFactory |
| class | DefaultClazzFactory |
Public Member Functions |
| NSArray< T > | allObjects (EOEditingContext ec) |
| EOClassDescription | classDescription () |
| T | createAndInsertObject (EOEditingContext ec) |
| ERXFetchSpecification< T > | createFetchSpecification (EOQualifier qualifier, NSArray< EOSortOrdering > sortings) |
| EOEntity | entity (EOEditingContext ec) |
| EOEntity | entity () |
| String | entityName () |
| | EOEnterpriseObjectClazz (String entityName) |
| | EOEnterpriseObjectClazz () |
| NSArray< T > | faultsFromRawRows (EOEditingContext ec, NSArray nsarray) |
| NSArray< T > | faultsMatchingQualifier (EOEditingContext ec, EOQualifier eoqualifier, NSArray< EOSortOrdering > sortOrderings) |
| NSArray< T > | faultsMatchingQualifier (EOEditingContext ec, EOQualifier eoqualifier) |
| NSArray< T > | faultsMatchingValues (EOEditingContext ec, NSDictionary nsdictionary, NSArray< EOSortOrdering > sortOrderings) |
| EOFetchSpecification | fetchSpecificationNamed (EOEditingContext ec, String name) |
| EOFetchSpecification | fetchSpecificationNamed (String name) |
| NSArray< T > | filteredArray (NSArray< T > array, EOFetchSpecification spec, NSDictionary bindings) |
| EOEnterpriseObjectClazz | init (String entityName) |
| EOArrayDataSource | newArrayDataSource (EOEditingContext ec) |
| EODatabaseDataSource | newDatabaseDataSource (EOEditingContext ec) |
| NSArray | newPrimaryKeys (EOEditingContext ec, int i) |
| Number | objectCountWithFetchSpecificationAndBindings (EOEditingContext ec, String fetchSpecName, NSDictionary bindings) |
| Number | objectCountWithQualifier (EOEditingContext ec, EOQualifier qualifier) |
| T | objectFromRawRow (EOEditingContext ec, NSDictionary dict) |
| T | objectMatchingKeyAndValue (EOEditingContext ec, String key, Object value) |
| NSArray< T > | objectsMatchingKeyAndValue (EOEditingContext ec, String key, Object value) |
| NSArray< T > | objectsMatchingQualifier (EOEditingContext ec, EOQualifier qualifier, NSArray< EOSortOrdering > sortOrdering) |
| NSArray< T > | objectsMatchingQualifier (EOEditingContext ec, EOQualifier qualifier) |
| NSArray< T > | objectsWithFetchSpecificationAndBindings (EOEditingContext ec, String name, NSDictionary bindings) |
| NSArray< T > | objectsWithQualifierFormat (EOEditingContext ec, String qualifier, NSArray args) |
| T | objectWithPrimaryKeyValue (EOEditingContext ec, Object pk) |
| EOFetchSpecification | primaryKeyFetchSpecificationForEntity (EOEditingContext ec, EOQualifier eoqualifier, NSArray sortOrderings, NSArray additionalKeys) |
| NSArray | primaryKeysMatchingQualifier (EOEditingContext ec, EOQualifier eoqualifier, NSArray sortOrderings) |
| NSArray | primaryKeysMatchingValues (EOEditingContext ec, NSDictionary nsdictionary, NSArray sortOrderings) |
Static Public Member Functions |
| static EOEnterpriseObjectClazz | clazzForEntityNamed (String entityName) |
| static ClazzFactory | factory () |
| static void | resetClazzCache () |
| static void | setFactory (ClazzFactory value) |
Static Public Attributes |
| static final Logger | log = Logger.getLogger(EOEnterpriseObjectClazz.class) |
Protected Member Functions |
| void | discoverEntityName () |
| String | entityNameFromRawRow (EOEditingContext ec, NSDictionary dict) |
| void | initialize () |
| void | setEntityName (String name) |
Static Protected Member Functions |
| static EOAttribute | objectCountAttribute () |
| static EOAttribute | objectCountUniqueAttribute (EOAttribute foo) |
Private Attributes |
| String | _entityName |
Static Private Attributes |
| static ClazzFactory | _factory = new DefaultClazzFactory() |
| static EOAttribute | _objectCountAttribute = null |
| static NSMutableDictionary | allClazzes = new NSMutableDictionary() |
Detailed Description
Adds class-level inheritance to EOF.
In Java, static methods are similar to class methods in Objective-C, but one cannot use static methods in interfaces and static methods cannot be overridden by a subclass. Using the clazz pattern removes those limitations.
Instead of using a static method, we can use a static inner class (a clazz) instead. This allows for the methods on the clazz to be available statically to the class. The advantage is that static utility methods don't need to be generated for every subclass of an EOEnterpriseObject. It is generally sufficient to simply use the utility methods available on the EOEnterpriseObjectClazz.
Every subclass of this class will get their own "ClazzObject" instance, so it's OK to store things which might be different in superclasses. That is, the "User"'s implementation can override the "Person"'s and because Person.clazz() will get it's own instance, it will do only "Person" things.
Use subclasses of EOEnterpriseObjectClazz as inner classes in your EO subclasses to work around the missing class object inheritance of java. They must be named XXX.XXXClazz to work.
The methods from EOUtilities are mirrored here so you don't have to import EOAccess in your subclasses, which is not legal for client-side classes. The implementation for a client-side class could then be easily switched to use the server-side EOUtilites implementation.
Constructor & Destructor Documentation
| EOEnterpriseObjectClazz |
( |
|
) |
|
Default public constructor. In case you let your code generate with a template, you can simply call:
public static FooClazz clazz = new FooClazz();
and the constructor will auto-discover
your entity name. This only works when you have a concrete subclass for the entity in question, though.
| EOEnterpriseObjectClazz |
( |
String |
entityName |
) |
|
Constructor that also supplies an entity name.
- Parameters:
-
Member Function Documentation
| NSArray<T> allObjects |
( |
EOEditingContext |
ec |
) |
|
Gets all of the objects for the clazz's entity. Just a cover method for the EOUtilities method objectsForEntityNamed.
- Parameters:
-
| ec | editingcontext to fetch the objects into |
- Returns:
- array of all the objects for a given entity name.
| EOClassDescription classDescription |
( |
|
) |
|
Returns the class description for the entity.
| static EOEnterpriseObjectClazz clazzForEntityNamed |
( |
String |
entityName |
) |
[static] |
Method used to get a clazz object for a given entity name. This method will cache the generated clazz object so that for a given entity name only one clazz object will be created.
- Parameters:
-
| entityName | name of the entity to get the Clazz object for |
- Returns:
- clazz object for the given entity
| T createAndInsertObject |
( |
EOEditingContext |
ec |
) |
|
Creates and inserts an object of the type of the clazz into the given editing context.
- Parameters:
-
- Returns:
- newly created and inserted object
| ERXFetchSpecification<T> createFetchSpecification |
( |
EOQualifier |
qualifier, |
|
|
NSArray< EOSortOrdering > |
sortings | |
|
) |
| | |
Creates a fetch spec for the entity.
- Returns:
- fetch specification for the given name and the clazz's entity name
| void discoverEntityName |
( |
|
) |
[protected] |
| EOEntity entity |
( |
EOEditingContext |
ec |
) |
|
Gets the entity corresponding to the entity name of the clazz.
- Parameters:
-
- Returns:
- entity for the clazz
Gets the entity corresponding to the entity name of the clazz.
- Returns:
- entity for the clazz
Gets the entity name of the clazz.
- Returns:
- entity name of the clazz.
| String entityNameFromRawRow |
( |
EOEditingContext |
ec, |
|
|
NSDictionary |
dict | |
|
) |
| | [protected] |
Utility method to get the entity name from a raw row dictionary, taking subclasses and restricting qualifiers into account.
- Parameters:
-
| ec | an editing context |
| dict | raw row dictionary |
- Returns:
- entity name, if any
| static ClazzFactory factory |
( |
|
) |
[static] |
| NSArray<T> faultsFromRawRows |
( |
EOEditingContext |
ec, |
|
|
NSArray |
nsarray | |
|
) |
| | |
Constructs an array of faults for a given array of primary keys in a given editing context for the clazz's entity.
- Parameters:
-
| ec | editing context to construct the faults in |
| nsarray | array of primary key dictionaries |
- Returns:
- array of faults for an array of primary key dictionaries.
| NSArray<T> faultsMatchingQualifier |
( |
EOEditingContext |
ec, |
|
|
EOQualifier |
eoqualifier, |
|
|
NSArray< EOSortOrdering > |
sortOrderings | |
|
) |
| | |
Fetches an array of faults matching a given qualifier and sorted by an array of sort orderings.
- Parameters:
-
| ec | editing context to use to fetch into |
| eoqualifier | qualifier to match against |
| sortOrderings | array of sort orderings to order the faults |
- Returns:
- array of faults that match the given qualifier
| NSArray<T> faultsMatchingQualifier |
( |
EOEditingContext |
ec, |
|
|
EOQualifier |
eoqualifier | |
|
) |
| | |
Fetches an array of faults matching a given qualifier.
- Parameters:
-
| ec | editing context to use to fetch into |
| eoqualifier | qualifier to match against |
- Returns:
- array of faults that match the given qualifier
| NSArray<T> faultsMatchingValues |
( |
EOEditingContext |
ec, |
|
|
NSDictionary |
nsdictionary, |
|
|
NSArray< EOSortOrdering > |
sortOrderings | |
|
) |
| | |
Fetches an array of faults for a given set of criteria.
- Parameters:
-
| ec | editing context to use to fetch into |
| nsdictionary | key value criteria to match against |
| sortOrderings | array of sort orderings to order the faults |
- Returns:
- array of faults that match the given criteria
| EOFetchSpecification fetchSpecificationNamed |
( |
EOEditingContext |
ec, |
|
|
String |
name | |
|
) |
| | |
Gets a fetch specification for a given name.
- Parameters:
-
| ec | editing context to use for finding the model group |
| name | of the fetch specification |
- Returns:
- fetch specification for the given name and the clazz's entity name
| EOFetchSpecification fetchSpecificationNamed |
( |
String |
name |
) |
|
Gets a fetch specification for a given name.
- Parameters:
-
| name | of the fetch specification |
- Returns:
- fetch specification for the given name and the clazz's entity name
| NSArray<T> filteredArray |
( |
NSArray< T > |
array, |
|
|
EOFetchSpecification |
spec, |
|
|
NSDictionary |
bindings | |
|
) |
| | |
Filters an array with a given fetch spec.
- Parameters:
-
| EOEnterpriseObjectClazz init |
( |
String |
entityName |
) |
|
Convenience init so you can chain constructor calls:
public static FooClazz clazz = (FooClazz)new FooClazz().init("Foo");
without having to override the default constructor or the one that takes an entity name. Also useful when you don't have a special clazz defined for
your entity, but would rather take one from a superclass.
- Parameters:
-
| void initialize |
( |
|
) |
[protected] |
Called by the constructor.
| EOArrayDataSource newArrayDataSource |
( |
EOEditingContext |
ec |
) |
|
Utility to return a new array datasource
- Parameters:
-
| EODatabaseDataSource newDatabaseDataSource |
( |
EOEditingContext |
ec |
) |
|
Utility to return a new database datasource
- Parameters:
-
| NSArray newPrimaryKeys |
( |
EOEditingContext |
ec, |
|
|
int |
i | |
|
) |
| | |
Generates an array of primary key values for the clazz's entity. Uses the database context for the entity's model and the given editingcontext.
- Parameters:
-
| ec | am editing context |
| i | number of primary keys to generate |
- Returns:
- array of new primary keys
| static EOAttribute objectCountAttribute |
( |
|
) |
[static, protected] |
Creates and caches an eo attribute that can be used to return the number of objects that a given fetch specification will return.
- Returns:
- eo count attribute
| static EOAttribute objectCountUniqueAttribute |
( |
EOAttribute |
foo |
) |
[static, protected] |
| Number objectCountWithFetchSpecificationAndBindings |
( |
EOEditingContext |
ec, |
|
|
String |
fetchSpecName, |
|
|
NSDictionary |
bindings | |
|
) |
| | |
Find the number of objects matching the given fetch specification and bindings for the clazz's entity name. Implementation wise the sql generated will only return the count of the query, not all of the rows matching the qualification.
- Parameters:
-
| ec | ec used to perform the count in |
| fetchSpecName | name of the fetch specification |
| bindings | dictionary of bindings for the fetch specification |
- Returns:
- number of objects matching the given fetch specification and bindings
| Number objectCountWithQualifier |
( |
EOEditingContext |
ec, |
|
|
EOQualifier |
qualifier | |
|
) |
| | |
Returns the number of objects matching the given qualifier for the clazz's entity name. Implementation wise this method will generate the correct sql to only perform a count, i.e. all of the objects wouldn't be pulled into memory.
- Parameters:
-
| ec | editing context to use for the count qualification |
| qualifier | to find the matching objects |
- Returns:
- number of matching objects
| T objectFromRawRow |
( |
EOEditingContext |
ec, |
|
|
NSDictionary |
dict | |
|
) |
| | |
Creates an enterprise object from a raw row for the clazz's entity in the given editing context.
- Parameters:
-
| ec | editing context to create the eo in |
| dict | raw row dictionary |
- Returns:
- enterprise object for the raw row
| T objectMatchingKeyAndValue |
( |
EOEditingContext |
ec, |
|
|
String |
key, |
|
|
Object |
value | |
|
) |
| | |
Fetches the object matching the given key and value corresponding to the clazz's entity using the given editing context. If more than one matches, throws a EOMoreThanOneException, otherwise returns null or the match.
- Parameters:
-
| ec | editing context |
| key | key string |
| value | value |
- Returns:
- array of objects corresponding to the passed in parameters.
| NSArray<T> objectsMatchingKeyAndValue |
( |
EOEditingContext |
ec, |
|
|
String |
key, |
|
|
Object |
value | |
|
) |
| | |
Fetches all of the objects matching the given key and value corresponding to the clazz's entity using the given editing context.
- Parameters:
-
| ec | editing context |
| key | key string |
| value | value |
- Returns:
- array of objects corresponding to the passed in parameters.
| NSArray<T> objectsMatchingQualifier |
( |
EOEditingContext |
ec, |
|
|
EOQualifier |
qualifier, |
|
|
NSArray< EOSortOrdering > |
sortOrdering | |
|
) |
| | |
| NSArray<T> objectsMatchingQualifier |
( |
EOEditingContext |
ec, |
|
|
EOQualifier |
qualifier | |
|
) |
| | |
| NSArray<T> objectsWithFetchSpecificationAndBindings |
( |
EOEditingContext |
ec, |
|
|
String |
name, |
|
|
NSDictionary |
bindings | |
|
) |
| | |
Fetches an array of objects for a given fetch specification and an array of bindings. The fetch specifiation is resolved off of the entity corresponding to the current clazz.
- Parameters:
-
| ec | editing content to fetch into |
| name | fetch specification name |
| bindings | used to resolve binding keys within the fetch specification |
- Returns:
- array of objects fetched using the given fetch specification
| NSArray<T> objectsWithQualifierFormat |
( |
EOEditingContext |
ec, |
|
|
String |
qualifier, |
|
|
NSArray |
args | |
|
) |
| | |
Fetches all of the objects matching the given qualifier format corresponding to the clazz's entity using the given editing context.
- Parameters:
-
| ec | editing context |
| qualifier | qualifier string |
| args | qualifier format arguments |
- Returns:
- array of objects corresponding to the passed in parameters.
| T objectWithPrimaryKeyValue |
( |
EOEditingContext |
ec, |
|
|
Object |
pk | |
|
) |
| | |
Fetches the enterprise object for the specified primary key value and corresponding to the clazz's entity name.
- Parameters:
-
| ec | editing context to fetch into |
| pk | primary key value. Compound primary keys are given as NSDictionaries. |
- Returns:
- enterprise object for the specified primary key value.
| EOFetchSpecification primaryKeyFetchSpecificationForEntity |
( |
EOEditingContext |
ec, |
|
|
EOQualifier |
eoqualifier, |
|
|
NSArray |
sortOrderings, |
|
|
NSArray |
additionalKeys | |
|
) |
| | |
Constructs a fetch specification that will only fetch the primary keys for a given qualifier.
- Parameters:
-
| ec | editing context, not used |
| eoqualifier | to construct the fetch spec with |
| sortOrderings | array of sort orderings to sort the result set with. |
| additionalKeys | array of additional key paths to construct the raw rows key paths to fetch. |
- Returns:
- fetch specification that can be used to fetch primary keys for a given qualifier and sort orderings.
| NSArray primaryKeysMatchingQualifier |
( |
EOEditingContext |
ec, |
|
|
EOQualifier |
eoqualifier, |
|
|
NSArray |
sortOrderings | |
|
) |
| | |
Fetches an array of primary keys matching a given qualifier and sorted with a given array of sort orderings.
- Parameters:
-
| ec | editing context to fetch into |
| eoqualifier | to restrict matching primary keys |
| sortOrderings | array of sort orders to sort result set |
- Returns:
- array of primary keys matching a given qualifier
| NSArray primaryKeysMatchingValues |
( |
EOEditingContext |
ec, |
|
|
NSDictionary |
nsdictionary, |
|
|
NSArray |
sortOrderings | |
|
) |
| | |
Fetches an array of primary keys matching the values in a given dictionary.
- Parameters:
-
| ec | editing context to fetch into |
| nsdictionary | dictionary of key value pairs to match against. |
| sortOrderings | array of sort orders to sort the result set by. |
- Returns:
- array of primary keys matching the given criteria.
| static void resetClazzCache |
( |
|
) |
[static] |
| void setEntityName |
( |
String |
name |
) |
[protected] |
Sets the entity name of the clazz. Also registers the clazz in the cache.
- Parameters:
-
| static void setFactory |
( |
ClazzFactory |
value |
) |
[static] |
Member Data Documentation
ClazzFactory _factory = new DefaultClazzFactory() [static, private] |
caches the count attribute
final Logger log = Logger.getLogger(EOEnterpriseObjectClazz.class) [static] |
The documentation for this class was generated from the following file: