001 /*
002 * Copyright 2004 Chris Nelson
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
007 * Unless required by applicable law or agreed to in writing,
008 * software distributed under the License is distributed on an "AS IS" BASIS,
009 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
010 * See the License for the specific language governing permissions and limitations under the License.
011 */
012 package org.trails.descriptor;
013
014
015 /**
016 * @author fus8882
017 * <p/>
018 * TODO To change the template for this generated type comment go to
019 * Window - Preferences - Java - Code Style - Code Templates
020 */
021 public class IdentifierDescriptor extends TrailsPropertyDescriptor implements IIdentifierDescriptor
022 {
023 private boolean generated = true;
024
025 public IdentifierDescriptor(Class beanType, IPropertyDescriptor descriptor)
026 {
027 super(beanType, descriptor.getPropertyType());
028 copyFrom(descriptor);
029 setSearchable(false);
030 }
031
032 /**
033 * @param realDescriptor
034 */
035 public IdentifierDescriptor(Class beanType, Class type)
036 {
037 super(beanType, type);
038 setSearchable(false);
039 }
040
041 public IdentifierDescriptor(Class beanType, String name, Class type)
042 {
043 super(beanType, name, type);
044 setSearchable(false);
045 }
046
047 /* (non-Javadoc)
048 * @see org.trails.descriptor.PropertyDescriptor#isIdentifier()
049 */
050 public boolean isIdentifier()
051 {
052 return true;
053 }
054
055 /**
056 * @return Returns the generated.
057 */
058 public boolean isGenerated()
059 {
060 return generated;
061 }
062
063 /**
064 * @param generated The generated to set.
065 */
066 public void setGenerated(boolean generated)
067 {
068 this.generated = generated;
069 }
070
071 public Object clone()
072 {
073 return new IdentifierDescriptor(getBeanType(), this);
074 }
075
076
077 }