Here you can find the source of lengthExpression(final String operand, final long length)
Parameter | Description |
---|---|
operand | Name of member variable or other operand (e.g. a string literal) for comparison in expression |
length | Value of 'length' restriction |
public static String lengthExpression(final String operand, final long length)
//package com.java2s; public class Main { /**/* ww w .j a v a 2 s . c o m*/ * Build expression to check the 'length' restriction, depending * on the data type of the member variable. * * @param operand Name of member variable or other operand (e.g. * a string literal) for comparison in expression * @param length Value of 'length' restriction * * @return Expression for restriction check */ public static String lengthExpression(final String operand, final long length) { return String.format("%s.length() != %d", operand, length); } }