Example #1
0
  @Override
  protected StringBuffer format(Scalar scalar, StringBuffer toAppendTo, FieldPosition pos) {
    if (scalar == null || scalar.getValue() == null) {
      return toAppendTo;
    }

    if (scalar instanceof Display && nf(scalar) != null) {
      NumberFormat f = nf(scalar);
      return f.format(scalar.getValue(), toAppendTo, pos);
    }

    toAppendTo.append(scalar.getValue());
    return toAppendTo;
  }
Example #2
0
 public boolean visit(Scalar s) throws Exception {
   Map<String, String> parameters = createInitialParameters(s);
   parameters.put("type", s.getType());
   parameters.put("value", s.getValue());
   xmlWriter.startTag("Scalar", parameters);
   return true;
 }
 public boolean visit(Statement e) throws Exception {
   if (typeDeclaration.sourceStart() < e.sourceStart()
       && typeDeclaration.sourceEnd() > e.sourceEnd()) {
     if (e instanceof PHPFieldDeclaration) {
       PHPFieldDeclaration phpFieldDecl = (PHPFieldDeclaration) e;
       if (phpFieldDecl.getDeclarationStart() == offset
           && phpFieldDecl.sourceEnd() - phpFieldDecl.getDeclarationStart() == length) {
         result = ((PHPFieldDeclaration) e).getVariableValue();
         if (result instanceof Scalar) {
           Scalar scalar = (Scalar) result;
           if (scalar.getScalarType() == Scalar.TYPE_STRING
               && scalar.getValue().toLowerCase().equals(NULL)) {
             result = null;
           }
         }
         context = contextStack.peek();
       }
     }
   }
   return visitGeneral(e);
 }