blob: f224612f23ffda20e6001339fbe6cc1697d83b82 (
plain) (
blame)
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
|
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.intent.model;
/**
* A representation of a source. Sources have no structure but are just id of a
* set which is defined in the application.
* <p>
* Sources are Value Objects.
* <p>
* Source ids should be human readable, start with lower case and use camel casing
*
* @author bratseth
*/
public class Source {
private String id;
/** Creates an intent from a string id */
public Source(String id) {
this.id=id;
}
/** Returns the id of this source, never null */
public String getId() { return id; }
public @Override int hashCode() { return id.hashCode(); }
public @Override boolean equals(Object other) {
if (other==this) return true;
if ( ! (other instanceof Source)) return false;
return this.id.equals(((Source)other).id);
}
/** Returns the id of this source */
public @Override String toString() { return id; }
}
|