org.apache.maven.project
Class BaseObject

java.lang.Object
  extended byorg.apache.maven.project.BaseObject
Direct Known Subclasses:
Branch, Build, Contributor, Dependency, Jar, License, MailingList, Organization, PackageGroup, Plugin, Project, Repository, Resource, UnitTest, Version

public class BaseObject
extends java.lang.Object

Version:
$Id: BaseObject.java,v 1.28.4.3 2004/03/01 22:36:38 evenisse Exp $
Author:
Jason van Zyl

Field Summary
protected  java.lang.String id
          Id to use for this object.
 
Constructor Summary
BaseObject()
           
 
Method Summary
 void addProperty(java.lang.String combinedProperty)
          Add a meta property to this object.
 boolean equals(java.lang.Object o)
          Whether the passed object is the same as this one.
 java.lang.String getId()
          Gets the id attribute
 java.lang.String getName()
          Gets the name attribute
 java.util.List getProperties()
          Get meta properties.
 java.lang.String getProperty(java.lang.String propertyName)
          Get a meta property.
 int hashCode()
          Provides the hashCode of this object, which is determined by simply delegating the responsibility to the name property
protected  boolean isValid(java.lang.String value)
          Simple check for a value in the POM.
 java.util.Map resolvedProperties()
          Get the resolved properties after the name:value processing has been done.
 void setId(java.lang.String id)
          Sets the id attribute of the BaseObject object
 void setName(java.lang.String name)
          Sets the name attribute
 void setProperties(java.util.List combinedProperties)
          Set meta properties.
 java.lang.String toString()
          Return a string suitable for display/debugging
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

id

protected java.lang.String id
Id to use for this object.

Constructor Detail

BaseObject

public BaseObject()
Method Detail

setName

public void setName(java.lang.String name)
Sets the name attribute

Parameters:
name - the new name value

getName

public java.lang.String getName()
Gets the name attribute

Returns:
the name attribute

setId

public void setId(java.lang.String id)
Sets the id attribute of the BaseObject object

Parameters:
id - the new id value

getId

public java.lang.String getId()
Gets the id attribute

Returns:
the id attribute

addProperty

public void addProperty(java.lang.String combinedProperty)
Add a meta property to this object.

Parameters:
combinedProperty - The property that is fed in by the MetaPropertiesRule is in the form name:value so that we can fake out betwixt. Not beautiful but it works and when we find a better solution nothing will change for users.

getProperty

public java.lang.String getProperty(java.lang.String propertyName)
Get a meta property. The first time one is retrieved we create a property Map from the name:value entries in the list we have used to store the meta properties during mapping through betwixt.

Parameters:
propertyName - the name of the property to retrieve
Returns:
the property value

setProperties

public void setProperties(java.util.List combinedProperties)
Set meta properties. They are stored in a List of name:value entries.

Parameters:
combinedProperties - a list of name:value strings

getProperties

public java.util.List getProperties()
Get meta properties.

Returns:
a List of name:value entries

resolvedProperties

public java.util.Map resolvedProperties()
Get the resolved properties after the name:value processing has been done.

Returns:
a map from the meta properties turning the name:value strings into a key and value for the map

toString

public java.lang.String toString()
Return a string suitable for display/debugging

Returns:
the name attribute as a default

equals

public boolean equals(java.lang.Object o)
Whether the passed object is the same as this one. In this case the id is the unique qualifier. So two objects are equal if they have equal id's

Parameters:
o - any object
Returns:
true if o is the same as this object, false otherwise

hashCode

public int hashCode()
Provides the hashCode of this object, which is determined by simply delegating the responsibility to the name property

Returns:
the hashCode of the name if not null, otherwise delegate to the parent class

isValid

protected boolean isValid(java.lang.String value)
Simple check for a value in the POM. Due to the Jelly swizzling fields that aren't set come out as empty strings. This will not be required when the new lazy evaluation mechanism is put in place.

Parameters:
value - POM value to test.
Returns:
Is the value valid.


Copyright © 2001-2005 Apache Software Foundation. All Rights Reserved.