Java 类java.lang.Cloneable 实例源码

项目:wava    文件:TestTypeSpec.java   
@Test
public void enumImplements()
        throws Exception
{
    TypeSpec typeSpec = TypeSpec.enumBuilder("Food")
            .addSuperinterface(Serializable.class)
            .addSuperinterface(Cloneable.class)
            .addEnumConstant("LEAN_GROUND_BEEF")
            .addEnumConstant("SHREDDED_CHEESE")
            .build();
    assertThat(toString(typeSpec)).isEqualTo(""
            + "package com.squareup.tacos;\n"
            + "\n"
            + "import java.io.Serializable;\n"
            + "import java.lang.Cloneable;\n"
            + "\n"
            + "enum Food implements Serializable, Cloneable {\n"
            + "  LEAN_GROUND_BEEF,\n"
            + "\n"
            + "  SHREDDED_CHEESE\n"
            + "}\n");
}
项目:javapoet    文件:TypeSpecTest.java   
@Test public void enumImplements() throws Exception {
  TypeSpec typeSpec = TypeSpec.enumBuilder("Food")
      .addSuperinterface(Serializable.class)
      .addSuperinterface(Cloneable.class)
      .addEnumConstant("LEAN_GROUND_BEEF")
      .addEnumConstant("SHREDDED_CHEESE")
      .build();
  assertThat(toString(typeSpec)).isEqualTo(""
      + "package com.squareup.tacos;\n"
      + "\n"
      + "import java.io.Serializable;\n"
      + "import java.lang.Cloneable;\n"
      + "\n"
      + "enum Food implements Serializable, Cloneable {\n"
      + "  LEAN_GROUND_BEEF,\n"
      + "\n"
      + "  SHREDDED_CHEESE\n"
      + "}\n");
}
项目:HotswapAgentExamples    文件:HelloWorldHotswap.java   
public void dummy() {
    new Cloneable() {};
}