public ClassField(
      StringValue name,
      String declaringClassName,
      Expr initValue,
      FieldVisibility visibility,
      String comment,
      boolean isTraitField) {
    _name = name;
    _declaringClassName = declaringClassName;

    _initValue = initValue;

    _comment = comment;

    _isTraitField = isTraitField;

    if (visibility.isProtected()) {
      StringValue sb = name.createStringBuilder();

      _canonicalName = createProtectedCanonicalName(sb, name);
    } else if (visibility.isPrivate()) {
      StringValue sb = name.createStringBuilder();

      _canonicalName = createPrivateCanonicalName(sb, name, declaringClassName);
    } else {
      _canonicalName = name;
    }
  }
Beispiel #2
0
  public static StringValue pgRealEscapeString(StringValue str) {
    StringValue buf = str.createStringBuilder(str.length());

    final int strLength = str.length();

    for (int i = 0; i < strLength; i++) {
      char c = str.charAt(i);

      switch (c) {
        case '\u0000':
          buf.append('\\');
          buf.append('\u0000');
          break;
        case '\n':
          buf.append('\\');
          buf.append('n');
          break;
        case '\r':
          buf.append('\\');
          buf.append('r');
          break;
        case '\\':
          buf.append('\\');
          buf.append('\\');
          break;
        case '\'':
          buf.append('\'');
          buf.append('\'');
          break;
        case '"':
          // pg_escape_string does nothing about it.
          // buf.append('\\');
          buf.append('\"');
          break;
        case '\032':
          buf.append('\\');
          buf.append('Z');
          break;
        default:
          buf.append(c);
          break;
      }
    }

    return buf;
  }
Beispiel #3
0
  protected void addText(StringValue text) {
    if (_text == null) _text = text.createStringBuilder();

    _text = _text.append(text);
  }
Beispiel #4
0
 protected void setText(StringValue text) {
   _text = text.createStringBuilder().append(text);
 }
 public static StringValue createPrivateCanonicalName(StringValue name, String declaringClass) {
   return createPrivateCanonicalName(name.createStringBuilder(), name, declaringClass);
 }