Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[ptp-dev] About to commit major change to Attributes on HEAD

Dave, Greg, Craig, others concerned,

I am about to commit a major change in the Attribute system.
It covers 93 files.

Attributes and AttributeDefinitions are now parameterized by
three types, e.g. the new definition for IAttribute is

public interface IAttribute<T, A extends IAttribute<T,A,D>, D extends
IAttributeDefinition<T,A,D>>
extends Comparable<A> {
	
	/**
	 * @return the attribute definition object associated with this
attribute
	 */
	public D getDefinition();
	
	/**
	 * @return
	 */
	public T getValue();
	
	/**
	 * @return string
	 */
	public String getValueAsString();
	
	/**
	 * @return whether any UI elements for this attribute
	 * should be enabled.
	 */
	public boolean isEnabled();
	
	/**
	 * Is the string parsable to a valid
	 * attribute of this type?
	 * 
	 * @param string
	 * @return
	 */
	public boolean isValid(String string);
		
	/**
	 * @param value
	 * @throws IllegalValueException
	 */
	public void setValue(T value) throws IllegalValueException;
	
	/**
	 * @param string
	 * @throws IAttribute.IllegalValue
	 */
	public void setValueAsString(String string) throws
IllegalValueException;
}

The same change has been made for AttributeDefinition's.

Also note that ArrayAttribute is parameterized on its
contained type.  Its getValue() now returns a List<T> instead of
T[].

Let me know if there is any reason not to commit these changes.

Regards,
Randy
-- 
Randy M. Roberts
rsqrd@xxxxxxxx
work: (505)665-4285

"They that can give up essential liberty to obtain a little temporary
safety deserve neither liberty nor safety."  -- Benjamin Franklin



Back to the top