Example usage for java.lang CloneNotSupportedException CloneNotSupportedException

List of usage examples for java.lang CloneNotSupportedException CloneNotSupportedException

Introduction

In this page you can find the example usage for java.lang CloneNotSupportedException CloneNotSupportedException.

Prototype

public CloneNotSupportedException(String s) 

Source Link

Document

Constructs a CloneNotSupportedException with the specified detail message.

Usage

From source file:org.lsc.beans.LscBean.java

/**
 * Clone this Bean object./*from w  w  w  . java2s.c  o  m*/
 * 
 * @return Object
 * @throws java.lang.CloneNotSupportedException
 */
@Override
public LscBean clone() throws CloneNotSupportedException {
    try {
        LscBean bean = (LscBean) this.getClass().newInstance();
        bean.setMainIdentifier(this.getMainIdentifier());

        for (String attributeName : this.getAttributesNames()) {
            bean.setAttribute(attributeName, this.getDatasetAsSetById(attributeName));
        }
        return bean;
    } catch (InstantiationException ex) {
        throw new CloneNotSupportedException(ex.getLocalizedMessage());
    } catch (IllegalAccessException ex) {
        throw new CloneNotSupportedException(ex.getLocalizedMessage());
    }
}

From source file:net.sf.webphotos.util.Util.java

@Override
public Object clone() throws CloneNotSupportedException {
    throw new CloneNotSupportedException("Singleton Object");
}

From source file:org.sakaiproject.site.impl.SiteCacheImpl.java

@Override
public Object clone() throws CloneNotSupportedException {
    M_log.debug("ehcache event: 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:org.sakaiproject.memory.impl.EhcacheCache.java

@Override
public Object clone() throws CloneNotSupportedException {
    super.clone();
    throw new CloneNotSupportedException(
            "CacheEventListener implementations should throw CloneNotSupportedException if they do not support clone");
}

From source file:org.kalypsodeegree_impl.model.feature.FeatureHelper.java

/**
 * @throws CloneNotSupportedException/*w  w  w .j  a  va2 s  .c o  m*/
 * @throws UnsupportedOperationException
 *           If type of object is not supported for clone <br/>
 *           FIXME: get gml version from source feature type
 */
public static Object cloneData(final Feature sourceFeature, final Feature targetFeature, final IPropertyType pt,
        final Object object) throws Exception {
    if (object == null)
        return null;

    if (pt instanceof IRelationType) {
        final IRelationType rt = (IRelationType) pt;

        if (object instanceof String) {
            // its an internal link: change to external if we change the workspace
            if (sourceFeature.getWorkspace().equals(targetFeature.getWorkspace()))
                return object;
            else
                // TODO: not yet supported; internal links will be broken after clone
                return null;
        } else if (object instanceof IXLinkedFeature) {
            final IXLinkedFeature xlink = (IXLinkedFeature) object;
            // retarget xlink
            return new XLinkedFeature_Impl(targetFeature, rt, xlink.getFeatureType(), xlink.getHref());
        } else if (object instanceof Feature)
            return FeatureHelper.cloneFeature(targetFeature, rt, (Feature) object);

        return null;
    }

    // its an geometry? -> clone geometry
    if (object instanceof GM_Object) {
        final GM_Object gmo = (GM_Object) object;

        return gmo.clone();
    }

    // if we have an IMarshallingTypeHandler, it will do the clone for us.
    final ITypeRegistry<IMarshallingTypeHandler> typeRegistry = MarshallingTypeRegistrySingleton
            .getTypeRegistry();
    final IMarshallingTypeHandler typeHandler = typeRegistry.getTypeHandlerFor(pt);

    if (typeHandler != null) {
        try {
            final String gmlVersion = sourceFeature.getFeatureType().getGMLSchema().getGMLVersion();
            return typeHandler.cloneObject(object, gmlVersion);
        } catch (final Exception e) {
            final CloneNotSupportedException cnse = new CloneNotSupportedException(
                    "Kann Datenobjekt vom Typ '" + pt.getQName() + "' nicht kopieren.");
            cnse.initCause(e);
            throw cnse;
        }
    }
    throw new CloneNotSupportedException("Kann Datenobjekt vom Typ '" + pt.getQName() + "' nicht kopieren.");
}

From source file:org.apache.pig.backend.hadoop.executionengine.physicalLayer.relationalOperators.POFRJoin.java

@Override
public POFRJoin clone() throws CloneNotSupportedException {
    POFRJoin clone = (POFRJoin) super.clone();
    // Not doing deep copy of nullBag, nullBag, inputSchemas, keySchemas
    // as they are read only
    clone.phyPlanLists = new ArrayList<List<PhysicalPlan>>(phyPlanLists.size());
    for (List<PhysicalPlan> ppLst : phyPlanLists) {
        clone.phyPlanLists.add(clonePlans(ppLst));
    }//from w w  w  . j  av a 2  s .  co  m

    clone.LRs = new POLocalRearrange[phyPlanLists.size()];
    clone.constExps = new ConstantExpression[phyPlanLists.size()];
    try {
        clone.createJoinPlans(getOperatorKey());
    } catch (ExecException e) {
        CloneNotSupportedException cnse = new CloneNotSupportedException(
                "Problem with setting plans of " + this.getClass().getSimpleName());
        cnse.initCause(e);
        throw cnse;
    }
    return clone;
}

From source file:org.broadleafcommerce.core.order.domain.OrderItemImpl.java

public void checkCloneable(OrderItem orderItem)
        throws CloneNotSupportedException, SecurityException, NoSuchMethodException {
    Method cloneMethod = orderItem.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   w w w .  j a  v  a  2s.c  o m
}

From source file:org.sparkcommerce.core.order.domain.OrderItemImpl.java

public void checkCloneable(OrderItem orderItem)
        throws CloneNotSupportedException, SecurityException, NoSuchMethodException {
    Method cloneMethod = orderItem.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");
    }/*from   www. j av a2 s .c  om*/
}

From source file:org.apache.pig.backend.hadoop.executionengine.physicalLayer.relationalOperators.POLocalRearrange.java

/**
 * Make a deep copy of this operator./*from w ww  .j av  a2 s  .  c om*/
 * @throws CloneNotSupportedException
 */
@Override
public POLocalRearrange clone() throws CloneNotSupportedException {
    POLocalRearrange clone = (POLocalRearrange) super.clone();
    // Constructor
    clone.leafOps = new ArrayList<ExpressionOperator>();
    clone.secondaryLeafOps = new ArrayList<ExpressionOperator>();
    // Needs to be called as setDistinct so that the fake index tuple gets
    // created.
    clone.setDistinct(mIsDistinct);
    // Set the keyType to mainKeyType. setSecondaryPlans will calculate
    // based on that and set keyType to the final value
    if (useSecondaryKey) {
        clone.keyType = mainKeyType;
    }
    try {
        clone.setPlans(clonePlans(plans));
        if (secondaryPlans != null) {
            clone.setSecondaryPlans(clonePlans(secondaryPlans));
        }
    } catch (PlanException pe) {
        CloneNotSupportedException cnse = new CloneNotSupportedException(
                "Problem with setting plans of " + this.getClass().getSimpleName());
        cnse.initCause(pe);
        throw cnse;
    }
    return clone;
}

From source file:net.lmxm.ute.gui.MainFrame.java

@Override
protected Object clone() throws CloneNotSupportedException {
    throw new CloneNotSupportedException("Clone not supported");
}