This file contains 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
fun main(args : Array<String>) { | |
println("hello, from Kotlin code!") | |
} |
This file contains 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
<project name="Kotlin" default="compile"> | |
<property environment="env"/> | |
<taskdef file="${env.KOTLIN_HOME}/build-tools/ant/src/org/jetbrains/jet/buildtools/ant/antlib.xml"> | |
<classpath> | |
<fileset dir="${env.KOTLIN_HOME}/dist/kotlinc/lib" includes="*.jar"/> | |
</classpath> | |
</taskdef> | |
<property name="output" value="${basedir}/dist"/> |
This file contains 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
<path id="classpath.run"> | |
<pathelement path="${output}/"/> | |
<pathelement path="${env.KOTLIN_HOME}/dist/kotlinc/lib/kotlin-runtime.jar"/> | |
</path> | |
<target name="run"> | |
<java classname="namespace"> | |
<sysproperty key="file.encoding" value="UTF-8"/> | |
<classpath refid="classpath.run"/> | |
</java> |
This file contains 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
public class DepX { | |
// stuff which depends upon Lib-version-1.x | |
} | |
public class DepY { | |
// stuff which depends upon Lib-version-1.y | |
} | |
public class UseBothDepXAndDepY { | |
DepX depX = ClApi.get(DepX.class); |
This file contains 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
import static net.ocheyedan.clapi.ClApi; | |
// class structure removed for brevity | |
void usageExample { | |
using(ThriftVersion.2); | |
callCodeDependingUponThriftVersion2(); | |
using(ThriftVersion.3); |
This file contains 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
TypeResolver typeResolver = new TypeResolver(); | |
ResolvedType resolvedType = typeResolver.resolve(getClass()); | |
MemberResolver memberResolver = new MemberResolver(typeResolver); | |
memberResolver.setFieldFilter(new Filter<RawField>() { | |
@Override public boolean include(RawField element) { | |
return "name".equals(element.getName()); | |
} | |
}); | |
ResolvedField[] resolvedFields = memberResolver.resolve(resolvedType, null, null).getMemberFields(); | |
if (resolvedFields.length < 1) { |
This file contains 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
Field nameField; | |
try { | |
nameField = getClass().getDeclaredField("name"); | |
} catch (NoSuchFieldException nsfe) { | |
throw new AssertionError("No field named 'name'"); | |
} | |
nameField.setAccessible(true); | |
try { | |
nameField.set(this, getClass().getName()); | |
} catch (IllegalAccessException iae) { |
This file contains 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 com.dashlabs.dash.cache; | |
import com.google.common.cache.CacheLoader; | |
import com.google.common.cache.CacheStats; | |
import com.google.common.cache.LoadingCache; | |
import com.google.common.collect.ImmutableMap; | |
import javax.annotation.Nullable; | |
import java.util.HashMap; | |
import java.util.Map; |
This file contains 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
private static final long UPDATE_INTERVAL_MS = 8000L; | |
private static final long FASTEST_UPDATE_INTERVAL_MS = 4000L; | |
... | |
LocationRequest locationRequest = LocationRequest.create(); | |
locationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY); | |
locationRequest.setInterval(UPDATE_INTERVAL_MS); | |
locationRequest.setFastestInterval(FASTEST_UPDATE_INTERVAL_MS); | |
locationClient.requestLocationUpdates(locationRequest, listener, locationService.getLocationLooper()); |
This file contains 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
locationClient.removeLocationUpdates(listener); |
OlderNewer