• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: WOLips gives WO Template Problems (keypaths) even if not real problems!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: WOLips gives WO Template Problems (keypaths) even if not real problems!


  • Subject: Re: WOLips gives WO Template Problems (keypaths) even if not real problems!
  • From: Chuck Hill <email@hidden>
  • Date: Tue, 25 Mar 2014 16:47:12 +0000
  • Thread-topic: WOLips gives WO Template Problems (keypaths) even if not real problems!

The // VALID marker is the intended way to fix validation problems like this.

Chuck


On 2014-03-25, 7:33 AM, "Filippo Laurìa" wrote:

Hello everybody,

I have a simple `component id generator` that implements
`NSKeyValueCodingAdditions`. Something like this:

public class ComponentIDGenerator implements NSKeyValueCodingAdditions {
  private String idBase;

  public ComponentIDGenerator(
WOComponent component) {
    idBase = "_" + component.context().elementID().replace('.', '_');
  }

  public Object valueForKeyPath(String keypath) {
    return get(keypath);
  }

  public String get(String keypath) {
    String suffix = keypath.replace('.', '_');
    return idBase + "_" + suffix;
  }
  ...
}

I pasted it because it is really simple to understand.

When initializing a component (in the appendToResponse() method) the
generator is called like this:
`String idFor = new ComponentIDGenerator(this);`

In the wod, when I try to access keys like:
`idFor.foo` or `idFor.bar` i get WO Template errors from WOLips:
"there is no key foo for the keypath idFor".

It's useless to say that at runtime everything runs fine.

I found two ways to workaround this issues:
1) use WOGNL _expression_ in the wod. So i use ~idFor.foo
2) foreach key create a getKey method. For example: getFoo()
  return idFor.valueForKey("foo").toString();

I don't like those two ways:
the first because it is not our purpose to use WOGNL framework in the
application,
the second because the work load becomes very huge.

Maybe there is a third way:
put // VALID next to the wod defecting property-value pair, like
id = idFor.foo; // VALID

I want to know if is there a correct way to remove this kind of errors
between those i mentioned before, or maybe something better.

Thank you for reading.

Regards,
  Filippo Lauria
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: WOLips gives WO Template Problems (keypaths) even if not real problems!
      • From: Christoph Wick <email@hidden>
References: 
 >WOLips gives WO Template Problems (keypaths) even if not real problems! (From: Filippo Laurìa <email@hidden>)

  • Prev by Date: WOLips gives WO Template Problems (keypaths) even if not real problems!
  • Next by Date: Re: WOWODC'14 Calendar
  • Previous by thread: WOLips gives WO Template Problems (keypaths) even if not real problems!
  • Next by thread: Re: WOLips gives WO Template Problems (keypaths) even if not real problems!
  • Index(es):
    • Date
    • Thread