{
PropertyBinding binding = null;
if( property instanceof Value )
{
final CustomXmlValueBinding customBindingAnnotation = property.definition().getAnnotation( CustomXmlValueBinding.class );
if( customBindingAnnotation != null )
{
try
{
binding = customBindingAnnotation.impl().newInstance();
}
catch( Exception e )
{
Sapphire.service( LoggingService.class ).log( e );
binding = null;
}
}
else
{
binding = new StandardXmlValueBindingImpl();
}
}
else if( property instanceof ElementHandle )
{
final CustomXmlElementBinding customBindingAnnotation = property.definition().getAnnotation( CustomXmlElementBinding.class );
if( customBindingAnnotation != null )
{
try
{
binding = customBindingAnnotation.impl().newInstance();
}
catch( Exception e )
{
Sapphire.service( LoggingService.class ).log( e );
binding = null;
}
}
else if( property.definition() instanceof ImpliedElementProperty )
{
binding = new StandardImpliedXmlElementBindingImpl();
}
else
{
binding = new StandardXmlElementBindingImpl();
}
}
else if( property instanceof ElementList )
{
final CustomXmlListBinding customBindingAnnotation = property.definition().getAnnotation( CustomXmlListBinding.class );
if( customBindingAnnotation != null )
{
try
{
binding = customBindingAnnotation.impl().newInstance();
}
catch( Exception e )
{
Sapphire.service( LoggingService.class ).log( e );
binding = null;