<% const properties = locals.properties; const doc = locals.doc; -%> // This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. package com.mapbox.mapboxsdk.style.light; import android.support.annotation.ColorInt; import android.support.annotation.Keep; import android.support.annotation.NonNull; import android.support.annotation.UiThread; import com.mapbox.mapboxsdk.style.layers.Property; import com.mapbox.mapboxsdk.style.layers.TransitionOptions; import com.mapbox.mapboxsdk.utils.ColorUtils; import com.mapbox.mapboxsdk.utils.ThreadUtils; /** * The global light source. * * @see The online documentation */ @UiThread public class Light { @Keep private long nativePtr; /** * Creates a Light. * * @param nativePtr pointer used by core */ @Keep Light(long nativePtr) { checkThread(); this.nativePtr = nativePtr; } <% for (const property of properties) { -%> <% if (property.name == "position") {-%> /** * Set the <%- camelize(property.name) %> property. <%- property.doc %> * * @param position of the light */ public void set<%- camelize(property.name) %>(@NonNull Position position) { checkThread(); nativeSet<%- camelize(property.name) %>(position); } /** * Get the <%- camelize(property.name) %> property. <%- property.doc %> * * @return <%- property.name %> as Position */ @NonNull public Position get<%- camelize(property.name) %>() { checkThread(); return nativeGet<%- camelize(property.name) %>(); } <% } else { -%> <% if (property.name == "color") {-%> /** * Set the <%- camelize(property.name) %> property. <%- property.doc %> * * @param <%- property.name %> as int */ public void set<%- camelize(property.name) %>(@ColorInt int <%- property.name %>) { checkThread(); nativeSet<%- camelize(property.name) %>(ColorUtils.colorToRgbaString(<%- property.name %>)); } <% } -%> /** * Set the <%- camelize(property.name) %> property. <%- property.doc %> * * @param <%- property.name %> as <%- propertyType(property) %> */ public void set<%- camelize(property.name) %>(<%- propertyTypeAnnotation(property) %><%- iff(() => propertyTypeAnnotation(property), " ") %><%- propertyJavaType(property) %> <%- property.name %>) { checkThread(); nativeSet<%- camelize(property.name) %>(<%- property.name %>); } /** * Get the <%- camelize(property.name) %> property. <%- property.doc %> * * @return <%- property.name %> as <%- propertyType(property) %> */ @NonNull <%- propertyTypeAnnotation(property) %> public <%- propertyJavaType(property) %> get<%- camelize(property.name) %>() { checkThread(); return nativeGet<%- camelize(property.name) %>(); } <% } -%> <% if (property.transition) { -%> /** * Get the <%- camelize(property.name) %> property transition options. * * @return transition options for <%- property.name %> */ @NonNull public TransitionOptions get<%- camelize(property.name) %>Transition() { checkThread(); return nativeGet<%- camelize(property.name) %>Transition(); } /** * Set the <%- camelize(property.name) %> property transition options. * * @param options transition options for <%- property.name %> */ public void set<%- camelize(property.name) %>Transition(@NonNull TransitionOptions options) { checkThread(); nativeSet<%- camelize(property.name) %>Transition(options.getDuration(), options.getDelay()); } <% } -%> <% } -%> private void checkThread(){ ThreadUtils.checkThread("Light"); } <% for (const property of properties) { -%> <% if (property.name == "position") {-%> @Keep private native void nativeSet<%- camelize(property.name) %>(Position position); @NonNull @Keep private native Position nativeGet<%- camelize(property.name) %>(); <% } else { -%> @Keep private native void nativeSet<%- camelize(property.name) %>(<%- propertyJavaType(property) -%> <%- property.name %>); @NonNull @Keep private native <%- propertyJavaType(property) -%> nativeGet<%- camelize(property.name) %>(); <% } -%> <% if (property.transition) { -%> @NonNull @Keep private native TransitionOptions nativeGet<%- camelize(property.name) %>Transition(); @Keep private native void nativeSet<%- camelize(property.name) %>Transition(long duration, long delay); <% } -%> <% } -%> }