# com.bea.content
ObjectClass Class

public class ObjectClass
extends `ContentEntity`

ObjectClass is the type for a Node. It has both an id and a name that uniquely identifies it within a content repository.

An ObjectClass may have PropertyDefinitions associated with it that define the shape of Properties required for a Node. This does not mean that the Property must contain a value, but simply that the Property must exist for the Node.

The ObjectClass may have PropertyDefinitions without them actually being attached in memory. In this case, hasPropertyDefinitions would be true and a call to get the PropertyDefinitions would lazy load them. If there is a need to check if the PropertyDefinitions are currently set then a call to isPropertyDefinitionsNull() is appropriate as it will not try to load the PropertyDefinitions.

It may also have a primary PropertyDefinition that defines the primary content Property for a Node. This allows for the definition of content in the type since the api does not distinguish between content and meta-content.

A Node is only considered valid in the repository if its Properties conform to its ObjectClass PropertyDefinitions.

ObjectClass PropertyDefinitions may be lazy loaded, depending on the implementation of the underyling operation that retrieved the ObjectClass.

Hierarchy
  `Object`
  `ContentEntity`
  `ObjectClass`

All Implemented Interfaces
  `Serializable`

## Field Summary

Fields from com.bea.content`.`ContentEntity``
``id``

## Constructor Summary

ObjectClass(`ID` id, `String` name, `PropertyDefinition` primaryPropertyDefinition, `PropertyDefinition` propertyDefinitions, boolean hasPropertyDefinitions) Constructor without propertyDefinitions.
ObjectClass(`ID` id, `String` name, `PropertyDefinition` primaryPropertyDefinition, `PropertyDefinition` propertyDefinitions) Constructor without hasPropertyDefinitions.
ObjectClass(`ID` id, `String` name) Basic constructor.

## Method Summary

`public `String`` | `getName`() Returns a name that uniquely identifies this ObjectClass within a repository.
`public `PropertyDefinition`` | `getPrimaryPropertyDefinition`() Returns the primary PropertyDefinition, or null if one does not exist.
`public `PropertyDefinition`` | `getPropertyDefinition`(`String` name) Gets the named PropertyDefinition for this ObjectClass.
`public `PropertyDefinition`[]` | `getPropertyDefinitions`() Gets the PropertyDefinitions for this ObjectClass.
`public boolean` | `hasPropertyDefinitions`() Returns true if this ObjectClass has PropertyDefinitions.
`public void` | `hasPropertyDefinitions`(boolean hasPropertyDefinitions) Sets if this ObjectClass has PropertyDefinitions.
`public boolean` | `isPropertyDefinitionsNull`() Returns true if the propertyDefitions is null, false otherwise.
`public void` | `setName`(`String` name) Sets the name for this ObjectClass.
`public void` | `setObjectClassOps`(`ObjectClassOps` objectClassOps) Sets the ObjectClassOps for the repository.
`public void` | `setPrimaryPropertyDefinition`(`PropertyDefinition` propertyDefinition) Sets the primary PropertyDefinition.
`public `String`` | `toString`() Returns the ObjectClass attributes as a String.
`public void` | `validateProperties`(`Property`[] properties) Validates that each property passed in as part of the properties array is valid according to its PropertyDefinition.
`public void` | `validateProperty`(`Property` property, `PropertyDefinition` definition) Validates that the property passed in is valid according to the property definition passed in.

Methods from `com.bea.content.`ContentEntity``
``getId`, `setId`,`

Methods from class `java.lang.`Object``
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Detail

### ObjectClass

    public ObjectClass(ID id,
                       String name,
                       PropertyDefinition primaryPropertyDefinition,
                       PropertyDefinition[] propertyDefinitions,
                       boolean hasPropertyDefinitions)

  Constructor without propertyDefinitions. Useful for when the PropertyDefinitions will be lazy loaded (if they exist).

### ObjectClass

    public ObjectClass(ID id,
                       String name,
                       PropertyDefinition primaryPropertyDefinition,
                       PropertyDefinition[] propertyDefinitions)

  Constructor without hasPropertyDefinitions. If the propertyDefinitions passed in is not null and size > 0 then hasPropertyDefinitions will be set to true, otherwise it will be set to false.

### ObjectClass

    public ObjectClass(ID id,
                       String name)

  Basic constructor.

## Method Detail

### getName() Method

    public String getName()

Returns a name that uniquely identifies this ObjectClass within a repository.

### getPrimaryPropertyDefinition() Method

    public PropertyDefinition getPrimaryPropertyDefinition()

Returns the primary PropertyDefinition, or null if one does not exist.

### getPropertyDefinition(String) Method

    public PropertyDefinition getPropertyDefinition(String name)
         throws RepositoryException

Gets the named PropertyDefinition for this ObjectClass.

#### Parameters

name
  - the name of the property definition to get.

#### Returns

PropertyDefinition - that matches the name passed in, or null if none.

#### Exceptions

``RepositoryException``
  - if an error occurs getting the property definition.

### getPropertyDefinitions() Method

    public PropertyDefinition[] getPropertyDefinitions()
         throws AuthorizationException

Gets the PropertyDefinitions for this ObjectClass. If they aren't currently set on this ObjectClass, then they will be retrieved. If you need to check if the ObjectClass instance in memory has its ProperetyDefinitions set, use isPropertyDefinitionsNull(). If you need to know if the ObjectClass has PropertyDefinitions (they may not be loaded in memory, but actually exist), use hasPropertyDefinitions().

#### Exceptions

``AuthorizationException``
  - if the user attempting the get is not authorized.

### hasPropertyDefinitions() Method

    public boolean hasPropertyDefinitions()

Returns true if this ObjectClass has PropertyDefinitions. This does not indicate if it currently has them as part of the instance (in memory), or if they will be lazy loaded, but rather simply that they exist.

### hasPropertyDefinitions(boolean) Method

    public void hasPropertyDefinitions(boolean hasPropertyDefinitions)

Sets if this ObjectClass has PropertyDefinitions. This does not indicate if it currently has them as part of the instance (in memory), or if they will be lazy loaded, but rather simply that they exist.

### isPropertyDefinitionsNull() Method

    public boolean isPropertyDefinitionsNull()

Returns true if the propertyDefitions is null, false otherwise. This does not indicate whether PropertyDefinitions exist for this ObjectClass, but rather if they are currently part of the instance.

### setName(String) Method

    public void setName(String name)

Sets the name for this ObjectClass.

### setObjectClassOps(ObjectClassOps) Method

    public void setObjectClassOps(ObjectClassOps objectClassOps)

Sets the ObjectClassOps for the repository.

### setPrimaryPropertyDefinition(PropertyDefinition) Method

    public void setPrimaryPropertyDefinition(PropertyDefinition propertyDefinition)

Sets the primary PropertyDefinition.

### toString() Method

    public String toString()

Returns the ObjectClass attributes as a String.

Overrides
  `ContentEntity.toString()`

### validateProperties(Property[]) Method

    public void validateProperties(Property[] properties)
         throws RepositoryException

Validates that each property passed in as part of the properties array is valid according to its PropertyDefinition.

#### Exceptions

``RepositoryException``

### validateProperty(Property, PropertyDefinition) Method

    public void validateProperty(Property property,
                                 PropertyDefinition definition)
         throws RepositoryException

Validates that the property passed in is valid according to the property definition passed in.

#### Exceptions

``RepositoryException``