Package org.daisy.dotify.api.translator
Class DefaultAttributeWithContext
- java.lang.Object
-
- org.daisy.dotify.api.translator.DefaultAttributeWithContext
-
- All Implemented Interfaces:
Iterable<AttributeWithContext>
,AttributeWithContext
public class DefaultAttributeWithContext extends Object implements AttributeWithContext
Provides a default implementation of attributes with context.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DefaultAttributeWithContext.Builder
Provides a builder for a default text attribute.
-
Field Summary
Fields Modifier and Type Field Description protected int
length
-
Constructor Summary
Constructors Modifier Constructor Description protected
DefaultAttributeWithContext(int length, DefaultAttributeWithContext.Builder builder)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Optional<String>
getName()
Gets the name of this attribute.int
getWidth()
Gets the width of this attribute.boolean
hasChildren()
Returns true if this attribute has children.Iterator<AttributeWithContext>
iterator()
String
toString()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
DefaultAttributeWithContext
protected DefaultAttributeWithContext(int length, DefaultAttributeWithContext.Builder builder)
-
-
Method Detail
-
getWidth
public int getWidth()
Description copied from interface:AttributeWithContext
Gets the width of this attribute.- Specified by:
getWidth
in interfaceAttributeWithContext
- Returns:
- the width, in items
-
hasChildren
public boolean hasChildren()
Description copied from interface:AttributeWithContext
Returns true if this attribute has children.- Specified by:
hasChildren
in interfaceAttributeWithContext
- Returns:
- true if this attribute has children, false otherwise
-
getName
public Optional<String> getName()
Description copied from interface:AttributeWithContext
Gets the name of this attribute.- Specified by:
getName
in interfaceAttributeWithContext
- Returns:
- an optional containing the attribute name, or an empty optional if it does not have any
-
iterator
public Iterator<AttributeWithContext> iterator()
- Specified by:
iterator
in interfaceIterable<AttributeWithContext>
-
-