Class: AEMReference::PositionSpecifier

Inherits:
Specifier show all
Defined in:
lib/_aem/aemreference.rb

Overview

BASE CLASS FOR ALL OBJECT REFERENCE FORMS

Constant Summary collapse

Beginning =

Note that comparison and logic ‘operator’ methods are implemented on this class

  • these are only for use in constructing its-based references and shouldn’t be used

on app- and con-based references. Aem doesn’t enforce this rule itself so as to minimise runtime overhead (the target application will raise an error if the user does something foolish).

AEMReference.pack_enum(KAE::KAEBeginning)
End =
AEMReference.pack_enum(KAE::KAEEnd)
Before =
AEMReference.pack_enum(KAE::KAEBefore)
After =
AEMReference.pack_enum(KAE::KAEAfter)
Previous =
AEMReference.pack_enum(KAE::KAEPrevious)
Next =
AEMReference.pack_enum(KAE::KAENext)

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Specifier

#AEM_pack_self, #AEM_root, #AEM_set_desc, #AEM_true_self

Methods inherited from Query

#==, #AEM_comparable, #hash, #inspect

Constructor Details

#initialize(wantcode, container, key) ⇒ PositionSpecifier

Returns a new instance of PositionSpecifier.



222
223
224
225
# File 'lib/_aem/aemreference.rb', line 222

def initialize(wantcode, container, key)
  @AEM_want = wantcode
  super(container, key)
end

Instance Attribute Details

#AEM_wantObject (readonly)

Returns the value of attribute AEM_want.



220
221
222
# File 'lib/_aem/aemreference.rb', line 220

def AEM_want
  @AEM_want
end

Instance Method Details

#_pack_self(codecs) ⇒ Object



231
232
233
234
235
236
237
238
# File 'lib/_aem/aemreference.rb', line 231

def _pack_self(codecs)
  return AEMReference.pack_list_as(KAE::TypeObjectSpecifier, [
                                     [KAE::KeyAEDesiredClass, AEMReference.pack_type(@AEM_want)],
                                     [KAE::KeyAEKeyForm, self.class::KeyForm],
                                     [KAE::KeyAEKeyData, _pack_key(codecs)],
                                     [KAE::KeyAEContainer, @_container.AEM_pack_self(codecs)],
                                   ])
end

#afterObject



301
302
303
# File 'lib/_aem/aemreference.rb', line 301

def after
  return InsertionSpecifier.new(self, After, :after)
end

#beforeObject



297
298
299
# File 'lib/_aem/aemreference.rb', line 297

def before
  return InsertionSpecifier.new(self, Before, :before)
end

#beginningObject

Thes can be called on any kind of element reference, and also on property references where the property represents a one-to-one relationship, e.g. textedit.documents.text.end is valid



289
290
291
# File 'lib/_aem/aemreference.rb', line 289

def beginning
  return InsertionSpecifier.new(self, Beginning, :beginning)
end

#begins_with(val) ⇒ Object



268
269
270
# File 'lib/_aem/aemreference.rb', line 268

def begins_with(val)
  return BeginsWith.new(self, val)
end

#contains(val) ⇒ Object



276
277
278
# File 'lib/_aem/aemreference.rb', line 276

def contains(val)
  return Contains.new(self, val)
end

#elements(code) ⇒ Object



315
316
317
# File 'lib/_aem/aemreference.rb', line 315

def elements(code)
  return AllElements.new(code, self)
end

#endObject



293
294
295
# File 'lib/_aem/aemreference.rb', line 293

def end
  return InsertionSpecifier.new(self, End, :end)
end

#ends_with(val) ⇒ Object



272
273
274
# File 'lib/_aem/aemreference.rb', line 272

def ends_with(val)
  return EndsWith.new(self, val)
end

#eq(val) ⇒ Object



252
253
254
# File 'lib/_aem/aemreference.rb', line 252

def eq(val)
  return Equals.new(self, val)
end

#ge(val) ⇒ Object



248
249
250
# File 'lib/_aem/aemreference.rb', line 248

def ge(val)
  return GreaterOrEquals.new(self, val)
end

#gt(val) ⇒ Object

Each of these methods returns a ComparisonTest subclass



244
245
246
# File 'lib/_aem/aemreference.rb', line 244

def gt(val)
  return GreaterThan.new(self, val)
end

#is_in(val) ⇒ Object



280
281
282
# File 'lib/_aem/aemreference.rb', line 280

def is_in(val)
  return IsIn.new(self, val)
end

#le(val) ⇒ Object



264
265
266
# File 'lib/_aem/aemreference.rb', line 264

def le(val)
  return LessOrEquals.new(self, val)
end

#lt(val) ⇒ Object



260
261
262
# File 'lib/_aem/aemreference.rb', line 260

def lt(val)
  return LessThan.new(self, val)
end

#ne(val) ⇒ Object



256
257
258
# File 'lib/_aem/aemreference.rb', line 256

def ne(val)
  return NotEquals.new(self, val)
end

#next(code) ⇒ Object



329
330
331
# File 'lib/_aem/aemreference.rb', line 329

def next(code)
  return ElementByRelativePosition.new(code, self, Next, :next)
end

#previous(code) ⇒ Object

these are unlikely to work on one-to-one relationships - but what the hey, putting them here simplifies the class structure a bit. As with all reference forms, it’s mostly left to the client to ensure the references they construct can be understood by the target application.



325
326
327
# File 'lib/_aem/aemreference.rb', line 325

def previous(code)
  return ElementByRelativePosition.new(code, self, Previous, :previous)
end

#property(code) ⇒ Object

Property and element references can be used on any type of object reference:



307
308
309
# File 'lib/_aem/aemreference.rb', line 307

def property(code)
  return Property.new(KAE::CProperty, self, code)
end

#to_sObject



227
228
229
# File 'lib/_aem/aemreference.rb', line 227

def to_s
  return "#{@_container}.#{self.class::By}(#{@_key.inspect})"
end

#user_property(name) ⇒ Object



311
312
313
# File 'lib/_aem/aemreference.rb', line 311

def user_property(name)
  return UserProperty.new(KAE::CProperty, self, name)
end