org.pentaho.di.core.Const.rightPad()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(9.1k)|赞(0)|评价(0)|浏览(133)

本文整理了Java中org.pentaho.di.core.Const.rightPad()方法的一些代码示例,展示了Const.rightPad()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Const.rightPad()方法的具体详情如下:
包路径:org.pentaho.di.core.Const
类名称:Const
方法名:rightPad

Const.rightPad介绍

[英]Right pad a string: adds spaces to a string until a certain length. If the length is smaller then the limit specified, the String is truncated.
[中]右键填充字符串:在字符串中添加空格,直到达到一定长度。如果长度小于指定的限制,则字符串将被截断。

代码示例

代码示例来源:origin: pentaho/pentaho-kettle

/**
 * Right pad a string: adds spaces to a string until a certain length. If the length is smaller then the limit
 * specified, the String is truncated.
 *
 * @param ret
 *          The string to pad
 * @param limit
 *          The desired length of the padded string.
 * @return The padded String.
 */
public static final String rightPad( String ret, int limit ) {
 return Const.rightPad( ret, limit );
}

代码示例来源:origin: pentaho/pentaho-kettle

/**
 * Right pad a StringBuffer: adds spaces to a string until a certain length. If the length is smaller then the limit
 * specified, the String is truncated.
 *
 * @param ret
 *          The StringBuffer to pad
 * @param limit
 *          The desired length of the padded string.
 * @return The padded String.
 */
public static final String rightPad( StringBuffer ret, int limit ) {
 return Const.rightPad( ret, limit );
}

代码示例来源:origin: pentaho/pentaho-kettle

public String getOperatorDesc() {
 return Const.rightPad( operators[operator], 7 );
}

代码示例来源:origin: pentaho/pentaho-kettle

/**
 * Create an array of Strings consisting of spaces. The index of a String in the array determines the number of spaces
 * in that string.
 *
 * @return array of 'space' Strings.
 */
public static String[] getEmptyPaddedStrings() {
 if ( emptyPaddedSpacesStrings == null ) {
  emptyPaddedSpacesStrings = new String[250];
  for ( int i = 0; i < emptyPaddedSpacesStrings.length; i++ ) {
   emptyPaddedSpacesStrings[i] = rightPad( "", i );
  }
 }
 return emptyPaddedSpacesStrings;
}

代码示例来源:origin: pentaho/pentaho-kettle

/**
 * Right pad a string: adds spaces to a string until a certain length. If the length is smaller then the limit
 * specified, the String is truncated.
 *
 * @param ret
 *          The string to pad
 * @param limit
 *          The desired length of the padded string.
 * @return The padded String.
 */
public static String rightPad( String ret, int limit ) {
 if ( ret == null ) {
  return rightPad( new StringBuilder(), limit );
 } else {
  return rightPad( new StringBuilder( ret ), limit );
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

/**
 * @return the usage description
 *
 */
public String getUsageDescription() {
 String optionStart = "  -";
 String optionDelim = " = ";
 if ( Const.isWindows() ) {
  optionStart = "  /";
  optionDelim = " : ";
 }
 return optionStart + Const.rightPad( option, 14 ) + optionDelim + description;
}

代码示例来源:origin: pentaho/pentaho-kettle

public String getXML( int level ) {
 String spaces = Const.rightPad( " ", level );
 StringBuilder retval = new StringBuilder( 200 );
 retval.append( spaces ).append( "<repdir>" ).append( Const.CR );
 retval.append( spaces ).append( "  " ).append( XMLHandler.addTagValue( "name", getName() ) );
 if ( getNrSubdirectories() > 0 ) {
  retval.append( spaces ).append( "    <subdirs>" ).append( Const.CR );
  for ( int i = 0; i < getNrSubdirectories(); i++ ) {
   RepositoryDirectory subdir = getSubdirectory( i );
   retval.append( subdir.getXML( level + 1 ) );
  }
  retval.append( spaces ).append( "    </subdirs>" ).append( Const.CR );
 }
 retval.append( spaces ).append( "</repdir>" ).append( Const.CR );
 return retval.toString();
}

代码示例来源:origin: pentaho/pentaho-kettle

private String getMetaStoreFolders( StringBuilder builder, RepositoryFile folder, int level ) {
 String spaces = Const.rightPad( " ", level * 2 );
 builder.append( spaces );
 if ( folder.isFolder() ) {
  builder.append( "/" );
 }
 builder.append( folder.getName() ).append( Const.CR );
 for ( RepositoryFile file : getChildren( folder.getId() ) ) {
  getMetaStoreFolders( builder, file, level + 1 );
 }
 return builder.toString();
}

代码示例来源:origin: pentaho/pentaho-kettle

/**
 * Get an array of strings showing the name of the values in the row padded to a maximum length, followed by the types
 * of the values.
 *
 * @param maxlen The length to which the name will be padded.
 * @return an array of strings: the names and the types of the fieldnames in the row.
 */
@Override
public String[] getFieldNamesAndTypes( int maxlen ) {
 lock.readLock().lock();
 try {
  final int size = size();
  String[] retval = new String[ size ];
  for ( int i = 0; i < size; i++ ) {
   ValueMetaInterface v = getValueMeta( i );
   retval[ i ] = Const.rightPad( v.getName(), maxlen ) + "   (" + v.getTypeDesc() + ")";
  }
  return retval;
 } finally {
  lock.readLock().unlock();
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

|| pol.equalsIgnoreCase( Const.rightPad( new StringBuilder( null_value ), pol.length() ) ) ) {
pol = ifNull;
 if ( pol.equalsIgnoreCase( Const.rightPad( new StringBuilder( null_value ), pol.length() ) ) ) {
  return null;

代码示例来源:origin: pentaho/pentaho-kettle

|| pol.equalsIgnoreCase( Const.rightPad( new StringBuilder( null_value ), pol.length() ) ) ) {
pol = ifNull;
 if ( pol.equalsIgnoreCase( Const.rightPad( new StringBuilder( null_value ), pol.length() ) ) ) {
  return null;

代码示例来源:origin: pentaho/pentaho-kettle

protected synchronized String convertNumberToString( Double number ) throws KettleValueException {
 if ( number == null ) {
  if ( !outputPaddingEnabled || length < 1 ) {
   return null;
  } else {
   // Return strings padded to the specified length...
   // This is done for backward compatibility with 2.5.x
   // We just optimized this a bit...
   //
   String[] emptyPaddedStrings = Const.getEmptyPaddedStrings();
   if ( length < emptyPaddedStrings.length ) {
    return emptyPaddedStrings[length];
   } else {
    return Const.rightPad( "", length );
   }
  }
 }
 try {
  DecimalFormat format = getDecimalFormat( false );
  // When conversion masks are different, we must ensure the number precision is not lost
  if ( this.conversionMask != null && storageMetadata != null
      && !this.conversionMask.equals( storageMetadata.getConversionMask() ) ) {
   format.setMaximumFractionDigits( 50 );
  }
  return format.format( number );
 } catch ( Exception e ) {
  throw new KettleValueException( toString() + " : couldn't convert Number to String ", e );
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

if ( isNull() ) {
 StringBuilder ret = new StringBuilder( Const.NULL_INTEGER );
 Const.rightPad( ret, getLength() );
 retval = ret.toString();
} else {

代码示例来源:origin: pentaho/pentaho-kettle

protected synchronized String convertIntegerToString( Long integer ) throws KettleValueException {
 if ( integer == null ) {
  if ( !outputPaddingEnabled || length < 1 ) {
   return null;
  } else {
   // Return strings padded to the specified length...
   // This is done for backward compatibility with 2.5.x
   // We just optimized this a bit...
   //
   String[] emptyPaddedStrings = Const.getEmptyPaddedStrings();
   if ( length < emptyPaddedStrings.length ) {
    return emptyPaddedStrings[length];
   } else {
    return Const.rightPad( "", length );
   }
  }
 }
 try {
  return getDecimalFormat( false ).format( integer );
 } catch ( Exception e ) {
  throw new KettleValueException( toString() + " : couldn't convert Long to String ", e );
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

private void addBacktracking( JobTracker jobTracker, StringBuilder messageText, int level ) {
 int nr = jobTracker.nrJobTrackers();
 messageText.append( Const.rightPad( " ", level * 2 ) );
 messageText.append( Const.NVL( jobTracker.getJobName(), "-" ) );
 JobEntryResult jer = jobTracker.getJobEntryResult();

代码示例来源:origin: pentaho/pentaho-kettle

if ( isNull() ) {
 StringBuilder ret = new StringBuilder( Const.NULL_NUMBER );
 Const.rightPad( ret, value.getLength() );
 retval = ret.toString();
} else {

代码示例来源:origin: pentaho/pentaho-kettle

/**
 * Get an array of strings showing the name of the values in the row padded to a maximum length, followed by the types
 * of the values.
 *
 * @param maxlen
 *          The length to which the name will be padded.
 * @return an array of strings: the names and the types of the fieldnames in the row.
 */
public String[] getFieldNamesAndTypes( int maxlen ) {
 String[] retval = new String[size()];
 for ( int i = 0; i < size(); i++ ) {
  Value v = getValue( i );
  retval[i] = Const.rightPad( v.getName(), maxlen ) + "   (" + v.getTypeDesc() + ")";
 }
 return retval;
}

代码示例来源:origin: pentaho/pentaho-kettle

length = 16384; // otherwise we get OUT OF MEMORY errors for CLOBS.
Const.rightPad( ret, length );

代码示例来源:origin: pentaho/pentaho-kettle

public String getXML( int level ) throws KettleValueException {
 String retval = "";
 String indent1 = Const.rightPad( " ", level );
 String indent2 = Const.rightPad( " ", level + 1 );
 String indent3 = Const.rightPad( " ", level + 2 );
 retval += indent1 + XMLHandler.openTag( XML_TAG ) + Const.CR;
 retval += indent2 + XMLHandler.addTagValue( "negated", isNegated() );
 if ( getOperator() != OPERATOR_NONE ) {
  retval += indent2 + XMLHandler.addTagValue( "operator", Const.rtrim( getOperatorDesc() ) );
 }
 if ( isAtomic() ) {
  retval += indent2 + XMLHandler.addTagValue( "leftvalue", getLeftValuename() );
  retval += indent2 + XMLHandler.addTagValue( "function", getFunctionDesc() );
  retval += indent2 + XMLHandler.addTagValue( "rightvalue", getRightValuename() );
  if ( getRightExact() != null ) {
   retval += indent2 + getRightExact().getXML();
  }
 } else {
  retval += indent2 + "<conditions>" + Const.CR;
  for ( int i = 0; i < nrConditions(); i++ ) {
   Condition c = getCondition( i );
   retval += c.getXML( level + 2 );
  }
  retval += indent3 + "</conditions>" + Const.CR;
 }
 retval += indent2 + XMLHandler.closeTag( XML_TAG ) + Const.CR;
 return retval;
}

代码示例来源:origin: pentaho/pentaho-kettle

private void drawAtomic( GC gc, int x, int y, Condition condition ) {
 String left = Const.rightPad( condition.getLeftValuename(), max_field_length );
 Point ext_left = gc.textExtent( left );
 if ( condition.getLeftValuename() == null ) {
 Point ext_fn = gc.textExtent( fn_max );
 String rightval = Const.rightPad( condition.getRightValuename(), max_field_length );
 Point ext_rval = gc.textExtent( rightval );
 if ( condition.getLeftValuename() == null ) {
  rightex_max = Const.rightPad( " ", 10 );
 } else {
  if ( rightex.length() < 10 ) {
   rightex_max = Const.rightPad( rightex, 10 );

相关文章