Example usage for java.lang Short toString

List of usage examples for java.lang Short toString

Introduction

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

Prototype

public static String toString(short s) 

Source Link

Document

Returns a new String object representing the specified short .

Usage

From source file:com.ibm.research.rdf.store.jena.impl.DB2Graph.java

public static ExtendedIterator<Triple> find(Store store, TripleMatch m, String gid, Connection con,
        boolean isReified, boolean searchAllGraphs) {

    Node subNode = m.getMatchSubject();
    Node preNode = m.getMatchPredicate();
    Node objNode = m.getMatchObject();
    boolean exception = false;
    boolean directAccess = !((subNode == null || subNode.equals(Node.ANY))
            && !(objNode == null || objNode.equals(Node.ANY)));

    boolean isGraph = (!(gid == null));
    List<String> params = new ArrayList<String>();

    if (searchAllGraphs) {
        // this means the call is coming from Dataset.find(Quad)
        // do nothing
    } else {//from w  w  w. j a  v  a2 s.  c  om
        // this is the old code for simple Graph.find(Triple)
        if (gid == null) {
            exception = true;
        }
        params.add(gid);
    }

    StringBuffer whereClause = new StringBuffer();

    if (subNode != null && !subNode.equals(Node.ANY)) {
        whereClause.append(" AND ");
        if (directAccess) {
            whereClause.append("T.");
            whereClause.append(Constants.NAME_COLUMN_ENTRY);
            whereClause.append(" = ?");
        } else {
            whereClause.append("LT.");
            whereClause.append(Constants.NAME_COLUMN_PREFIX_VALUE);
            whereClause.append(" = ?");
        }
        String value = Node2String.getString(subNode);
        value = getCustomString(value, store.getMaxStringLen());

        if (value == null) {
            exception = true;
        }
        params.add(value);
    }

    if (preNode != null && !preNode.equals(Node.ANY)) {
        whereClause.append(" AND ");
        whereClause.append("LT.");
        whereClause.append(Constants.NAME_COLUMN_PREFIX_PREDICATE);
        whereClause.append(" = ?");
        String value = Node2String.getString(preNode);

        value = getCustomString(value, store.getMaxStringLen());

        if (value == null) {
            exception = true;
        }
        params.add(value);
    }

    StringBuffer sql = new StringBuffer();

    if (directAccess) {
        sql.append(InsertAndUpdateStatements.getTripleInGraphDPH(store.getDirectPrimary(),
                store.getDirectSecondary(), store.getLongStrings(), store.getDPrimarySize(),
                store.isLongString(), isGraph, whereClause.toString()));
    } else {
        sql.append(InsertAndUpdateStatements.getTripleInGraphRPH(store.getReversePrimary(),
                store.getReverseSecondary(), store.getLongStrings(), store.getRPrimarySize(),
                store.isLongString(), isGraph, whereClause.toString()));
    }

    if (objNode != null && !objNode.equals(Node.ANY)) {
        sql.append(" WHERE ");
        sql.append(" VALUE = ?");
        sql.append(" AND TYPE = ?");

        String literalValue = Node2String.getString(objNode);
        literalValue = getCustomString(literalValue, store.getMaxStringLen());
        if (literalValue == null) {
            exception = true;
        }
        params.add(literalValue);
        params.add(Short.toString(Node2String.getType(objNode)));
    }

    PreparedStatement stmt = null;
    ResultSet rs = null;
    try {
        stmt = con.prepareStatement(sql.toString());
        rs = getRS(stmt, params, exception);
        return new DB2ResultSetIterator(rs, con, store);
    } catch (SQLException e) {
        DB2CloseObjects.close(rs, stmt);
        return null;
    }
}

From source file:net.sourceforge.msscodefactory.cfcrm.v2_0.CFCrm.CFCrmAuditActionPKey.java

public String toString() {
    String ret = "<CFCrmAuditActionPKey" + " RequiredAuditActionId=" + "\""
            + Short.toString(getRequiredAuditActionId()) + "\"" + "/>";
    return (ret);
}

From source file:net.sourceforge.msscodefactory.cfcrm.v2_0.CFCrm.CFCrmISOTimezonePKey.java

public String toString() {
    String ret = "<CFCrmISOTimezonePKey" + " RequiredISOTimezoneId=" + "\""
            + Short.toString(getRequiredISOTimezoneId()) + "\"" + "/>";
    return (ret);
}

From source file:net.sourceforge.msscodefactory.cfcrm.v2_0.CFCrm.CFCrmURLProtocolPKey.java

public String toString() {
    String ret = "<CFCrmURLProtocolPKey" + " RequiredURLProtocolId=" + "\""
            + Short.toString(getRequiredURLProtocolId()) + "\"" + "/>";
    return (ret);
}

From source file:net.sourceforge.msscodefactory.cfinternet.v2_0.CFInternet.CFInternetISOTimezonePKey.java

public String toString() {
    String ret = "<CFInternetISOTimezonePKey" + " RequiredISOTimezoneId=" + "\""
            + Short.toString(getRequiredISOTimezoneId()) + "\"" + "/>";
    return (ret);
}

From source file:net.sourceforge.msscodefactory.cfinternet.v2_0.CFInternet.CFInternetURLProtocolPKey.java

public String toString() {
    String ret = "<CFInternetURLProtocolPKey" + " RequiredURLProtocolId=" + "\""
            + Short.toString(getRequiredURLProtocolId()) + "\"" + "/>";
    return (ret);
}

From source file:de.micromata.genome.util.strings.converter.StandardStringConverter.java

@Override
public Pair<Character, String> objectToString(Object value) {
    if (value == null) {
        return Pair.make(ConvertedStringTypes.NULL.getShortType(), null);
    }//from w  w  w.j  a v  a  2s .  co  m
    if (value instanceof String) {
        return Pair.make(ConvertedStringTypes.STRING.getShortType(), (String) value);
    }
    if (value instanceof Boolean) {
        return Pair.make(ConvertedStringTypes.BOOLEAN.getShortType(), Boolean.toString((Boolean) value));
    }
    if (value instanceof Byte) {
        return Pair.make(ConvertedStringTypes.BYTE.getShortType(), Byte.toString((Byte) value));
    }
    if (value instanceof Short) {
        return Pair.make(ConvertedStringTypes.SHORT.getShortType(), Short.toString((Short) value));
    }
    if (value instanceof Integer) {
        return Pair.make(ConvertedStringTypes.INTEGER.getShortType(), Integer.toString((Integer) value));
    }
    if (value instanceof Long) {
        return Pair.make(ConvertedStringTypes.LONG.getShortType(), Long.toString((Long) value));
    }
    if (value instanceof Float) {
        return Pair.make(ConvertedStringTypes.FLOAT.getShortType(), Float.toString((Float) value));
    }
    if (value instanceof Double) {
        return Pair.make(ConvertedStringTypes.DOUBLE.getShortType(), Double.toString((Double) value));
    }
    if (value instanceof Date) {
        return Pair.make(ConvertedStringTypes.DATE.getShortType(), formatDate((Date) value));
    }
    if (value instanceof BigDecimal) {
        return Pair.make(ConvertedStringTypes.BIGDECIMAL.getShortType(), formatBigDecimal((BigDecimal) value));
    }
    if (value instanceof Character) {
        return Pair.make(ConvertedStringTypes.CHAR.getShortType(), Character.toString((Character) value));
    }
    if (value instanceof byte[]) {
        return Pair.make(ConvertedStringTypes.BYTEARRAY.getShortType(), formatByteArray((byte[]) value));
    }
    if (value instanceof String[]) {
        return Pair.make(ConvertedStringTypes.STRINGARRAY.getShortType(), formatStringArray((String[]) value));
    }
    if (value instanceof Long[]) {
        return Pair.make(ConvertedStringTypes.LONGARRAY.getShortType(), formatLongArray((Long[]) value));
    }

    throw new IllegalArgumentException(
            "StringConverter; Cannot encode object to string: " + value.getClass().getName());
}

From source file:com.blocks.framework.utils.date.StringUtil.java

/**
  * short??String/*from   w  w w.  ja  v a 2s  .c  o m*/
  * 
  * @param val
  *            short
  * @return String
  */
 public static String toString(short val) {
     return Short.toString(val);
 }

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAst.CFAstISOCountryPKey.java

public String toString() {
    String ret = "<CFAstISOCountryPKey" + " RequiredId=" + "\"" + Short.toString(getRequiredId()) + "\"" + "/>";
    return (ret);
}

From source file:net.sourceforge.msscodefactory.cffreeswitch.v2_0.CFFsw.CFFswISOCountryPKey.java

public String toString() {
    String ret = "<CFFswISOCountryPKey" + " RequiredId=" + "\"" + Short.toString(getRequiredId()) + "\"" + "/>";
    return (ret);
}