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.teiid.rhq.plugin.util.ProfileServiceUtil.java

private static void updateDefaultValueOnPropertyDefinition(PropertyDefinition propertyDefinition,
        @NotNull MetaValue defaultValue) {
    if (!(propertyDefinition instanceof PropertyDefinitionSimple)) {
        LOG.debug("Cannot update default value on non-simple property definition " //$NON-NLS-1$
                + propertyDefinition + "(default value is " //$NON-NLS-1$
                + defaultValue + ")."); //$NON-NLS-1$
        return;/*from w  w w.java  2s .  com*/
    }
    MetaType metaType = defaultValue.getMetaType();
    if (!metaType.isSimple() && !metaType.isEnum()) {
        LOG.debug("Cannot update default value on " + propertyDefinition //$NON-NLS-1$
                + ", because default value's type (" + metaType //$NON-NLS-1$
                + ") is not simple or enum."); //$NON-NLS-1$
        return;
    }
    PropertyDefinitionSimple propertyDefinitionSimple = (PropertyDefinitionSimple) propertyDefinition;
    if (metaType.isSimple()) {
        SimpleValue defaultSimpleValue = (SimpleValue) defaultValue;
        Serializable value = defaultSimpleValue.getValue();
        propertyDefinitionSimple.setDefaultValue((value != null) ? value.toString() : null);
    } else { // defaultValueMetaType.isEnum()
        EnumValue defaultEnumValue = (EnumValue) defaultValue;
        Serializable value = defaultEnumValue.getValue();
        propertyDefinitionSimple.setDefaultValue((value != null) ? value.toString() : null);
    }
}

From source file:com.sunchenbin.store.feilong.core.lang.NumberUtil.java

/**
 * Object  value,?./*from w ww  . java 2 s . c  o  m*/
 * 
 * <p>
 * value ?BigDecimal,specificNumber ?BigDecimal ,BigDecimal compareTo,<br>
 * 0 ,true.
 * </p>
 * 
 * @param value
 *            Object  value, Number  String
 * @param specificNumber
 *            
 * @return value ?BigDecimal,specificNumber ?BigDecimal ,BigDecimal compareTo,<br>
 *         0 ,true
 */
public static boolean isSpecificNumber(Serializable value, String specificNumber) {
    if (Validator.isNullOrEmpty(value)) {
        return false;
    }

    String valueString = value.toString();
    // Number /String
    if (value instanceof Number || value instanceof String) {
        BigDecimal bigDecimal = ConvertUtil.toBigDecimal(valueString);
        int i = bigDecimal.compareTo(ConvertUtil.toBigDecimal(specificNumber));
        return i == 0;
    }
    return false;
}

From source file:com.baidu.rigel.biplatform.tesseract.util.QueryRequestUtil.java

public static void generateGroupBy(SearchIndexResultRecord record, List<String> groups, Meta meta)
        throws NoSuchFieldException {
    if (CollectionUtils.isNotEmpty(groups)) {
        String groupBy = "";
        Serializable field = null;
        for (String name : meta.getFieldNameArray()) {
            if (groups.contains(name)) {
                field = record.getField(meta.getFieldIndex(name));
                if (field != null) {
                    groupBy += field.toString() + ",";
                }//w  ww. ja v a  2  s.c  om
            }
        }
        record.setGroupBy(groupBy);
    }
}

From source file:org.nuxeo.ecm.core.storage.sql.SQLBinaryManager.java

protected static String loggedValue(Serializable value) {
    if (value == null) {
        return "NULL";
    }/*from  w ww  .j  a  va  2s  . c  o  m*/
    if (value instanceof String) {
        String v = (String) value;
        return "'" + v.replace("'", "''") + "'";
    }
    return value.toString();
}

From source file:org.alfresco.web.bean.repository.Repository.java

/**
 * Convert a property of unknown type to a String value. A native String value will be
 * returned directly, else toString() will be executed, null is returned as null. 
 * /* www. jav a  2  s  .  co  m*/
 * @param value      Property value
 * 
 * @return value to String or null
 */
public static String safePropertyToString(Serializable value) {
    if (value == null) {
        return null;
    } else if (value instanceof String) {
        return (String) value;
    } else {
        return value.toString();
    }
}

From source file:example.springdata.rest.uris.UserEntityLookup.java

@Override
public Object lookupEntity(Serializable id) {
    return repository.findByUsername(id.toString());
}

From source file:org.codice.alliance.nsili.common.ResultDAGConverter.java

public static List<String> addCardNodeWithAttributes(DirectedAcyclicGraph<Node, Edge> graph, Node productNode,
        Metacard metacard, ORB orb, String parentAttrName, List<String> resultAttributes) {
    List<String> addedAttributes = new ArrayList<>();
    Any any = orb.create_any();// w  ww . ja  v  a  2s  .com
    Node cardNode = new Node(0, NodeType.ENTITY_NODE, NsiliConstants.NSIL_CARD, any);
    graph.addVertex(cardNode);
    graph.addEdge(productNode, cardNode);

    String attribute = parentAttrName + NsiliConstants.NSIL_CARD;

    if (shouldAdd(buildAttr(attribute, NsiliConstants.IDENTIFIER), resultAttributes)
            && metacard.getId() != null) {
        addStringAttribute(graph, cardNode, NsiliConstants.IDENTIFIER, metacard.getId(), orb);
        addedAttributes.add(buildAttr(attribute, NsiliConstants.IDENTIFIER));
    }

    if (metacard.getCreatedDate() != null) {
        if (shouldAdd(buildAttr(attribute, NsiliConstants.SOURCE_DATE_TIME_MODIFIED), resultAttributes)) {
            addDateAttribute(graph, cardNode, NsiliConstants.SOURCE_DATE_TIME_MODIFIED,
                    metacard.getCreatedDate(), orb);
            addedAttributes.add(buildAttr(attribute, NsiliConstants.SOURCE_DATE_TIME_MODIFIED));
        }

        if (shouldAdd(buildAttr(attribute, NsiliConstants.DATE_TIME_MODIFIED), resultAttributes)) {
            addDateAttribute(graph, cardNode, NsiliConstants.DATE_TIME_MODIFIED, metacard.getCreatedDate(),
                    orb);
            addedAttributes.add(buildAttr(attribute, NsiliConstants.DATE_TIME_MODIFIED));
        }
    }

    if (shouldAdd(buildAttr(attribute, NsiliConstants.SOURCE_LIBRARY), resultAttributes)) {
        if (StringUtils.isNotBlank(metacard.getSourceId())) {
            addStringAttribute(graph, cardNode, NsiliConstants.SOURCE_LIBRARY, metacard.getSourceId(), orb);
        } else {
            addStringAttribute(graph, cardNode, NsiliConstants.SOURCE_LIBRARY, NsiliConstants.UNKNOWN, orb);
        }
        addedAttributes.add(buildAttr(attribute, NsiliConstants.SOURCE_LIBRARY));
    }

    if (shouldAdd(buildAttr(attribute, NsiliConstants.STATUS), resultAttributes)) {
        String status = NsiliCardStatus.CHANGED.name();
        Attribute createdAttr = metacard.getAttribute(Core.METACARD_CREATED);
        Attribute modifiedAttr = metacard.getAttribute(Core.METACARD_MODIFIED);
        if (createdAttr != null && modifiedAttr != null) {
            Date createdDate = (Date) createdAttr.getValue();
            Date modifiedDate = (Date) modifiedAttr.getValue();
            if (createdDate.equals(modifiedDate)) {
                status = NsiliCardStatus.NEW.name();
            }
        }

        Attribute versionAction = metacard.getAttribute(MetacardVersion.ACTION);

        if (versionAction != null) {
            for (Serializable action : versionAction.getValues()) {
                if (action.toString().trim().equals(MetacardVersion.Action.DELETED.getKey())) {
                    status = NsiliCardStatus.OBSOLETE.name();
                    break;
                }
            }
        }

        addStringAttribute(graph, cardNode, NsiliConstants.STATUS, status, orb);
        addedAttributes.add(buildAttr(attribute, NsiliConstants.STATUS));
    }

    return addedAttributes;
}

From source file:com.frank.search.solr.SolrRealtimeGetRequest.java

private void toStringIds(Collection<? extends Serializable> ids) {

    this.ids = new ArrayList<String>(ids.size());
    for (Serializable id : ids) {
        this.ids.add(id.toString());
    }//from  www  .j a  v  a  2s  .  c om
}

From source file:de.ingrid.interfaces.csw.harvest.impl.RecordCache.java

@Override
protected String getRelativePath(Serializable id) {
    return DigestUtils.md5Hex(id.toString()).substring(0, 3);
}

From source file:de.thischwa.pmcms.view.context.object.LinkTool.java

public LinkTool addParameter(String key, Serializable value) {
    addParameter(key, value.toString());
    return this;
}