at.ac.tuwien.infosys.sm4all.copal.api.xml
Class RequiredAttributeUnmarshaller<T>

java.lang.Object
  extended by at.ac.tuwien.infosys.sm4all.copal.api.xml.RequiredAttributeUnmarshaller<T>
Type Parameters:
T - the class of unmarshaled value.
All Implemented Interfaces:
Unmarshaller<T>
Direct Known Subclasses:
AttributeName, AttributeValue, DefaultActionName, Event, Event, Event, Name, Name, Name, Name, ProcessorActionInput, ProcessorActionName, SourceID

public abstract class RequiredAttributeUnmarshaller<T>
extends Object
implements Unmarshaller<T>

Command that unmarshalls a required attribute from an Element.

Author:
sanjin

Constructor Summary
protected RequiredAttributeUnmarshaller(Element element, String attributeName)
          Creates instance of required attribute unmarshaller which uses specified Element to unmarshal the required attribute.
 
Method Summary
 T unmarshal()
          Returns the required attribute of specified Element.
protected abstract  T valueOf(String value)
          Converts specified String value of the required attribute to desired class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RequiredAttributeUnmarshaller

protected RequiredAttributeUnmarshaller(Element element,
                                        String attributeName)
Creates instance of required attribute unmarshaller which uses specified Element to unmarshal the required attribute.

Parameters:
element - the Element used for unmarshalling.
attributeName - the name of required attribute.
Throws:
NullPointerException - if specified Element or attribute name is null.
IllegalArgumentException - if specified attribute name is an empty or blank string.
Method Detail

unmarshal

public T unmarshal()
            throws ParsingException
Returns the required attribute of specified Element.

Specified by:
unmarshal in interface Unmarshaller<T>
Returns:
the required attribute of specified Element.
Throws:
MissingFieldException - if specified Element does not have the required attribute.
InvalidFieldValueException - if the required attribute is empty or blank string or invalid value.
ParsingException

valueOf

protected abstract T valueOf(String value)
                      throws InvalidFieldValueException
Converts specified String value of the required attribute to desired class.

Parameters:
value - the String value of the required attribute.
Returns:
the required attribute as instance of the desired class.
Throws:
InvalidFieldValueException - if specified value is not valid.


Copyright © 2010 Distributed Systems Group, Vienna University of Technology. All Rights Reserved.