TObject implements
        org.apache.thrift.TBase<TObject, TObject._Fields>,
        java.io.Serializable,
        Cloneable,
        Comparable<TObject> { public boolean isBlank() { if(this == NULL || type == Type.NULL) { return true; } else if(data.capacity() == 0) { return true; } else if(type == Type.STRING || type == Type.TAG) { byte[] bytes = ByteBuffers.toByteArray(data); for (int i = 0; i < bytes.length; ++i) { if(bytes[i] != WHITESPACE) { return false; } } return true; } else { return false; } } TObject();  TObject(ByteBuffer data, Type type);  TObject(TObject other); static Comparator<TObject> comparator(); static Aliases alias(Operator operator, TObject... values); ByteBuffer bufferForData(); @DoNotInvoke TObject cacheServerWrapper(Object serverValue); @Override void clear(); @Override int compareTo(TObject other); int compareToIgnoreCase(TObject other); TObject deepCopy(); @Override boolean equals(Object obj); _Fields fieldForId(int fieldId); byte[] getData(); Object getFieldValue(_Fields field); @Nullable Object getJavaFormat(); @Nullable @DoNotInvoke Object getServerWrapper(); Type getType(); @Override int hashCode(); boolean is(Operator operator, TObject... values); boolean isBlank(); boolean isCharSequenceType(); boolean isIgnoreCase(Operator operator, TObject... values); boolean isSet(_Fields field); boolean isSetData(); boolean isSetType(); boolean matches(TObject other); void read(org.apache.thrift.protocol.TProtocol iprot); TObject setData(byte[] data); TObject setData(ByteBuffer data); void setDataIsSet(boolean value); void setFieldValue(_Fields field, Object value); TObject setJavaFormat(Object java); TObject setType(Type type); void setTypeIsSet(boolean value); @Override String toString(); void unsetData(); void unsetType(); void validate(); void write(org.apache.thrift.protocol.TProtocol oprot); static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; static final TObject NEGATIVE_INFINITY; static final TObject NULL; static final TObject POSITIVE_INFINITY; public ByteBuffer data; public Type type; }
@Test public void testIsBlankNegative() { int count = Random.getScaleCount(); String s = ""; for (int i = 0; i < count; ++i) { s += " "; } String extra = ""; while (StringUtils.isBlank(extra)) { extra = Random.getString(); } s += extra; count = Random.getScaleCount(); for (int i = 0; i < count; ++i) { s += " "; } TObject t = Convert.javaToThrift(s); Assert.assertFalse(t.isBlank()); }
@Test public void testIsBlankPositive() { int count = Random.getScaleCount(); String s = ""; for (int i = 0; i < count; ++i) { s += " "; } TObject t = Convert.javaToThrift(s); Assert.assertTrue(t.isBlank()); }
@Test public void testNullIsAlwaysBlank() { Assert.assertTrue(TObject.NULL.isBlank()); }