Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #12765

Re: Designing Interfaces

From Jeff Higgins <jeff@invalid.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: Designing Interfaces
Date 2012-03-08 09:35 -0500
Organization A noiseless patient Spider
Message-ID <jjag32$2nj$1@dont-email.me> (permalink)
References <XnsA00FC7119110Ajpnasty@94.75.214.39> <jjael9$qbc$1@dont-email.me>

Show all headers | View raw


On 03/08/2012 09:11 AM, Jeff Higgins wrote:
> On 03/07/2012 07:27 PM, Novice wrote:
>> This is actually a discussion ...
>
> import java.io.Writer;
> import java.util.Locale;
> public interface Resume {
   Writer write(Template t);
> Writer write(Template t, Locale l);
> }
>
> public interface Template {
> Element root();
> }
>
> // ElementVisitor ana Element
> // swiped from javax.lang.model
>
> public interface ElementVisitor<R, P> {
> /**
> * Visits an element.
> * @param e the element to visit
> * @param p a visitor-specified parameter
> * @return a visitor-specified result
> */
> R visit(Element e, P p);
> }
>

Oops. skip the AttributeSet, you can include it in the P parameter.

> import java.util.List;
> public interface Element {
> <R, P> R accept(ElementVisitor<R, P> v, P p);
> Element enclosingElement();
> List<? extends Element> enclosedElements();
> }
>

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Designing Interfaces Novice <novice@example..com> - 2012-03-08 00:27 +0000
  Re: Designing Interfaces Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-03-08 08:28 -0400
  Re: Designing Interfaces Jeff Higgins <jeff@invalid.invalid> - 2012-03-08 09:11 -0500
    Re: Designing Interfaces Jeff Higgins <jeff@invalid.invalid> - 2012-03-08 09:35 -0500
      Re: Designing Interfaces Jeff Higgins <jeff@invalid.invalid> - 2012-03-08 19:24 -0500
        Re: Designing Interfaces Jeff Higgins <jeff@invalid.invalid> - 2012-03-08 19:36 -0500
  Re: Designing Interfaces Novice <novice@example..com> - 2012-03-11 23:29 +0000

csiph-web