List of usage examples for java.lang CloneNotSupportedException CloneNotSupportedException
public CloneNotSupportedException(String s)
CloneNotSupportedException
with the specified detail message. From source file:org.broadleafcommerce.common.site.domain.SiteImpl.java
public void checkCloneable(Site site) throws CloneNotSupportedException, SecurityException, NoSuchMethodException { Method cloneMethod = site.getClass().getMethod("clone", new Class[] {}); if (cloneMethod.getDeclaringClass().getName().startsWith("org.broadleafcommerce") && !site.getClass().getName().startsWith("org.broadleafcommerce")) { //subclass is not implementing the clone method throw new CloneNotSupportedException("Custom extensions and implementations should implement clone."); }/*from w w w .ja v a2 s . c o m*/ }
From source file:org.jfree.data.KeyToGroupMap.java
/** * Returns a clone of the list.//from ww w. ja v a 2 s. co m * * @param list the list. * * @return A clone of the list. * * @throws CloneNotSupportedException if the list could not be cloned. */ private static Collection clone(Collection list) throws CloneNotSupportedException { Collection result = null; if (list != null) { try { List clone = (List) list.getClass().newInstance(); Iterator iterator = list.iterator(); while (iterator.hasNext()) { clone.add(KeyToGroupMap.clone(iterator.next())); } result = clone; } catch (Exception e) { throw new CloneNotSupportedException("Exception."); } } return result; }
From source file:com.twinsoft.convertigo.beans.core.DatabaseObject.java
@Override public DatabaseObject clone() throws CloneNotSupportedException { if (original == null) { try {//w ww.ja v a 2 s.c o m DatabaseObject clone = (DatabaseObject) super.clone(); clone.original = this; clone.parent = null; clone.bNew = false; clone.isImporting = false; clone.isSubLoaded = false; //Engine.isEngineMode() ? isSubLoaded : false; clone.hasChanged = false; //Engine.isEngineMode() ? false : hasChanged;// Studio // case // of // refresh // without // saving clone.compilablePropertySourceValuesMap = new HashMap<String, Object>(5); clone.compilablePropertySourceValuesMap.putAll(compilablePropertySourceValuesMap); return clone; } catch (Exception e) { Engine.logBeans.error("Unable to clone the object \"" + getName() + "\"", e); String message = "DatabaseObject.clone() " + e.getClass().getName() + "\n" + e.getMessage(); throw new CloneNotSupportedException(message); } } else { return original.clone(); } }
From source file:org.sparkcommerce.openadmin.server.security.domain.AdminPermissionImpl.java
public void checkCloneable(AdminPermission adminPermission) throws CloneNotSupportedException, SecurityException, NoSuchMethodException { Method cloneMethod = adminPermission.getClass().getMethod("clone", new Class[] {}); if (cloneMethod.getDeclaringClass().getName().startsWith("org.sparkcommerce") && !adminPermission.getClass().getName().startsWith("org.sparkcommerce")) { //subclass is not implementing the clone method throw new CloneNotSupportedException("Custom extensions and implementations should implement clone."); }//from w ww . j a v a2 s. co m }
From source file:org.sparkcommerce.core.order.domain.FulfillmentGroupItemImpl.java
public void checkCloneable(FulfillmentGroupItem fulfillmentGroupItem) throws CloneNotSupportedException, SecurityException, NoSuchMethodException { Method cloneMethod = fulfillmentGroupItem.getClass().getMethod("clone", new Class[] {}); if (cloneMethod.getDeclaringClass().getName().startsWith("org.sparkcommerce") && !orderItem.getClass().getName().startsWith("org.sparkcommerce")) { //subclass is not implementing the clone method throw new CloneNotSupportedException( "Custom extensions and implementations should implement clone in order to guarantee split and merge operations are performed accurately"); }/*ww w .ja va 2 s. co m*/ }
From source file:org.broadleafcommerce.openadmin.server.security.domain.AdminPermissionImpl.java
public void checkCloneable(AdminPermission adminPermission) throws CloneNotSupportedException, SecurityException, NoSuchMethodException { Method cloneMethod = adminPermission.getClass().getMethod("clone", new Class[] {}); if (cloneMethod.getDeclaringClass().getName().startsWith("org.broadleafcommerce") && !adminPermission.getClass().getName().startsWith("org.broadleafcommerce")) { //subclass is not implementing the clone method throw new CloneNotSupportedException("Custom extensions and implementations should implement clone."); }/* www. j av a2 s . c om*/ }
From source file:org.broadleafcommerce.core.order.domain.FulfillmentGroupItemImpl.java
public void checkCloneable(FulfillmentGroupItem fulfillmentGroupItem) throws CloneNotSupportedException, SecurityException, NoSuchMethodException { Method cloneMethod = fulfillmentGroupItem.getClass().getMethod("clone", new Class[] {}); if (cloneMethod.getDeclaringClass().getName().startsWith("org.broadleafcommerce") && !orderItem.getClass().getName().startsWith("org.broadleafcommerce")) { //subclass is not implementing the clone method throw new CloneNotSupportedException( "Custom extensions and implementations should implement clone in order to guarantee split and merge operations are performed accurately"); }//from ww w .j a va2s . c om }
From source file:HashNMap.java
/** * Returns a clone of the specified object, if it can be cloned, otherwise * throws a CloneNotSupportedException.//from w w w . j ava2s .co m * * @param object * the object to clone (<code>null</code> not permitted). * @return A clone of the specified object. * @throws CloneNotSupportedException * if the object cannot be cloned. */ public static Object clone(final Object object) throws CloneNotSupportedException { if (object == null) { throw new IllegalArgumentException("Null 'object' argument."); } else { try { final Method method = object.getClass().getMethod("clone", (Class[]) null); if (Modifier.isPublic(method.getModifiers())) { return method.invoke(object, (Object[]) null); } } catch (Exception e) { } } throw new CloneNotSupportedException("Failed to clone."); }
From source file:org.sakaiproject.memory.impl.GenericMultiRefCacheImpl.java
/** * @see CacheEventListener#clone()// ww w. j av a 2 s . c o m */ @Override public Object clone() throws CloneNotSupportedException { M_log.debug("clone()"); // Creates a clone of this listener. This method will only be called by ehcache before a cache is initialized. // This may not be possible for listeners after they have been initialized. Implementations should throw CloneNotSupportedException if they do not support clone. throw new CloneNotSupportedException( "CacheEventListener implementations should throw CloneNotSupportedException if they do not support clone"); }
From source file:com.toolsverse.mvc.model.ModelImpl.java
@Override public Object clone() throws CloneNotSupportedException { try {//from w w w . j a va 2 s. com return ClassUtils.clone(this); } catch (Exception ex) { throw new CloneNotSupportedException(Utils.getStackTraceAsString(ex)); } }