org.ujorm.core
Class UjoPropertyListImpl

java.lang.Object
  extended by org.ujorm.core.UjoPropertyListImpl
All Implemented Interfaces:
java.lang.Iterable<UjoProperty>, UjoPropertyList

public final class UjoPropertyListImpl
extends java.lang.Object
implements UjoPropertyList

The immutable list of UjoProperties. The UjoPropertyList class is a subset of the methods from class List<UjoProperty>.

Author:
Pavel Ponec

Field Summary
static UjoProperty[] EMPTY
          An empty array of the UJO properties
 int length
          Contains the total count of its properties
 
Constructor Summary
UjoPropertyListImpl(java.lang.Class type)
          Create the empty list
UjoPropertyListImpl(java.lang.Class type, java.util.List<UjoProperty> props)
           
UjoPropertyListImpl(java.lang.Class type, UjoProperty[] props)
           
 
Method Summary
 boolean contains(UjoProperty o)
          Returns true if list contains property from the parameter.
 UjoProperty find(java.lang.String name, boolean throwException)
          Find a property by property name from parameter.
 UjoProperty find(Ujo ujo, java.lang.String name, boolean throwException)
          Find UjoProperty by name
 UjoProperty find(Ujo ujo, java.lang.String name, UjoAction action, boolean result, boolean throwException)
          Find a property by property name from parameter.
 UjoProperty findIndirect(java.lang.String name, boolean throwException)
          Find direct or indirect property by property name from parameter.
 UjoProperty get(int index)
          Get property on requered index
 java.lang.Class getType()
          Returns a class of the related UJO
 java.lang.String getTypeName()
          Returns a class name of the related UJO
 boolean isEmpty()
          Is the collection empty?
 java.util.Iterator<UjoProperty> iterator()
          Create an interator for all properties.
 UjoProperty last()
          Get last property
<UJO extends Ujo>
UJO
newInstance()
          Create new Instance
 int size()
          Returns a total count of its properties
 UjoProperty[] toArray()
          Returns a copy of internal array
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY

public static final UjoProperty[] EMPTY
An empty array of the UJO properties


length

public final int length
Contains the total count of its properties

Constructor Detail

UjoPropertyListImpl

public UjoPropertyListImpl(java.lang.Class type,
                           java.util.List<UjoProperty> props)

UjoPropertyListImpl

public UjoPropertyListImpl(java.lang.Class type,
                           UjoProperty[] props)

UjoPropertyListImpl

public UjoPropertyListImpl(java.lang.Class type)
Create the empty list

Method Detail

find

public UjoProperty find(java.lang.String name,
                        boolean throwException)
                 throws java.lang.IllegalArgumentException
Find a property by property name from parameter.

Specified by:
find in interface UjoPropertyList
Parameters:
name - A property name.
throwException - If result not found an Exception is throwed, or a null can be returned.
Returns:
.
Throws:
java.lang.IllegalArgumentException

find

public final UjoProperty find(Ujo ujo,
                              java.lang.String name,
                              boolean throwException)
                       throws java.lang.IllegalArgumentException
Description copied from interface: UjoPropertyList
Find UjoProperty by name

Specified by:
find in interface UjoPropertyList
Throws:
java.lang.IllegalArgumentException

find

public UjoProperty find(Ujo ujo,
                        java.lang.String name,
                        UjoAction action,
                        boolean result,
                        boolean throwException)
                 throws java.lang.IllegalArgumentException
Find a property by property name from parameter.

Specified by:
find in interface UjoPropertyList
Parameters:
ujo - An Ujo object
name - A property name.
action - Action type UjoAction.ACTION_* .
result - Required result of action.
throwException - If result not found an Exception is throwed, or a null can be returned.
Throws:
java.lang.IllegalArgumentException

findIndirect

public UjoProperty findIndirect(java.lang.String name,
                                boolean throwException)
                         throws java.lang.IllegalArgumentException
Find direct or indirect property by property name from parameter.

Specified by:
findIndirect in interface UjoPropertyList
Parameters:
name - A property name by sample "user.address.street".
throwException - If result not found an Exception is throwed, or a null can be returned.
Returns:
.
Throws:
java.lang.IllegalArgumentException

toArray

public UjoProperty[] toArray()
Returns a copy of internal array

Specified by:
toArray in interface UjoPropertyList

last

public UjoProperty last()
Get last property

Specified by:
last in interface UjoPropertyList

getType

public java.lang.Class getType()
Returns a class of the related UJO

Specified by:
getType in interface UjoPropertyList

newInstance

public <UJO extends Ujo> UJO newInstance()
                            throws java.lang.IllegalStateException
Create new Instance

Specified by:
newInstance in interface UjoPropertyList
Throws:
java.lang.IllegalStateException

getTypeName

public java.lang.String getTypeName()
Returns a class name of the related UJO

Specified by:
getTypeName in interface UjoPropertyList

get

public UjoProperty get(int index)
Get property on requered index

Specified by:
get in interface UjoPropertyList

size

public int size()
Returns a total count of its properties

Specified by:
size in interface UjoPropertyList

isEmpty

public boolean isEmpty()
Is the collection empty?

Specified by:
isEmpty in interface UjoPropertyList

contains

public boolean contains(UjoProperty o)
Returns true if list contains property from the parameter.

Specified by:
contains in interface UjoPropertyList

iterator

public java.util.Iterator<UjoProperty> iterator()
Create an interator for all properties.

Specified by:
iterator in interface java.lang.Iterable<UjoProperty>
Specified by:
iterator in interface UjoPropertyList


Copyright © 2007-2012 PPonec