public abstract class StringTemplate extends Object implements WritableRawComparable
Modifier and Type | Class and Description |
---|---|
static class |
StringTemplate.Format
Format of each generator element.
|
static class |
StringTemplate.FormatSpec
The format spec.
|
Modifier and Type | Field and Description |
---|---|
static StringTemplate |
EMPTY
An empty template.
|
Modifier | Constructor and Description |
---|---|
protected |
StringTemplate(StringTemplate.FormatSpec... specs)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
String |
apply()
Returns a generated name.
|
int |
compareInBytes(byte[] b1,
int o1,
byte[] b2,
int o2)
Compares two objects in bytes.
|
int |
compareTo(WritableRawComparable o) |
boolean |
equals(Object obj) |
int |
getSizeInBytes(byte[] buf,
int offset)
Computes and returns size in bytes.
|
int |
hashCode() |
void |
readFields(DataInput in) |
abstract void |
set(Object object)
Sets an object for generating a name.
|
protected void |
setProperty(int index,
Object value)
Sets a property value.
|
void |
write(DataOutput out) |
public static final StringTemplate EMPTY
protected StringTemplate(StringTemplate.FormatSpec... specs)
specs
- format specificationsIllegalArgumentException
- if some parameters were null
public abstract void set(Object object)
object
- target objectRuntimeException
- if the object or its properties are wrongprotected final void setProperty(int index, Object value)
index
- target indexvalue
- property valueRuntimeException
- if the value is wrongpublic final String apply()
public final void write(DataOutput out) throws IOException
write
in interface org.apache.hadoop.io.Writable
IOException
public final void readFields(DataInput in) throws IOException
readFields
in interface org.apache.hadoop.io.Writable
IOException
public final int getSizeInBytes(byte[] buf, int offset) throws IOException
getSizeInBytes
in interface WritableRawComparable
buf
- bytes arrayoffset
- bytes offsetIOException
- if failed to compute sizepublic final int compareInBytes(byte[] b1, int o1, byte[] b2, int o2) throws IOException
compareInBytes
in interface WritableRawComparable
b1
- bytes representation of the first objecto1
- offset of the first objectb2
- bytes representation of the second objecto2
- offset of the second objectIOException
- if failed to comparisonpublic final int compareTo(WritableRawComparable o)
compareTo
in interface Comparable<WritableRawComparable>
Copyright © 2011–2019 Asakusa Framework Team. All rights reserved.