Example usage for org.apache.commons.lang3.builder ToStringStyle SHORT_PREFIX_STYLE

List of usage examples for org.apache.commons.lang3.builder ToStringStyle SHORT_PREFIX_STYLE

Introduction

In this page you can find the example usage for org.apache.commons.lang3.builder ToStringStyle SHORT_PREFIX_STYLE.

Prototype

ToStringStyle SHORT_PREFIX_STYLE

To view the source code for org.apache.commons.lang3.builder ToStringStyle SHORT_PREFIX_STYLE.

Click Source Link

Document

The short prefix toString style.

Usage

From source file:ca.uhn.fhir.model.api.BaseResource.java

@Override
public String toString() {
    ToStringBuilder b = new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE);
    b.append("id", getId().toUnqualified());
    return b.toString();
}

From source file:de.kaiserpfalzEdv.commons.dto.NameDTO.java

@Override
public String toString() {
    return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append(canonicalName).build();
}

From source file:com.infinities.skyport.cache.secondlevel.PatchHandlerTest.java

@SuppressWarnings("unchecked")
@Test//from w  w  w . java2s .  co  m
public void testHandleInvocationObjectOnEntitiesRefreshedMethodObjectArray() throws Throwable {
    MockPatchListener proxy = new MockPatchListener();
    final Mock added = new Mock();
    added.setId("id");
    added.setName("name");
    final Mock updated = new Mock();
    updated.setId("id2");
    updated.setName("name2");
    final Mock old = new Mock();
    old.setId("id2");
    old.setName("old");
    final Mock removed = new Mock();
    removed.setId("id3");
    removed.setName("name3");
    final List<Mock> newEntries = new ArrayList<Mock>();
    newEntries.add(added);
    newEntries.add(updated);
    final Set<String> cacheKeys = new HashSet<String>();
    cacheKeys.add("id2");
    cacheKeys.add("id3");
    Method method = MockPatchListener.class.getMethod("onEntitiesRefreshed", RefreshedEvent.class);
    final RefreshedEvent<Mock> event = context.mock(RefreshedEvent.class);
    final DiffResult result = new DiffBuilder(old, updated, ToStringStyle.SHORT_PREFIX_STYLE).build();
    context.checking(new Expectations() {

        {
            exactly(1).of(event).getNewEntries();
            will(returnValue(newEntries));
            exactly(1).of(cache).get("id");
            will(returnValue(null));
            exactly(1).of(cache).get("id2");
            will(returnValue(old));
            exactly(1).of(cache).get("id3");
            will(returnValue(removed));
            exactly(1).of(comparator).compare(old, updated);
            will(returnValue(-1));
            exactly(1).of(patchBuilder).diff(old, updated);
            will(returnValue(result));
            exactly(1).of(cache).keySet();
            will(returnValue(cacheKeys));
            exactly(1).of(cache).clear();

        }
    });
    context.checking(new Expectations() {

        {
            exactly(1).of(cache).putAll(with(any(Map.class)));
            will(new CustomAction("check cache") {

                @Override
                public Object invoke(Invocation invocation) throws Throwable {
                    Map<String, Mock> map = (Map<String, Mock>) invocation.getParameter(0);
                    Assert.assertEquals(2, map.size());
                    Assert.assertEquals(added, map.get(added.getId()));
                    Assert.assertEquals(updated, map.get(updated.getId()));
                    return null;
                }

            });
        }
    });
    context.checking(new Expectations() {

        {
            exactly(1).of(event).getConfigid();
            will(returnValue("id"));
            exactly(1).of(inner).onChanged(with(any(SuccessEvent.class)));
            will(new CustomAction("check removed event") {

                @Override
                public Object invoke(Invocation invocation) throws Throwable {
                    SuccessEvent<Mock> event = (SuccessEvent<Mock>) invocation.getParameter(0);
                    Assert.assertEquals(1, event.getEntries().size());
                    Assert.assertEquals(removed, event.getEntries().iterator().next());
                    Assert.assertEquals("id", event.getConfigid());
                    Assert.assertEquals(Type.REMOVED, event.getType());
                    return null;
                }

            });
        }
    });
    context.checking(new Expectations() {

        {
            exactly(1).of(event).getConfigid();
            will(returnValue("id"));
            exactly(1).of(inner).onChanged(with(any(SuccessEvent.class)));
            will(new CustomAction("check added event") {

                @Override
                public Object invoke(Invocation invocation) throws Throwable {
                    SuccessEvent<Mock> event = (SuccessEvent<Mock>) invocation.getParameter(0);
                    Assert.assertEquals(1, event.getEntries().size());
                    Assert.assertEquals(added, event.getEntries().iterator().next());
                    Assert.assertEquals("id", event.getConfigid());
                    Assert.assertEquals(Type.ADDED, event.getType());
                    return null;
                }

            });
        }
    });
    context.checking(new Expectations() {

        {
            exactly(1).of(event).getConfigid();
            will(returnValue("id"));
            exactly(1).of(inner).onChanged(with(any(SuccessEvent.class)));
            will(new CustomAction("check modified event") {

                @Override
                public Object invoke(Invocation invocation) throws Throwable {
                    SuccessEvent<Mock> event = (SuccessEvent<Mock>) invocation.getParameter(0);
                    Assert.assertEquals(1, event.getEntries().size());
                    Assert.assertEquals(updated, event.getEntries().iterator().next());
                    Assert.assertEquals("id", event.getConfigid());
                    Assert.assertEquals(Type.MODIFIED, event.getType());
                    Assert.assertEquals(1, event.getPatchs().size());
                    Assert.assertEquals(result, event.getPatchs().get(updated.getId()));
                    return null;
                }

            });
        }
    });
    context.checking(new Expectations() {

        {
            exactly(1).of(event).getConfigid();
            will(returnValue("id"));
            exactly(1).of(inner).onChanged(with(any(SuccessEvent.class)));
            will(new CustomAction("check refresh event") {

                @Override
                public Object invoke(Invocation invocation) throws Throwable {
                    SuccessEvent<Mock> event = (SuccessEvent<Mock>) invocation.getParameter(0);
                    Assert.assertEquals(2, event.getEntries().size());
                    Assert.assertEquals("id", event.getConfigid());
                    Assert.assertEquals(Type.REFRESHED, event.getType());
                    return null;
                }

            });
        }
    });
    handler.handleInvocation(proxy, method, new Object[] { event });
}

From source file:com.francetelecom.clara.cloud.logicalmodel.LogicalNodeServiceAssociation.java

@Override
public String toString() {
    return (new ReflectionToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) {
        protected boolean accept(Field f) {
            return super.accept(f) && !isFieldExcludedFromToString(f.getName());
        }//  w w w.j a  v a 2  s.  co m

        protected Object getValue(Field field) throws IllegalArgumentException, IllegalAccessException {
            //Try to sort all of our collections so that toString() comparison is easier
            Class<?> type = field.getType();
            if (LogicalModelItem.class.isAssignableFrom(type)) {
                LogicalModelItem item = (LogicalModelItem) field.get(this.getObject());
                return item.getLabel();
            }
            return field.get(this.getObject());
        }
    }).toString();
}

From source file:com.norconex.collector.http.checksum.impl.LastModifiedMetadataChecksummer.java

@Override
public String toString() {
    return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).appendSuper(super.toString())
            .append("disabled", disabled).toString();
}

From source file:de.kaiserpfalzEdv.office.core.security.impl.SecurityTicket.java

@Override
public String toString() {
    return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("id", id)

            .append("account", account).append("validity", validity).toString();
}

From source file:ca.uhn.fhir.jpa.entity.ResourceIndexedSearchParamQuantity.java

@Override
public String toString() {
    ToStringBuilder b = new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE);
    b.append("paramName", getParamName());
    b.append("resourceId", getResource().getId()); // TODO: add a field so we don't need to resolve this
    b.append("system", getSystem());
    b.append("units", getUnits());
    b.append("value", getValue());
    return b.build();
}

From source file:ca.uhn.fhir.model.base.composite.BaseHumanNameDt.java

@Override
public String toString() {
    ToStringBuilder b = new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE);
    b.append("family", getFamilyAsSingleString());
    b.append("given", getGivenAsSingleString());
    return b.toString();
}

From source file:com.norconex.collector.core.data.store.impl.jdbc.AbstractJDBCDataStoreFactory.java

@Override
public String toString() {
    return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("database", database).toString();
}

From source file:com.amazonaws.services.kinesis.stormspout.state.zookeeper.LocalShardState.java

@Override
public String toString() {
    return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("shardId", shardId).toString();
}