001/** 002 * 003 * Copyright (c) 2014, the Railo Company Ltd. All rights reserved. 004 * 005 * This library is free software; you can redistribute it and/or 006 * modify it under the terms of the GNU Lesser General Public 007 * License as published by the Free Software Foundation; either 008 * version 2.1 of the License, or (at your option) any later version. 009 * 010 * This library is distributed in the hope that it will be useful, 011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 013 * Lesser General Public License for more details. 014 * 015 * You should have received a copy of the GNU Lesser General Public 016 * License along with this library. If not, see <http://www.gnu.org/licenses/>. 017 * 018 **/ 019package lucee.transformer.bytecode.util; 020 021import lucee.runtime.exp.PageException; 022 023import org.objectweb.asm.Type; 024 025public final class ASMPropertyImpl implements ASMProperty { 026 027 028 private Type type; 029 private String name; 030 private Class clazz; 031 032 public ASMPropertyImpl(Class type,String name){ 033 this.type=ASMUtil.toType(type, true); 034 this.name=name; 035 this.clazz=type; 036 } 037 public ASMPropertyImpl(String type,String name) throws PageException{ 038 this.type=ASMUtil.toType(type, true); 039 this.name=name; 040 } 041 public ASMPropertyImpl(Type type,String name){ 042 this.type=type; 043 this.name=name; 044 } 045 046 /** 047 * @return the name 048 */ 049 public String getName() { 050 return name; 051 } 052 053 /** 054 * @return the type 055 */ 056 public Type getASMType() { 057 return type; 058 } 059 060 /** 061 * 062 * @see java.lang.Object#toString() 063 */ 064 public String toString() { 065 return "class:"+(clazz==null?null:clazz.getName())+"name:"+name+";type:"+type.getClassName(); 066 } 067 068 069 070 /** 071 * @return the clazz 072 */ 073 public Class getClazz() { 074 return clazz; 075 } 076}