Java Code Examples for org.codehaus.groovy.runtime.DefaultGroovyMethods#getAt()

The following examples show how to use org.codehaus.groovy.runtime.DefaultGroovyMethods#getAt() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MetaClassImpl.java    From groovy with Apache License 2.0 4 votes vote down vote up
public Object getProperty(Object object) {
    return DefaultGroovyMethods.getAt((Collection) object, name);
}
 
Example 2
Source File: MetaClassImpl.java    From groovy with Apache License 2.0 4 votes vote down vote up
public Object getProperty(Object object) {
    return DefaultGroovyMethods.getAt(Arrays.asList((Object[]) object), name);
}
 
Example 3
Source File: GPathResult.java    From groovy with Apache License 2.0 2 votes vote down vote up
/**
 * Supports the range subscript operator for a GPathResult.
 * <pre class="groovyTestCase">
 * import groovy.xml.slurpersupport.*
 * import groovy.xml.XmlSlurper
 * def text = """
 * &lt;characterList&gt;
 *   &lt;character&gt;Wallace&lt;/character&gt;
 *   &lt;character&gt;Gromit&lt;/character&gt;
 *   &lt;character&gt;Shaun&lt;/character&gt;
 * &lt;/characterList&gt;"""
 *
 * GPathResult characterList = new XmlSlurper().parseText(text)
 *
 * assert characterList.character[1..2].join(',') == 'Gromit,Shaun'
 * </pre>
 * @param range a Range indicating the items to get
 * @return a new list based on range borders
 */
public Object getAt(final IntRange range) {
    return DefaultGroovyMethods.getAt(list(), range);
}