001 /**
002 * GRANITE DATA SERVICES
003 * Copyright (C) 2006-2013 GRANITE DATA SERVICES S.A.S.
004 *
005 * This file is part of the Granite Data Services Platform.
006 *
007 * Granite Data Services is free software; you can redistribute it and/or
008 * modify it under the terms of the GNU Lesser General Public
009 * License as published by the Free Software Foundation; either
010 * version 2.1 of the License, or (at your option) any later version.
011 *
012 * Granite Data Services is distributed in the hope that it will be useful,
013 * but WITHOUT ANY WARRANTY; without even the implied warranty of
014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
015 * General Public License for more details.
016 *
017 * You should have received a copy of the GNU Lesser General Public
018 * License along with this library; if not, write to the Free Software
019 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
020 * USA, or see <http://www.gnu.org/licenses/>.
021 */
022 package org.granite.messaging.reflect;
023
024 import java.lang.reflect.InvocationTargetException;
025
026 public class NoopWritableProperty extends NullProperty {
027
028 private final String name;
029 private final Class<?> type;
030
031 public NoopWritableProperty(String name, Class<?> type) {
032 if(name == null || type == null)
033 throw new NullPointerException("name and type cannot be null");
034
035 this.name = name;
036 this.type = type;
037 }
038
039 @Override
040 public String getName() {
041 return name;
042 }
043
044 @Override
045 public Class<?> getType() {
046 return type;
047 }
048
049 @Override
050 public boolean isWritable() {
051 return true;
052 }
053
054 @Override
055 public void setBoolean(Object holder, boolean value)
056 throws IllegalArgumentException, IllegalAccessException,
057 InvocationTargetException {
058 }
059
060 @Override
061 public void setChar(Object holder, char value)
062 throws IllegalArgumentException, IllegalAccessException,
063 InvocationTargetException {
064 }
065
066 @Override
067 public void setByte(Object holder, byte value)
068 throws IllegalArgumentException, IllegalAccessException,
069 InvocationTargetException {
070 }
071
072 @Override
073 public void setShort(Object holder, short value)
074 throws IllegalArgumentException, IllegalAccessException,
075 InvocationTargetException {
076 }
077
078 @Override
079 public void setInt(Object holder, int value)
080 throws IllegalArgumentException, IllegalAccessException,
081 InvocationTargetException {
082 }
083
084 @Override
085 public void setLong(Object holder, long value)
086 throws IllegalArgumentException, IllegalAccessException,
087 InvocationTargetException {
088 }
089
090 @Override
091 public void setFloat(Object holder, float value)
092 throws IllegalArgumentException, IllegalAccessException,
093 InvocationTargetException {
094 }
095
096 @Override
097 public void setDouble(Object holder, double value)
098 throws IllegalArgumentException, IllegalAccessException,
099 InvocationTargetException {
100 }
101
102 @Override
103 public void setObject(Object holder, Object value)
104 throws IllegalArgumentException, IllegalAccessException,
105 InvocationTargetException {
106 }
107
108 @Override
109 public int hashCode() {
110 return name.hashCode() + type.hashCode();
111 }
112
113 @Override
114 public boolean equals(Object obj) {
115 if (obj == this)
116 return true;
117 if (!(obj instanceof NoopWritableProperty))
118 return false;
119 return ((NoopWritableProperty)obj).name.equals(name) && ((NoopWritableProperty)obj).type.equals(type);
120 }
121
122 @Override
123 public String toString() {
124 return "NoopWritableProperty {name=" + name + ", type=" + type + "}";
125 }
126 }