Revision 1860 org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/impl/DefaultDynField.java

View differences:

DefaultDynField.java
812 812

  
813 813
    @Override
814 814
    public DynField setClassOfItems(DynStruct dynStrct) {
815
        if (!this.isContainer()) {
815
        if (dynStrct!=null && !this.isContainer()) {
816 816
            throw new IllegalStateException("Can't assign classOfItems in non container.");
817 817
        }
818 818
        this.itemsType.setClassOfValue(dynStrct);
......
821 821

  
822 822
    @Override
823 823
    public DynField setClassOfItems(String theClassNameOfValue) {
824
        if (!this.isContainer()) {
824
        if (theClassNameOfValue!=null && !this.isContainer()) {
825 825
            throw new IllegalStateException("Can't assign classOfItems in non container.");
826 826
        }
827 827
        this.itemsType.setClassOfValue(theClassNameOfValue);
......
830 830

  
831 831
    @Override
832 832
    public String getClassNameOfItems() {
833
        if( this.itemsType==null || 
834
                this.itemsType.getClassNameOfValue()==null ) {
835
            return null;
836
        }
833 837
        if (!this.isContainer()) {
834 838
            throw new IllegalStateException("Can't get classNameOfItems in non container.");
835 839
        }
......
838 842

  
839 843
    @Override
840 844
    public DynStruct getDynClassOfItems() {
845
        if( this.itemsType==null || 
846
                this.itemsType.getDynClassOfValue()==null ) {
847
            return null;
848
        }
841 849
        if (!this.isContainer()) {
842 850
            throw new IllegalStateException("Can't get dynClassOfItems in non container.");
843 851
        }
......
847 855
    @Override
848 856
    public DynField setClassOfItems(Class theClass)
849 857
            throws DynFieldIsNotAContainerException {
850
        if (!this.isContainer()) {
858
        if (theClass!=null && !this.isContainer()) {
851 859
            throw new IllegalStateException("Can't assign classNameOfItems in non container.");
852 860
        }
853 861
        this.itemsType.setClassOfValue(theClass);
......
856 864

  
857 865
    @Override
858 866
    public Class getClassOfItems() {
867
        if( this.itemsType==null || 
868
                this.itemsType.getClassOfValue()==null ) {
869
            return null;
870
        }
859 871
        if (!this.isContainer()) {
860 872
            throw new IllegalStateException("Can't get classOfItems in non container.");
861 873
        }

Also available in: Unified diff