str._formatter_field_name_split() and
unicode._formatter_field_name_split(). The function
_formatter_field_name_split() returns a pair (tuple) consisting of a head element
and an instance of this iterator. The constructor of this class effectively implements that
function, since as well as "being" the iterator, the object has an extra method head()
to return the required first member of the pair.
| Modifier and Type | Class and Description |
|---|---|
| public static class |
| Modifier and Type | Field and Description |
|---|---|
| private final boolean | bytes
True if originally given a PyString (so must return PyString not PyUnicode). |
| private Object | |
| private int | index
How far along that string we are. |
| private final String | markup
The UTF-16 string from which elements are being returned. |
| public static final PyType |
| Access | Constructor and Description |
|---|---|
| public | FieldNameIterator(String
the field name as UTF-16 fieldName, boolean true if elements returned should be PyString, else PyUnicode bytes)Create an iterator for the parts of this field name (and extract the head name field, which may be an empty string). |
| public | FieldNameIterator(PyString fieldNameObject)
Create an iterator for the parts of this field name (and extract the head name field, which may be an empty string). |
| Modifier and Type | Method and Description |
|---|---|
| public PyObject | __iter__()
Overrides org. Return an iterator that is used to iterate the element of this sequence. |
| public PyObject | __iternext__()
Overrides org. Return the next element of the sequence that this is an iterator for. |
| pack-priv final PyObject | |
| pack-priv final PyObject | |
| public Object | |
| public final boolean | Returns: true if originally given a PyStringIf originally given a PyString, the iterator must return PyString not PyUnicode. |
| public FieldNameIterator. | Returns: next element of the field nameReturn the next "chunk" of the field name (or return null if ended). |
| private int | |
| private void | |
| private void | |
| public PyObject | Returns: the isolated head object from the field name.Return the head object from the field name, as |
| public boolean | refersDirectlyTo(PyObject ob)
Implements org. Optional operation. |
| public int | traverse(Visitproc visit, Object arg)
Implements org. Traverses all directly contained |
| private PyObject |
| bytes | back to summary |
|---|---|
| private final boolean bytes True if originally given a PyString (so must return PyString not PyUnicode). | |
| head | back to summary |
|---|---|
| private Object head | |
| index | back to summary |
|---|---|
| private int index How far along that string we are. | |
| markup | back to summary |
|---|---|
| private final String markup The UTF-16 string from which elements are being returned. | |
| TYPE | back to summary |
|---|---|
| public static final PyType TYPE | |
| FieldNameIterator | back to summary |
|---|---|
| public FieldNameIterator(String fieldName, boolean bytes) Create an iterator for the parts of this field name (and extract the head name field, which may be an empty string). According to the Python Standard Library documentation, a replacement field name has the structure:
field_name ::= arg_name ("." attribute_name | "[" element_index "]")*
arg_name ::= [identifier | integer]
attribute_name ::= identifier
element_index ::= integer | index_string
The object is used from PyUnicode and from PyString, and we have to signal which it is, so
that returned values may match in type.
| |
| FieldNameIterator | back to summary |
|---|---|
| public FieldNameIterator(PyString fieldNameObject) Create an iterator for the parts of this field name (and extract the head name field, which may be an empty string). | |
| __iter__ | back to summary |
|---|---|
| public PyObject __iter__() Overrides org. Doc from org. Return an iterator that is used to iterate the element of this sequence. From version 2.2, this method is the primary protocol for looping over sequences. If a PyObject subclass should support iteration based in the __finditem__() method, it must supply an implementation of __iter__() like this:
public PyObject __iter__() {
return new PySequenceIter(this);
}
When iterating over a python sequence from java code, it should be done with code like
this:
for (PyObject item : seq.asIterable()) {
// Do something with item
}
| |
| __iternext__ | back to summary |
|---|---|
| public PyObject __iternext__() Overrides org. Doc from org. Return the next element of the sequence that this is an iterator for. Returns null when the end of the sequence is reached.
| |
| fieldnameiterator___iter__ | back to summary |
|---|---|
pack-priv final PyObject fieldnameiterator___iter__()
| |
| fieldnameiterator___iternext__ | back to summary |
|---|---|
pack-priv final PyObject fieldnameiterator___iternext__()
| |
| head | back to summary |
|---|---|
public Object head()
| |
| isBytes | back to summary |
|---|---|
| public final boolean isBytes() If originally given a PyString, the iterator must return PyString not PyUnicode.
| |
| nextChunk | back to summary |
|---|---|
| public FieldNameIterator. Return the next "chunk" of the field name (or return null if ended). A chunk is a 2-tuple describing:
| |
| nextDotOrBracket | back to summary |
|---|---|
| private int nextDotOrBracket(String markup) | |
| parseAttrChunk | back to summary |
|---|---|
| private void parseAttrChunk(FieldNameIterator. | |
| parseItemChunk | back to summary |
|---|---|
| private void parseItemChunk(FieldNameIterator. | |
| pyHead | back to summary |
|---|---|
| public PyObject pyHead() Return the head object from the field name, as
| |
| refersDirectlyTo | back to summary |
|---|---|
| public boolean refersDirectlyTo(PyObject ob) throws UnsupportedOperationException Implements org. Doc from org. Optional operation.
Should only be implemented if it is more efficient
than calling
| |
| traverse | back to summary |
|---|---|
| public int traverse(Visitproc visit, Object arg) Implements org. Doc from org. Traverses all directly contained
| |
| wrap | back to summary |
|---|---|
| private PyObject wrap(Object value) Convenience method to wrap a value as a PyInteger, if it is an Integer, or as
| |
| Modifier and Type | Field and Description |
|---|---|
| public boolean | |
| public Object | value
Integer or String. |
| Access | Constructor and Description |
|---|---|
| public |
| is_attr | back to summary |
|---|---|
| public boolean is_attr | |
| value | back to summary |
|---|---|
| public Object value Integer or String. | |
| Chunk | back to summary |
|---|---|
| public Chunk() | |