This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package net.wrap_trap.scala.examples | |
object ImplicitConversionTest { | |
def main(args : Array[String]) : Unit = { | |
val s1 : String = "Foo" | |
val i : Int = s1 // compile error 'type mismatch; found : String required: Int' without string2Int | |
System.out.println("i: " + i); | |
} | |
implicit def string2Int(str: String) : Int = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'jmx4r' | |
import java.lang.management.ManagementFactory | |
import javax.management.ObjectName | |
class MBeanRegister < JMX::DynamicMBean | |
operation "regster mbean script" | |
parameter :string, "mbean class name" | |
parameter :string, "object name" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void testSerliazingMapByMessagePack(){ | |
Map<String, Object> map = new HashMap<String, Object>(); | |
map.put("int", 1); | |
map.put("long", 1L); | |
map.put("date", new Date()); | |
map.put("string", "test"); | |
byte[] buffer = MessagePack.pack(map); | |
for (byte b : buffer) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package test.entity; | |
import java.util.List; | |
import com.google.code.morphia.annotations.Embedded; | |
@Embedded | |
public class Bar { | |
private long id; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package test; | |
import java.util.Arrays; | |
import java.util.Date; | |
import java.util.List; | |
import org.junit.Test; | |
import test.entity.Bar; | |
import test.entity.Foo; |
NewerOlder