1 19 20 package org.netbeans.lib.lexer.token; 21 22 import org.netbeans.api.lexer.PartType; 23 import org.netbeans.api.lexer.Token; 24 import org.netbeans.api.lexer.TokenId; 25 import org.netbeans.lib.lexer.LexerUtilsConstants; 26 import org.netbeans.spi.lexer.TokenPropertyProvider; 27 28 39 40 public final class PropertyToken<T extends TokenId> extends DefaultToken<T> { 41 42 private final TokenPropertyProvider propertyProvider; 44 private final PartType partType; 46 public PropertyToken(T id, int length, 47 TokenPropertyProvider propertyProvider, PartType partType) { 48 super(id, length); 49 this.propertyProvider = propertyProvider; 50 this.partType = partType; 51 } 52 53 @Override 54 public boolean hasProperties() { 55 return (propertyProvider != null); 56 } 57 58 @Override 59 public Object getProperty(Object key) { 60 return (propertyProvider != null) ? propertyProvider.getValue(this, key) : null; 61 } 62 63 @Override 64 public PartType partType() { 65 return partType; 66 } 67 68 @Override 69 protected String dumpInfoTokenType() { 70 return "ProT"; } 72 73 } 74 | Popular Tags |