All Downloads are FREE. Search and download functionalities are using the official Maven repository.

nuggets.delegate.DURL Maven / Gradle / Ivy

The newest version!
/*
 * DString.java
 * Copyright (c) 2005 by University of Hamburg. All Rights Reserved.
 * Departament of Informatics. 
 * Distributed Systems and Information Systems.
 *
 * Created by walczak on Jan 17, 2006.  
 * Last revision $Revision: 6926 $ by:
 * $Author: braubach $ on $Date: 2008-09-28 22:16:58 +0200 (So, 28 Sep 2008) $.
 */
package nuggets.delegate;

import java.net.MalformedURLException;
import java.net.URL;

import nuggets.IAssembler;
import nuggets.ICruncher;
import nuggets.PersistenceException;


/** DString 
 * @author walczak
 * @since  Jan 17, 2006
 */
public class DURL extends ASimpleDelegate
{

	/** 
	 * @param clazz
	 * @param asm
	 * @return a new instance of this array
	 * @throws Exception
	 */
	public Object getInstance(Class clazz,IAssembler asm) throws Exception
   {
      return new URL((String)asm.getAttributeValue("v"));
   }

   /** 
    * @param o
    * @param mill
    * @see nuggets.delegate.ASimpleDelegate#persist(java.lang.Object, nuggets.ICruncher)
    */
   public void persist(Object o, ICruncher mill, ClassLoader classloader)
   {
		  mill.startConcept(o);
      mill.put("v", o.toString());
   }
  
   
	/** 
	 * @param clazz
	 * @param value
	 * @return the boolean expression
	 * @see nuggets.delegate.ASimpleDelegate#unmarshall(java.lang.Class, java.lang.Object)
	 */
	public Object unmarshall(Class clazz, Object value)
	{
		try
		{
			return new URL((String)value);
		}
		catch(MalformedURLException e)
		{
			throw new PersistenceException(e);
		}
	}  

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy