code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
public static Type newInstance(int sqlType) {
switch (sqlType) {
case (java.sql.Types.INTEGER):
return INTEGER;
case (java.sql.Types.BIGINT):
return BIGINT;
case (java.sql.Types.DOUBLE):
return DOUBLE;
case (java.sql.Types.VARCHAR):
return VARCHAR;
}
throw new UnsupportedOperationEx... | java |
public Buffer pin(BlockId blk) {
// Try to find out if this block has been pinned by this transaction
PinnedBuffer pinnedBuff = pinnedBuffers.get(blk);
if (pinnedBuff != null) {
pinnedBuff.pinnedCount++;
return pinnedBuff.buffer;
}
// This transaction has pinned too many buffers
if (pinned... | java |
public Buffer pinNew(String fileName, PageFormatter fmtr) {
if (pinnedBuffers.size() == BUFFER_POOL_SIZE)
throw new BufferAbortException();
try {
Buffer buff;
long timestamp = System.currentTimeMillis();
boolean waitedBeforeGotBuffer = false;
// Try to pin a buffer or the pinned buffer for t... | java |
public void unpin(Buffer buff) {
BlockId blk = buff.block();
PinnedBuffer pinnedBuff = pinnedBuffers.get(blk);
if (pinnedBuff != null) {
pinnedBuff.pinnedCount--;
if (pinnedBuff.pinnedCount == 0) {
bufferPool.unpin(buff);
pinnedBuffers.remove(blk);
synchronized (bufferPool... | java |
private void repin() {
if (logger.isLoggable(Level.WARNING))
logger.warning("Tx." + txNum + " is re-pinning all buffers");
try {
// Copy the set of pinned buffers to avoid ConcurrentModificationException
List<BlockId> blksToBeRepinned = new LinkedList<BlockId>();
Map<BlockId, Integer> pinCount... | java |
public static Map<String, Integer> offsetMap(Schema sch) {
int pos = 0;
Map<String, Integer> offsetMap = new HashMap<String, Integer>();
for (String fldname : sch.fields()) {
offsetMap.put(fldname, pos);
pos += Page.maxSize(sch.type(fldname));
}
return offsetMap;
} | java |
public static int recordSize(Schema sch) {
int pos = 0;
for (String fldname : sch.fields())
pos += Page.maxSize(sch.type(fldname));
return pos < MIN_REC_SIZE ? MIN_REC_SIZE : pos;
} | java |
public Constant getVal(String fldName) {
int position = fieldPos(fldName);
return getVal(position, ti.schema().type(fldName));
} | java |
public void setVal(String fldName, Constant val) {
int position = fieldPos(fldName);
setVal(position, val);
} | java |
public void delete(RecordId nextDeletedSlot) {
Constant flag = EMPTY_CONST;
setVal(currentPos(), flag);
setNextDeletedSlotId(nextDeletedSlot);
} | java |
public boolean insertIntoTheCurrentSlot() {
if (!getVal(currentPos(), INTEGER).equals(EMPTY_CONST))
return false;
setVal(currentPos(), INUSE_CONST);
return true;
} | java |
public boolean insertIntoNextEmptySlot() {
boolean found = searchFor(EMPTY);
if (found) {
Constant flag = INUSE_CONST;
setVal(currentPos(), flag);
}
return found;
} | java |
public RecordId insertIntoDeletedSlot() {
RecordId nds = getNextDeletedSlotId();
// Important: Erase the free chain information.
// If we didn't do this, it would crash when
// a tx try to set a VARCHAR at this position
// since the getVal would get negative size.
setNextDeletedSlotId(new RecordId(new... | java |
public void runAllSlot() {
moveToId(0);
System.out.println("== runAllSlot start at " + currentSlot + " ==");
while (isValidSlot()) {
if (currentSlot % 10 == 0)
System.out.print(currentSlot + ": ");
int flag = (Integer) getVal(currentPos(), INTEGER).asJavaVal();
System.out.print(flag + " ");
... | java |
public synchronized void startCollecting() {
paused = false;
if (thread != null)
return;
packages = new CountMap<String>(MAX_PACKAGES);
selfMethods = new CountMap<String>(MAX_METHODS);
stackMethods = new CountMap<String>(MAX_METHODS);
lines = new CountMap<String>(MAX_LINES);
total = 0;
s... | java |
public synchronized void stopCollecting() {
started = false;
if (thread != null) {
try {
thread.join();
} catch (InterruptedException e) {
// ignore
}
thread = null;
}
} | java |
public String getPackageCsv() {
stopCollecting();
StringBuilder buff = new StringBuilder();
buff.append("Package,Self").append(LINE_SEPARATOR);
for (String k : new TreeSet<String>(packages.keySet())) {
int percent = 100 * packages.get(k) / Math.max(total, 1);
buff.append(k).append(",").append(percen... | java |
public String getTopMethods(int num) {
stopCollecting();
CountMap<String> selfms = new CountMap<String>(selfMethods);
CountMap<String> stackms = new CountMap<String>(stackMethods);
StringBuilder buff = new StringBuilder();
buff.append("Top methods over ").append(time).append(" ms (").append(pauseTime).ap... | java |
public String getMethodCsv() {
stopCollecting();
StringBuilder buff = new StringBuilder();
buff.append("Method,Self").append(LINE_SEPARATOR);
for (String k : new TreeSet<String>(selfMethods.keySet())) {
int percent = 100 * selfMethods.get(k) / Math.max(total, 1);
buff.append(k).append(",").append(pe... | java |
public String getTopLines(int num) {
stopCollecting();
CountMap<String> ls = new CountMap<String>(lines);
StringBuilder buff = new StringBuilder();
buff.append("Top lines over ").append(time).append(" ms (").append(pauseTime).append(" ms paused), with ")
.append(total).append(" counts:").append(LINE_SE... | java |
public void createIndex(String idxName, String tblName, List<String> fldNames,
IndexType idxType, Transaction tx) {
// Add the index infos to the index catalog
RecordFile rf = idxTi.open(tx, true);
rf.insert();
rf.setVal(ICAT_IDXNAME, new VarcharConstant(idxName));
rf.setVal(ICAT_TBLNAME, new Var... | java |
public List<IndexInfo> getIndexInfo(String tblName, String fldName, Transaction tx) {
// Check the cache
if (!loadedTables.contains(tblName)) {
readFromFile(tblName, tx);
}
// Fetch from the cache
Map<String, List<IndexInfo>> iiMap = iiMapByTblAndFlds.get(tblName);
if (iiMap == null)
retur... | java |
public IndexInfo getIndexInfoByName(String idxName, Transaction tx) {
// Fetch from the cache
IndexInfo ii = iiMapByIdxNames.get(idxName);
if (ii != null)
return ii;
// Read from the catalog files
String tblName = null;
List<String> fldNames = new LinkedList<String>();
IndexType idxType = n... | java |
public Index open(Transaction tx) {
TableInfo ti = VanillaDb.catalogMgr().getTableInfo(tblName, tx);
if (ti == null)
throw new TableNotFoundException("table '" + tblName
+ "' is not defined in catalog.");
return Index.newInstance(this, new SearchKeyType(ti.schema(), fldNames), tx);
} | java |
public Constant nextVal(Type type) {
Constant val = pg.getVal(currentPos, type);
currentPos += Page.size(val);
return val;
} | java |
@Override
public int getColumnType(int column) throws RemoteException {
String fldname = getColumnName(column);
return schema.type(fldname).getSqlType();
} | java |
@Override
public int getColumnDisplaySize(int column) throws RemoteException {
String fldname = getColumnName(column);
Type fldtype = schema.type(fldname);
if (fldtype.isFixedSize())
// 6 and 12 digits for int and double respectively
return fldtype.maxSize() * 8 / 5;
return schema.type(fldname).ge... | java |
@Override
public boolean next() {
if (isLhsEmpty)
return false;
if (idx.next()) {
ts.moveToRecordId(idx.getDataRecordId());
return true;
} else if (!(isLhsEmpty = !s.next())) {
resetIndex();
return next();
} else
return false;
} | java |
@Override
public Constant getVal(String fldName) {
if (ts.hasField(fldName))
return ts.getVal(fldName);
else
return s.getVal(fldName);
} | java |
@Override
public boolean hasField(String fldName) {
return ts.hasField(fldName) || s.hasField(fldName);
} | java |
@Override
public void undo(Transaction tx) {
LogSeqNum lsn = tx.recoveryMgr().logLogicalAbort(this.txNum,this.lsn);
VanillaDb.logMgr().flush(lsn);
} | java |
public Collection<String> getViewNamesByTable(String tblName, Transaction tx) {
Collection<String> result = new LinkedList<String>();
TableInfo ti = tblMgr.getTableInfo(VCAT, tx);
RecordFile rf = ti.open(tx, true);
rf.beforeFirst();
while (rf.next()) {
Parser parser = new Parser((String) rf.getVal(... | java |
@Override
public boolean next() {
if (!moreGroups)
return false;
if (aggFns != null)
for (AggregationFn fn : aggFns)
fn.processFirst(ss);
groupVal = new GroupValue(ss, groupFlds);
while (moreGroups = ss.next()) {
GroupValue gv = new GroupValue(ss, groupFlds);
if (!groupVal.equals(gv))... | java |
@Override
public Constant getVal(String fldname) {
if (groupFlds.contains(fldname))
return groupVal.getVal(fldname);
if (aggFns != null)
for (AggregationFn fn : aggFns)
if (fn.fieldName().equals(fldname))
return fn.value();
throw new RuntimeException("field " + fldname + " not found.");
... | java |
@Override
public boolean hasField(String fldname) {
if (groupFlds.contains(fldname))
return true;
if (aggFns != null)
for (AggregationFn fn : aggFns)
if (fn.fieldName().equals(fldname))
return true;
return false;
} | java |
void flushAll() {
for (Buffer buff : bufferPool) {
try {
buff.getExternalLock().lock();
buff.flush();
} finally {
buff.getExternalLock().unlock();
}
}
} | java |
Buffer pin(BlockId blk) {
// Only the txs acquiring the same block will be blocked
synchronized (prepareAnchor(blk)) {
// Find existing buffer
Buffer buff = findExistingBuffer(blk);
// If there is no such buffer
if (buff == null) {
// Choose Unpinned Buffer
int lastReplacedBuff = thi... | java |
void unpin(Buffer... buffs) {
for (Buffer buff : buffs) {
try {
// Get the lock of buffer
buff.getExternalLock().lock();
buff.unpin();
if (!buff.isPinned())
numAvailable.incrementAndGet();
} finally {
// Release the lock of buffer
buff.getExternalLock().unlock();
}
... | java |
public static void initializeSystem(Transaction tx) {
tx.recoveryMgr().recoverSystem(tx);
tx.bufferMgr().flushAll();
VanillaDb.logMgr().removeAndCreateNewLog();
// Add a start record for this transaction
new StartRecord(tx.getTransactionNumber()).writeToLog();
} | java |
@Override
public void onTxCommit(Transaction tx) {
if (!tx.isReadOnly() && enableLogging) {
LogSeqNum lsn = new CommitRecord(txNum).writeToLog();
VanillaDb.logMgr().flush(lsn);
}
} | java |
@Override
public void onTxRollback(Transaction tx) {
if (!tx.isReadOnly() && enableLogging) {
rollback(tx);
LogSeqNum lsn = new RollbackRecord(txNum).writeToLog();
VanillaDb.logMgr().flush(lsn);
}
} | java |
public LogSeqNum logSetVal(Buffer buff, int offset, Constant newVal) {
if (enableLogging) {
BlockId blk = buff.block();
if (isTempBlock(blk))
return null;
return new SetValueRecord(txNum, blk, offset, buff.getVal(offset, newVal.getType()), newVal).writeToLog();
} else
return null;
} | java |
public LogSeqNum logLogicalAbort(long txNum, LogSeqNum undoNextLSN) {
if (enableLogging) {
return new LogicalAbortRecord(txNum, undoNextLSN).writeToLog();
} else
return null;
} | java |
@Override
public void delete(SearchKey key, RecordId dataRecordId, boolean doLogicalLogging) {
if (tx.isReadOnly())
throw new UnsupportedOperationException();
search(new SearchRange(key), SearchPurpose.DELETE);
// log the logical operation starts
if (doLogicalLogging)
tx.recoveryMgr().logLog... | java |
@Override
public void close() {
if (leaf != null) {
leaf.close();
leaf = null;
}
dirsMayBeUpdated = null;
} | java |
public synchronized TableStatInfo getTableStatInfo(TableInfo ti,
Transaction tx) {
if (isRefreshStatOn) {
Integer c = updateCounts.get(ti.tableName());
if (c != null && c > REFRESH_THRESHOLD)
VanillaDb.taskMgr().runTask(
new StatisticsRefreshTask(tx, ti.tableName()));
}
TableStatInfo ... | java |
@Override
public boolean hasNext() {
if (!isForward) {
currentRec = currentRec - pointerSize;
isForward = true;
}
return currentRec > 0 || blk.number() > 0;
} | java |
@Override
public BasicLogRecord next() {
if (!isForward) {
currentRec = currentRec - pointerSize;
isForward = true;
}
if (currentRec == 0)
moveToNextBlock();
currentRec = (Integer) pg.getVal(currentRec, INTEGER).asJavaVal();
return new BasicLogRecord(pg, new LogSeqNum(blk.number(), currentR... | java |
private void moveToNextBlock() {
blk = new BlockId(blk.fileName(), blk.number() - 1);
pg.read(blk);
currentRec = (Integer) pg.getVal(LogMgr.LAST_POS, INTEGER).asJavaVal();
} | java |
private void moveToPrevBlock() {
blk = new BlockId(blk.fileName(), blk.number() + 1);
pg.read(blk);
currentRec = 0 + pointerSize;
} | java |
@Override
public Constant evaluate(Record rec) {
return op.evaluate(lhs, rhs, rec);
} | java |
@Override
public boolean isApplicableTo(Schema sch) {
return lhs.isApplicableTo(sch) && rhs.isApplicableTo(sch);
} | java |
public static void formatFileHeader(String fileName, Transaction tx) {
tx.concurrencyMgr().modifyFile(fileName);
// header should be the first block of the given file
if (VanillaDb.fileMgr().size(fileName) == 0) {
FileHeaderFormatter fhf = new FileHeaderFormatter();
Buffer buff = tx.bufferMgr().pinNew(... | java |
public boolean next() {
if (currentBlkNum == 0 && !moveTo(1))
return false;
while (true) {
if (rp.next())
return true;
if (!moveTo(currentBlkNum + 1))
return false;
}
} | java |
public void setVal(String fldName, Constant val) {
if (tx.isReadOnly() && !isTempTable())
throw new UnsupportedOperationException();
Type fldType = ti.schema().type(fldName);
Constant v = val.castTo(fldType);
if (Page.size(v) > Page.maxSize(fldType))
throw new SchemaIncompatibleException();
rp.... | java |
public void insert() {
// Block read-only transaction
if (tx.isReadOnly() && !isTempTable())
throw new UnsupportedOperationException();
// Insertion may change the properties of this file,
// so that we need to lock the file.
if (!isTempTable())
tx.concurrencyMgr().modifyFile(fileName);
//... | java |
public void insert(RecordId rid) {
// Block read-only transaction
if (tx.isReadOnly() && !isTempTable())
throw new UnsupportedOperationException();
// Insertion may change the properties of this file,
// so that we need to lock the file.
if (!isTempTable())
tx.concurrencyMgr().modifyFile(fileNa... | java |
public void moveToRecordId(RecordId rid) {
moveTo(rid.block().number());
rp.moveToId(rid.id());
} | java |
public RecordId currentRecordId() {
int id = rp.currentId();
return new RecordId(new BlockId(fileName, currentBlkNum), id);
} | java |
public Operator operator(String fldName) {
if (lhs.isFieldName() && lhs.asFieldName().equals(fldName))
return op;
if (rhs.isFieldName() && rhs.asFieldName().equals(fldName))
return op.complement();
return null;
} | java |
public Constant oppositeConstant(String fldName) {
if (lhs.isFieldName() && lhs.asFieldName().equals(fldName)
&& rhs.isConstant())
return rhs.asConstant();
if (rhs.isFieldName() && rhs.asFieldName().equals(fldName)
&& lhs.isConstant())
return lhs.asConstant();
return null;
} | java |
public String oppositeField(String fldName) {
if (lhs.isFieldName() && lhs.asFieldName().equals(fldName)
&& rhs.isFieldName())
return rhs.asFieldName();
if (rhs.isFieldName() && rhs.asFieldName().equals(fldName)
&& lhs.isFieldName())
return lhs.asFieldName();
return null;
} | java |
public synchronized Hosts putAllInRandomOrder(String domain, String[] ips) {
Random random = new Random();
int index = (int) (random.nextLong() % ips.length);
if (index < 0) {
index += ips.length;
}
LinkedList<String> ipList = new LinkedList<String>();
for (in... | java |
public static String[] getByInternalAPI() {
try {
Class<?> resolverConfiguration =
Class.forName("sun.net.dns.ResolverConfiguration");
Method open = resolverConfiguration.getMethod("open");
Method getNameservers = resolverConfiguration.getMethod("nameserve... | java |
public static IResolver defaultResolver() {
return new IResolver() {
@Override
public Record[] resolve(Domain domain) throws IOException {
String[] addresses = defaultServer();
if (addresses == null) {
throw new IOException("no dns serv... | java |
void writeAssocBean() throws IOException {
writingAssocBean = true;
origDestPackage = destPackage;
destPackage = destPackage + ".assoc";
origShortName = shortName;
shortName = "Assoc" + shortName;
prepareAssocBeanImports();
writer = new Append(createFileWriter());
writePackage();
... | java |
private void prepareAssocBeanImports() {
importTypes.remove(DB);
importTypes.remove(TQROOTBEAN);
importTypes.remove(DATABASE);
importTypes.add(TQASSOCBEAN);
if (isEntity()) {
importTypes.add(TQPROPERTY);
importTypes.add(origDestPackage + ".Q" + origShortName);
}
// remove impor... | java |
private void writeRootBeanConstructor() throws IOException {
writer.eol();
writer.append(" /**").eol();
writer.append(" * Construct with a given Database.").eol();
writer.append(" */").eol();
writer.append(" public Q%s(Database server) {", shortName).eol();
writer.append(" super(%s.cla... | java |
private void writeAssocBeanConstructor() {
writer.append(" public Q%s(String name, R root) {", shortName).eol();
writer.append(" super(name, root);").eol();
writer.append(" }").eol();
} | java |
private void writeFields() throws IOException {
for (PropertyMeta property : properties) {
property.writeFieldDefn(writer, shortName, writingAssocBean);
writer.eol();
}
writer.eol();
} | java |
private void writeClass() {
if (writingAssocBean) {
writer.append("/**").eol();
writer.append(" * Association query bean for %s.", shortName).eol();
writer.append(" * ").eol();
writer.append(" * THIS IS A GENERATED OBJECT, DO NOT MODIFY THIS CLASS.").eol();
writer.append(" */").eol();... | java |
private void writeImports() {
for (String importType : importTypes) {
writer.append("import %s;", importType).eol();
}
writer.eol();
} | java |
static String[] split(String className) {
String[] result = new String[2];
int startPos = className.lastIndexOf('.');
if (startPos == -1) {
result[1] = className;
return result;
}
result[0] = className.substring(0, startPos);
result[1] = className.substring(startPos + 1);
return ... | java |
static String shortName(String className) {
int startPos = className.lastIndexOf('.');
if (startPos == -1) {
return className;
}
return className.substring(startPos + 1);
} | java |
Append append(String format, Object... args) {
return append(String.format(format, args));
} | java |
<A extends Annotation> A findAnnotation(TypeElement element, Class<A> anno) {
final A annotation = element.getAnnotation(anno);
if (annotation != null) {
return annotation;
}
final TypeMirror typeMirror = element.getSuperclass();
if (typeMirror.getKind() == TypeKind.NONE) {
return null;... | java |
private static boolean dbJsonField(Element field) {
return (field.getAnnotation(DbJson.class) != null
|| field.getAnnotation(DbJsonB.class) != null);
} | java |
private PropertyType createPropertyTypeAssoc(String fullName) {
String[] split = Split.split(fullName);
String propertyName = "QAssoc" + split[1];
String packageName = packageAppend(split[0], "query.assoc");
return new PropertyTypeAssoc(propertyName, packageName);
} | java |
private String packageAppend(String origPackage, String suffix) {
if (origPackage == null) {
return suffix;
} else {
return origPackage + "." + suffix;
}
} | java |
JavaFileObject createWriter(String factoryClassName, Element originatingElement) throws IOException {
return filer.createSourceFile(factoryClassName, originatingElement);
} | java |
public static String printNode(Node node, boolean prettyprint)
{
StringWriter strw = new StringWriter();
new DOMWriter(strw).setPrettyprint(prettyprint).print(node);
return strw.toString();
} | java |
public static String resolve(String normalized)
{
StringBuilder builder = new StringBuilder();
int end = normalized.length();
int pos = normalized.indexOf('&');
int last = 0;
// No references
if (pos == -1)
return normalized;
while (pos != -1)
{
Str... | java |
private static void invokeMethod(final Object instance, final Method method, final Object[] args)
{
final boolean accessability = method.isAccessible();
try
{
method.setAccessible(true);
method.invoke(instance, args);
}
catch (Exception e)
{
InjectionEx... | java |
private static void setField(final Object instance, final Field field, final Object value)
{
final boolean accessability = field.isAccessible();
try
{
field.setAccessible(true);
field.set(instance, value);
}
catch (Exception e)
{
InjectionException.reth... | java |
@Override
public void onEndpointInstantiated(final Endpoint endpoint, final Invocation invocation)
{
final Object _targetBean = this.getTargetBean(invocation);
// TODO: refactor injection to AS IL
final Reference reference = endpoint.getInstanceProvider().getInstance(_targetBean.getClass().getNa... | java |
private Object getTargetBean(final Invocation invocation)
{
final InvocationContext invocationContext = invocation.getInvocationContext();
return invocationContext.getTargetBean();
} | java |
public static <A> A getRequiredAttachment( final Deployment dep, final Class< A > key )
{
final A value = dep.getAttachment( key );
if ( value == null )
{
throw Messages.MESSAGES.cannotFindAttachmentInDeployment(key, dep.getSimpleName());
}
return value;
} | java |
public static <A> A getOptionalAttachment( final Deployment dep, final Class< A > key )
{
return dep.getAttachment( key );
} | java |
protected void createConstructorDelegates(ConstructorBodyCreator creator) {
ClassMetadataSource data = reflectionMetadataSource.getClassMetadata(getSuperClass());
for (Constructor<?> constructor : data.getConstructors()) {
if (!Modifier.isPrivate(constructor.getModifiers())) {
... | java |
public static void assertNoPrimitiveParameters(final Method method, Class<? extends Annotation> annotation)
{
for (Class<?> type : method.getParameterTypes())
{
if (type.isPrimitive())
{
throw annotation == null ? MESSAGES.methodCannotDeclarePrimitiveParameters(method) : MES... | java |
public static void assertNotPrimitiveType(final Field field, Class<? extends Annotation> annotation)
{
if (field.getType().isPrimitive())
{
throw annotation == null ? MESSAGES.fieldCannotBeOfPrimitiveOrVoidType(field) : MESSAGES.fieldCannotBeOfPrimitiveOrVoidType2(field, annotation);
}
... | java |
public static void assertNoParameters(final Method method, Class<? extends Annotation> annotation)
{
if (method.getParameterTypes().length != 0)
{
throw annotation == null ? MESSAGES.methodHasToHaveNoParameters(method) : MESSAGES.methodHasToHaveNoParameters2(method, annotation);
}
} | java |
public static void assertVoidReturnType(final Method method, Class<? extends Annotation> annotation)
{
if ((!method.getReturnType().equals(Void.class)) && (!method.getReturnType().equals(Void.TYPE)))
{
throw annotation == null ? MESSAGES.methodHasToReturnVoid(method) : MESSAGES.methodHasToRetur... | java |
public static void assertNotVoidType(final Field field, Class<? extends Annotation> annotation)
{
if ((field.getClass().equals(Void.class)) && (field.getClass().equals(Void.TYPE)))
{
throw annotation == null ? MESSAGES.fieldCannotBeOfPrimitiveOrVoidType(field) : MESSAGES.fieldCannotBeOfPrimitive... | java |
public static void assertNoCheckedExceptionsAreThrown(final Method method, Class<? extends Annotation> annotation)
{
Class<?>[] declaredExceptions = method.getExceptionTypes();
for (int i = 0; i < declaredExceptions.length; i++)
{
Class<?> exception = declaredExceptions[i];
if (!... | java |
public static void assertNotStatic(final Method method, Class<? extends Annotation> annotation)
{
if (Modifier.isStatic(method.getModifiers()))
{
throw annotation == null ? MESSAGES.methodCannotBeStatic(method) : MESSAGES.methodCannotBeStatic2(method, annotation);
}
} | java |
public static void assertNotStatic(final Field field, Class<? extends Annotation> annotation)
{
if (Modifier.isStatic(field.getModifiers()))
{
throw annotation == null ? MESSAGES.fieldCannotBeStaticOrFinal(field) : MESSAGES.fieldCannotBeStaticOrFinal2(field, annotation);
}
} | java |
public static void assertNotFinal(final Field field, Class<? extends Annotation> annotation)
{
if (Modifier.isFinal(field.getModifiers()))
{
throw annotation == null ? MESSAGES.fieldCannotBeStaticOrFinal(field) : MESSAGES.fieldCannotBeStaticOrFinal2(field, annotation);
}
} | java |
public static void assertOneParameter(final Method method, Class<? extends Annotation> annotation)
{
if (method.getParameterTypes().length != 1)
{
throw annotation == null ? MESSAGES.methodHasToDeclareExactlyOneParameter(method) : MESSAGES.methodHasToDeclareExactlyOneParameter2(method, annotatio... | java |
public static void assertValidSetterName(final Method method, Class<? extends Annotation> annotation)
{
final String methodName = method.getName();
final boolean correctMethodNameLength = methodName.length() > 3;
final boolean isSetterMethodName = methodName.startsWith("set");
final boolean i... | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.