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:de.tor.tribes.types.DefenseTimeSpan.java

@Override
public DefenseTimeSpan clone() throws CloneNotSupportedException {
    if (getDirection().equals(DIRECTION.NONE)) {
        throw new CloneNotSupportedException("Divider cannot be cloned");
    }// w w w .  jav  a2s .  co m
    DefenseTimeSpan s = new DefenseTimeSpan(validFor, span);
    s.setDirection(getDirection());
    return s;
}

From source file:de.tor.tribes.types.TimeSpan.java

@Override
public TimeSpan clone() throws CloneNotSupportedException {
    if (getDirection().equals(DIRECTION.NONE)) {
        throw new CloneNotSupportedException("Divider cannot be cloned");
    }/*from www . j  a  v  a 2  s  .c om*/
    TimeSpan s = new TimeSpan(exactSpan, daily);
    s.setDirection(getDirection());
    return s;
}

From source file:net.audumla.automate.event.AbstractEvent.java

@Override
public Event clone() throws CloneNotSupportedException {
    try {/*ww  w  . j av a2 s  . co m*/
        return (Event) org.apache.commons.beanutils.BeanUtils.cloneBean(this);
    } catch (Exception e) {
        logger.error("Unable to clone Event ", this.getClass().getName(), e);
        throw new CloneNotSupportedException("Failed to clone Event");
    }
}

From source file:com.example.spring.util.SpringBeanFactory.java

/**
 * Method avoids cloning for singleton class
 *
 * @return/*from w ww . j a v a2s  .  c  om*/
 * @throws CloneNotSupportedException
 */
@Override
public Object clone() throws CloneNotSupportedException {

    throw new CloneNotSupportedException("PropertyFileLoader Cannot Be Cloned");
}

From source file:com.bazaarvoice.seo.sdk.util.BVMessageUtil.java

@Override
protected Object clone() throws CloneNotSupportedException {
    throw new CloneNotSupportedException("This is a singleton instance.");
}

From source file:ru.jts_dev.common.packets.StaticOutgoingMessageWrapper.java

/**
 * Check that message is static, and perform cloning buffer and headers to new object
 * with deep copy of mutable {@link #buffer} and {@link #headers}.
 * Also, sets {@link #static_} to {@code false}.
 * Other fields will be copied as-is, and should be guaranteed immutable,
 * because this method is final, and there is no other way in which copy of this fields can be obtained.
 *
 * @return - cloned message//from  w w w  . java  2 s  .c  o  m
 * @throws CloneNotSupportedException - if
 * @see Object#clone()
 */
@Override
public final OutgoingMessageWrapper clone() throws CloneNotSupportedException {
    if (!static_)
        throw new CloneNotSupportedException("Clone not supported for non-static messages");
    logger.trace("Cloning {}, because it is static message", getClass().getSimpleName());
    final OutgoingMessageWrapper msg = (OutgoingMessageWrapper) super.clone();
    msg.headers = new MutableMessageHeaders(headers);
    msg.buffer = buffer.copy();
    msg.static_ = false;

    return msg;
}

From source file:com.strato.hidrive.api.utils.multipart.MultipartEntity.java

public Object clone() throws CloneNotSupportedException {
    throw new CloneNotSupportedException("MultipartEntity does not support cloning");
}

From source file:com.cloudbase.CBMultipartEntity.java

public Object clone() throws CloneNotSupportedException {
    throw new CloneNotSupportedException("MultipartEntity does not support cloning"); //$NON-NLS-1$ // TODO
}

From source file:org.randomcoding.mtg.tools.legalitychecker.deck.DeckLegalityCalculator.java

/**
 * {@inheritDoc}//  ww w . j  a v a2 s  .com
 */
@Override
protected Object clone() throws CloneNotSupportedException {
    throw new CloneNotSupportedException("The Singleton " + getClass().getName() + " cannot be cloned");
}

From source file:org.tonguetied.utils.pagination.PaginatedList.java

/**
 * Performs a deep copy of this list./*w  w w . j  a va2  s.com*/
 * 
 * @throws CloneNotSupportedException if the list is not a list of 
 * {@link DeepCloneable} objects
 */
public PaginatedList<T> deepClone() throws CloneNotSupportedException {
    ////        if (!this.getClass().isInstance(Cloneable.class))
    ////            throw new CloneNotSupportedException();
    //
    ArrayList<T> items = new ArrayList<T>();
    try {
        for (DeepCloneable<T> item : (List<DeepCloneable<T>>) this) {
            items.add(item.deepClone());
        }
    } catch (ClassCastException cce) {
        throw new CloneNotSupportedException(cce.getMessage());
    }

    return new PaginatedList<T>(items, maxListSize);
}