public String getText()

in modules/jretools/src/main/java/org/apache/harmony/jretools/policytool/model/GrantEntry.java [111:148]


    public String getText() {
        final StringBuilder textBuilder = new StringBuilder( KEYWORD );

        if ( signedBy != null && signedBy.length() > 0 )
            textBuilder.append( " signedBy \"" ).append( signedBy ).append( '"' );

        if ( codeBase != null && codeBase.length() > 0 ) {
            if ( signedBy != null && signedBy.length() > 0 )
                textBuilder.append( ',' );
            textBuilder.append( " codeBase \"" ).append( codeBase ).append( '"' );
        }

        if ( principalList.isEmpty() )
            textBuilder.append( ' ' );
        else {
            if ( signedBy != null && signedBy.length() > 0
              || codeBase != null && codeBase.length() > 0 )
                textBuilder.append( ',' );
            textBuilder.append( Consts.NEW_LINE_STRING );

            for ( final Iterator< Principal > principalIterator = principalList.iterator(); principalIterator.hasNext(); ) {
                textBuilder.append( "      " ).append( principalIterator.next().toString() );
                if ( principalIterator.hasNext() )
                    textBuilder.append( ',' ).append( Consts.NEW_LINE_STRING );
                else
                    textBuilder.append( ' ' );
            }
        }

        textBuilder.append( '{' ).append( Consts.NEW_LINE_STRING );

        for ( final Permission permission : permissionList )
            textBuilder.append( "\tpermission " ).append( permission.toString( Consts.NEW_LINE_STRING + "\t\t" ) ).append( TERMINATOR_CHAR ).append( Consts.NEW_LINE_STRING );

        textBuilder.append( '}' ).append( TERMINATOR_CHAR );

        return textBuilder.toString();
    }