giraph-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jaeho Shin <Jaeho.S...@Stanford.EDU>
Subject Re: Why TextVertexReaderFromEachLine and TextVertexReader are protected?
Date Tue, 25 Sep 2012 21:02:37 GMT
Avery is correct.

The user class extending them should be an innerclass of the enclosing TextVertexInputFormat
anyway, so marking them protected makes sense.

Regarding the reason for switching to an innerclass, there was virtually no reuse of the TextVertexReader
class by a different TextVertexInputFormat, and keeping it static only made the redundant
type variables bloat the code, so we decided on the current design.


In fact, by not even naming the reader class, you can write a new text input format as simple
as these lines:


  public class YourTextVertexInputFormat extends TextVertexInputFormat<I, V, E, M> {
    @Override
    public TextVertexReader createVertexReader(InputSplit split, TaskAttemptContext context)
throws IOException {
      return new TextVertexReaderFromEachLine() {

        // TODO fill here

      };
    }
  }


~Jaeho



On Sep 25, 2012, at 13:16 , Avery Ching <aching@apache.org> wrote:

> Hi Paolo,
> 
> The idea is to allow them to be used by subclassing only (I think).  Jaeho did this work.
 Any reason you don't want it protected?
> 
> On 9/25/12 12:51 PM, Paolo Castagna wrote:
>> Hi,
>> why TextVertexReaderFromEachLine and TextVertexReader are protected?
>> 
>> The Javadoc comments seem to assume users should be allowed to extend those.
>> 
>> Paolo
> 


Mime
View raw message