summaryrefslogtreecommitdiff
path: root/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/BaseMarkerOptions.java
blob: 384ff8c0acded3bbb6bef08bb2f5b822194f6223 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
package com.mapbox.mapboxsdk.annotations;

import android.os.Parcelable;

import com.mapbox.mapboxsdk.geometry.LatLng;

/**
 * Abstract builder class for composing custom Marker objects.
 * <p>
 * Extending this class requires implementing Parceable interface.
 *
 * @param <U> Type of the marker to be composed
 * @param <T> Type of the builder to be used for composing a custom Marker
 * @deprecated As of 7.0.0,
 * use <a href="https://github.com/mapbox/mapbox-plugins-android/tree/master/plugin-annotation">
 *   Mapbox Annotation Plugin</a> instead
 */
@Deprecated
public abstract class BaseMarkerOptions<U extends Marker, T extends BaseMarkerOptions<U, T>> implements Parcelable {

  protected LatLng position;
  protected String snippet;
  protected String title;
  protected Icon icon;

  /**
   * Set the geographical location of the Marker.
   *
   * @param position the location to position the {@link Marker}.
   * @return the object for which the method was called.
   */
  public T position(LatLng position) {
    this.position = position;
    return getThis();
  }

  /**
   * Set the snippet of the Marker.
   *
   * @param snippet the snippet of the {@link Marker}.
   * @return the object for which the method was called.
   */
  public T snippet(String snippet) {
    this.snippet = snippet;
    return getThis();
  }

  /**
   * Set the title of the Marker.
   *
   * @param title the title of the {@link Marker}.
   * @return the object for which the method was called.
   */
  public T title(String title) {
    this.title = title;
    return getThis();
  }

  /**
   * Set the icon of the Marker.
   *
   * @param icon the icon of the {@link Marker}.
   * @return the object for which the method was called.
   */
  public T icon(Icon icon) {
    this.icon = icon;
    return getThis();
  }

  /**
   * Set the icon of the Marker.
   *
   * @param icon the icon of the {@link Marker}.
   * @return the object for which the method was called.
   */
  public T setIcon(Icon icon) {
    return icon(icon);
  }

  /**
   * Set the geographical location of the Marker.
   *
   * @param position the location to position the {@link Marker}.
   * @return the object for which the method was called.
   */
  public T setPosition(LatLng position) {
    return position(position);
  }

  /**
   * Set the snippet of the Marker.
   *
   * @param snippet the snippet of the {@link Marker}.
   * @return the object for which the method was called.
   */
  public T setSnippet(String snippet) {
    return snippet(snippet);
  }

  /**
   * Set the title of the Marker.
   *
   * @param title the title of the {@link Marker}.
   * @return the object for which the method was called.
   */
  public T setTitle(String title) {
    return title(title);
  }

  /**
   * Get the instance of the object for which this method was called.
   *
   * @return the object for which the this method was called.
   */
  public abstract T getThis();

  /**
   * Get the Marker.
   *
   * @return the Marker created from this builder.
   */
  public abstract U getMarker();

}