Java List Create createInterfaceContent(String typeName, @SuppressWarnings("rawtypes") List superInterfaces, String indentation, String lineSeparator)

Here you can find the source of createInterfaceContent(String typeName, @SuppressWarnings("rawtypes") List superInterfaces, String indentation, String lineSeparator)

Description

create Interface Content

License

Open Source License

Declaration

public static String createInterfaceContent(String typeName,
            @SuppressWarnings("rawtypes") List superInterfaces,
            String indentation, String lineSeparator) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2013 itemis AG (http://www.itemis.eu) and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *******************************************************************************/

import java.util.Iterator;
import java.util.List;

public class Main {
    public static String createInterfaceContent(String typeName,
            @SuppressWarnings("rawtypes") List superInterfaces,
            String indentation, String lineSeparator) {
        StringBuffer sb = new StringBuffer();
        sb.append("interface ");
        sb.append(typeName);//from ww  w  . j a  va2 s  .c om
        @SuppressWarnings("rawtypes")
        Iterator i = superInterfaces.iterator();
        if (i.hasNext()) {
            sb.append(" extends ");
            sb.append(stripPackage(i.next()));
            while (i.hasNext()) {
                sb.append(", ");
                sb.append(stripPackage(i.next()));
            }
        }
        sb.append(" {");
        sb.append(lineSeparator);
        sb.append(indentation);
        sb.append(lineSeparator);
        sb.append("}");
        return sb.toString();
    }

    private static Object stripPackage(Object superType) {
        return superType.toString().replaceAll("^(\\w+\\.)*", "");
    }
}

Related

  1. CreateIntArrayFromIntegerList(List solidsList)
  2. createIntegerList(int[] array)
  3. createIntegerQueryString(List values)
  4. CreateIntegerSequenceList(int startNumber, int endNumber)
  5. createIntegerSetFromIntegerList(List integerList)
  6. createIntListToN(int n)
  7. createKeyValPair(List lst)
  8. createLimitSql(StringBuilder sql, Integer startNum, Integer rowNum, List params)
  9. createList( Iterator iterator )

  10. HOME | Copyright © www.java2s.com 2016