pl.edu.agh.cast.data.model.property
Class MetaPropertyManager

java.lang.Object
  extended by java.util.Observable
      extended by pl.edu.agh.cast.data.model.property.MetaPropertyManager
All Implemented Interfaces:
Serializable

public final class MetaPropertyManager
extends Observable
implements Serializable

Manager of MetaProperty'ies.

Author:
AGH CAST Team
See Also:
Serialized Form

Constructor Summary
MetaPropertyManager()
           
 
Method Summary
static Collection<MetaProperty> getCommonProperties(Iterable<MetaPropertyManager> managers)
          This helper method finds the intersection of meta properties present in the meta property managers given as the argument.
 Collection<MetaProperty> getMetaCustomProperties()
          Returns all meta custom properties.
 Collection<MetaPermanentProperty> getMetaPermanentProperties()
          Returns all meta permanent properties.
 Collection<MetaProperty> getMetaProperties()
          Returns all meta properties.
 MetaProperty getMetaProperty(String name)
          Returns meta property with given name.
 Collection<MetaTransientProperty> getMetaTransientProperties()
          Returns all meta transient properties.
 boolean isEqual(MetaPropertyManager mpm)
          Checks if this MPM has equal meta-properties as the given one.
 boolean isNameRegistered(String name)
          Checks if there is a meta property with given name already registered.
 void registerMetaProperties(Iterable<? extends MetaProperty> metaProperties)
          Registers multiple meta properties.
 void registerMetaProperty(MetaProperty metaProperty)
          Registers new meta property in this manager.
 MetaProperty registerMetaProperty(String name, PropertyType type, boolean writeable, boolean matchable)
          Registers new custom MetaProperty.
 MetaProperty removeMetaProperty(String name)
          Removes meta property with given name.
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MetaPropertyManager

public MetaPropertyManager()
Method Detail

registerMetaProperty

public void registerMetaProperty(MetaProperty metaProperty)
Registers new meta property in this manager. If a meta property of the same name is already registered, exception is thrown.

Parameters:
metaProperty - MetaProperty to register (cannot be null)
Throws:
IllegalArgumentException - if metaProperty is null
PropertyException - if a meta property with the same name is already registered

registerMetaProperty

public MetaProperty registerMetaProperty(String name,
                                         PropertyType type,
                                         boolean writeable,
                                         boolean matchable)
Registers new custom MetaProperty.

Parameters:
name - The name of the property
type - The type of the property
writeable - The writable flag of the property
matchable - The matchable flag of the property
Returns:
registered MetaProperty

isNameRegistered

public boolean isNameRegistered(String name)
Checks if there is a meta property with given name already registered.

Parameters:
name - The name of the meta property
Returns:
True if the name is registered.

registerMetaProperties

public void registerMetaProperties(Iterable<? extends MetaProperty> metaProperties)
Registers multiple meta properties. Uses registerMetaProperty(MetaProperty).

Parameters:
metaProperties - collection of MetaProperty'ies to register

removeMetaProperty

public MetaProperty removeMetaProperty(String name)
Removes meta property with given name.

Parameters:
name - name of the property to remove.
Returns:
the removed property
Throws:
IllegalArgumentException - if name is not a valid property name
PropertyException - if a meta property with the given name is not registered

getMetaProperty

public MetaProperty getMetaProperty(String name)
Returns meta property with given name.

Parameters:
name - the name of the property
Returns:
the meta property or null if not registered

getMetaProperties

public Collection<MetaProperty> getMetaProperties()
Returns all meta properties.

Returns:
collection of all meta properties

getMetaCustomProperties

public Collection<MetaProperty> getMetaCustomProperties()
Returns all meta custom properties.

Returns:
collection of all meta custom properties

getMetaPermanentProperties

public Collection<MetaPermanentProperty> getMetaPermanentProperties()
Returns all meta permanent properties.

Returns:
collection of all meta permanent properties

getMetaTransientProperties

public Collection<MetaTransientProperty> getMetaTransientProperties()
Returns all meta transient properties.

Returns:
collection of all meta transient properties

getCommonProperties

public static Collection<MetaProperty> getCommonProperties(Iterable<MetaPropertyManager> managers)
This helper method finds the intersection of meta properties present in the meta property managers given as the argument.

Parameters:
managers - the set of meta property managers
Returns:
the set of common meta properties, that is the meta properties present in all the managers.

isEqual

public boolean isEqual(MetaPropertyManager mpm)
Checks if this MPM has equal meta-properties as the given one.

Parameters:
mpm - the other MPM
Returns:
true if both MPMs have equal meta-properties, false otherwise


Copyright © 2007-2009 IISG AGH-UST Krakow, Poland. All Rights Reserved.