Example usage for java.io Serializable toString

List of usage examples for java.io Serializable toString

Introduction

In this page you can find the example usage for java.io Serializable toString.

Prototype

public String toString() 

Source Link

Document

Returns a string representation of the object.

Usage

From source file:org.ambraproject.hibernate.AmbraIdGeneratorTest.java

@Test(dataProvider = "objectsWithIdSet")
public void testGenerationWithIdAlreadySet(Object object, Serializable expectedId) {
    Serializable id = idGenerator.generate((SessionImplementor) session, object);
    assertNotNull(id, "generated null id");
    assertFalse(id.toString().isEmpty(), "returned empty id");
    assertEquals(id, expectedId, "returned incorrect id");
}

From source file:org.ambraproject.hibernate.AmbraIdGeneratorTest.java

@Test(dataProvider = "savedObjects")
public void testGenerationOnSavedObjects(Object object, Serializable expectedId) {
    Serializable id = idGenerator.generate((SessionImplementor) session, object);
    assertNotNull(id, "generated null id");
    assertFalse(id.toString().isEmpty(), "returned empty id");
    assertEquals(id, expectedId, "returned incorrect id");
}

From source file:org.ambraproject.hibernate.AmbraIdGeneratorTest.java

@Test(dataProvider = "unsavedObjects")
public void testGeneration(Object object, Class expectedIdClass, String expectedPrefix) {
    Serializable id = idGenerator.generate((SessionImplementor) session, object);
    assertNotNull(id, "generated null id");
    assertFalse(id.toString().isEmpty(), "returned empty id");
    assertEquals(id.getClass(), expectedIdClass, "returned id of incorrect class");
    assertTrue(id.toString().startsWith(expectedPrefix),
            "Generated id didn't start with correct prefix; expected: " + expectedPrefix + " but found " + id);
}

From source file:ar.com.zauber.common.image.impl.FileImageFactory.java

/**
 * @param id de la imagen a buscar//www .j  av a2 s.c  om
 * @throws  IOException on error
 * @see ImageFactory#retrieveImage(java.io.Serializable)
 */
public final Image retrieveImage(final Serializable id) throws IOException {
    final FileImage img = new FileImage(baseDir.getAbsolutePath(), id.toString() + DEFAULT_FILE_EXTENSION);
    final FileImage thumbnail = new FileImage(baseDir.getAbsolutePath(),
            "thumb_" + id.toString() + DEFAULT_FILE_EXTENSION);
    img.setThumb(thumbnail);
    return img;
}

From source file:org.web4thejob.orm.AbstractHibernateEntity.java

@Override
public boolean isNewInstance() {
    final Serializable id = getIdentifierValue();
    return id == null || id.toString().equals("0") || id.toString().equals("");
}

From source file:org.opencron.server.service.SchedulerService.java

public boolean exists(Serializable jobId) throws SchedulerException {
    return quartzScheduler.checkExists(JobKey.jobKey(jobId.toString()));
}

From source file:sapience.injectors.impl.AbstractInjector.java

public URI ensureURI(Serializable ser) throws IOException {
    try {/*from   w ww  .  ja  v a  2  s . c  o  m*/
        URI uri = new URI(ser.toString());
        return uri;
    } catch (URISyntaxException e) {

        throw new IOException(e);
    }

}

From source file:org.jboss.dashboard.database.hibernate.StringBlobType.java

public Object assemble(Serializable serializable, Object owner) throws HibernateException {
    if (serializable == null)
        return null;
    return serializable.toString();
}

From source file:org.jahia.modules.portal.filter.PortalSkinFilter.java

public String prepare(RenderContext renderContext, Resource resource, RenderChain chain) throws Exception {
    // Add cache dependency to portal tab
    PortalContext portal = (PortalContext) renderContext.getRequest().getAttribute("portalContext");
    resource.getDependencies().add(portal.getTabPath());
    resource.getDependencies().add(portal.getPath());
    Serializable skipSkinParam = resource.getModuleParams().get("skipSkin");
    boolean skipSkin = skipSkinParam != null && Boolean.parseBoolean(skipSkinParam.toString());
    if (!skipSkin) {
        if (portal.isLock()) {
            resource.pushWrapper("locked");
        } else {/*w  w  w.j  ava  2  s .com*/
            pushWidgetSkinWrapperForNode(resource.getNode(), resource);
        }
    }
    return null;
}

From source file:org.apache.torque.manager.MethodCacheKey.java

/**
 * Initialize the key/*  w  ww . jav  a  2 s.  c  o m*/
 *
 * @param instanceOrClass the Object on which the method is invoked.  if
 * the method is static, a String representing the class name is used.
 * @param method the method name
 * @param arg optional arguments for the method
 */
public void init(Serializable instanceOrClass, String method, Serializable... arg) {
    this.instanceOrClass = instanceOrClass;
    this.method = method;
    groupKey = instanceOrClass.toString() + method;
    this.args = arg;
}